|
- package implement
-
- import (
- "applet/app/db/dao"
- "applet/app/db/model"
- "applet/app/enum"
- "applet/app/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, logx.Error(err)
- }
- return &m, nil
- }
-
- func (p PermissionGroupDb) FindPermissionGroupV2() (*[]model.PermissionGroup, error) {
- var m []model.PermissionGroup
- if err := p.Db.Asc("id").Find(&m); err != nil {
- return nil, logx.Error(err)
- }
- return &m, nil
- }
|