模型库
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
965 B

  1. package implement
  2. import (
  3. "code.fnuoos.com/zhimeng/model.git/enum"
  4. "code.fnuoos.com/zhimeng/model.git/src/dao"
  5. "code.fnuoos.com/zhimeng/model.git/src/model"
  6. zhios_order_relate_logx "code.fnuoos.com/zhimeng/model.git/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, zhios_order_relate_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.OrderBy("sort desc,id asc").Find(&m); err != nil {
  25. return nil, zhios_order_relate_logx.Error(err)
  26. }
  27. return &m, nil
  28. }