智慧食堂
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

db_permission_group.go 828 B

1 jaar geleden
1 jaar geleden
1 jaar geleden
1 jaar geleden
1 jaar geleden
1 jaar geleden
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. }