package db import ( "applet/app/db/model" "applet/app/utils/logx" "xorm.io/xorm" ) type PermissionGroupDb struct { Db *xorm.Engine `json:"db"` } func (permissionGroupDb *PermissionGroupDb) Set() { // set方法 permissionGroupDb.Db = Db } func (permissionGroupDb *PermissionGroupDb) FindPermissionGroup() (*[]model.PermissionGroup, error) { var m []model.PermissionGroup if err := permissionGroupDb.Db.Asc("id").Find(&m); err != nil { return nil, logx.Error(err) } return &m, nil }