package db import ( "applet/app/admin/enum" "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.Where("state = ?", enum.PermissionGroupStateForNormal).Asc("id").Find(&m); err != nil { return nil, logx.Error(err) } return &m, nil } func (permissionGroupDb *PermissionGroupDb) FindPermissionGroupV2() (*[]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 }