广告平台(站长下代理使用)
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.
 
 
 
 
 
 

34 lines
794 B

  1. package implement
  2. import (
  3. "applet/app/db/dao"
  4. "applet/app/db/model"
  5. "applet/app/enum"
  6. "applet/app/utils/logx"
  7. "xorm.io/xorm"
  8. )
  9. func NewPermissionGroupDb(engine *xorm.Engine) dao.PermissionGroupDao {
  10. return &PermissionGroupDb{Db: engine}
  11. }
  12. type PermissionGroupDb struct {
  13. Db *xorm.Engine
  14. }
  15. func (p PermissionGroupDb) FindPermissionGroup() (*[]model.PermissionGroup, error) {
  16. var m []model.PermissionGroup
  17. if err := p.Db.Where("state = ?", enum.PermissionGroupStateForNormal).Asc("id").Find(&m); err != nil {
  18. return nil, logx.Error(err)
  19. }
  20. return &m, nil
  21. }
  22. func (p PermissionGroupDb) FindPermissionGroupV2() (*[]model.PermissionGroup, error) {
  23. var m []model.PermissionGroup
  24. if err := p.Db.Asc("id").Find(&m); err != nil {
  25. return nil, logx.Error(err)
  26. }
  27. return &m, nil
  28. }