|
- package implement
-
- import (
- "code.fnuoos.com/zhimeng/model.git/enum"
- "code.fnuoos.com/zhimeng/model.git/src/dao"
- "code.fnuoos.com/zhimeng/model.git/src/model"
- zhios_order_relate_logx "code.fnuoos.com/zhimeng/model.git/utils/logx"
- "xorm.io/xorm"
- )
-
- func NewPermissionGroupDb(engine *xorm.Engine) dao.PermissionGroupDao {
- return &PermissionGroupDb{Db: engine}
- }
-
- type PermissionGroupDb struct {
- Db *xorm.Engine
- }
-
- func (p PermissionGroupDb) FindPermissionGroup() (*[]model.PermissionGroup, error) {
- var m []model.PermissionGroup
- if err := p.Db.Where("state = ?", enum.PermissionGroupStateForNormal).Asc("id").Find(&m); err != nil {
- return nil, zhios_order_relate_logx.Error(err)
- }
- return &m, nil
- }
-
- func (p PermissionGroupDb) FindPermissionGroupV2() (*[]model.PermissionGroup, error) {
- var m []model.PermissionGroup
- if err := p.Db.OrderBy("sort desc,id asc").Find(&m); err != nil {
- return nil, zhios_order_relate_logx.Error(err)
- }
- return &m, nil
- }
|