面包店
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

pirms 8 mēnešiem
1234567891011121314151617181920212223242526272829303132
  1. package db
  2. import (
  3. "applet/app/admin/enum"
  4. "applet/app/db/model"
  5. "applet/app/utils/logx"
  6. "xorm.io/xorm"
  7. )
  8. type PermissionGroupDb struct {
  9. Db *xorm.Engine `json:"db"`
  10. }
  11. func (permissionGroupDb *PermissionGroupDb) Set() { // set方法
  12. permissionGroupDb.Db = Db
  13. }
  14. func (permissionGroupDb *PermissionGroupDb) FindPermissionGroup() (*[]model.PermissionGroup, error) {
  15. var m []model.PermissionGroup
  16. if err := permissionGroupDb.Db.Where("state = ?", enum.PermissionGroupStateForNormal).Asc("id").Find(&m); err != nil {
  17. return nil, logx.Error(err)
  18. }
  19. return &m, nil
  20. }
  21. func (permissionGroupDb *PermissionGroupDb) FindPermissionGroupV2() (*[]model.PermissionGroup, error) {
  22. var m []model.PermissionGroup
  23. if err := permissionGroupDb.Db.Asc("id").Find(&m); err != nil {
  24. return nil, logx.Error(err)
  25. }
  26. return &m, nil
  27. }