|
- package implement
-
- import (
- "applet/app/db/dao"
- "applet/app/db/model"
- "applet/app/enum"
- "applet/app/utils/logx"
- "xorm.io/xorm"
- )
-
- func NewMediumPermissionGroupDb(engine *xorm.Engine) dao.MediumPermissionGroupDao {
- return &MediumPermissionGroupDb{Db: engine}
- }
-
- type MediumPermissionGroupDb struct {
- Db *xorm.Engine
- }
-
- func (m MediumPermissionGroupDb) FindMediumPermissionGroup() (*[]model.MediumPermissionGroup, error) {
- var mm []model.MediumPermissionGroup
- if err := m.Db.Where("state = ?", enum.PermissionGroupStateForNormal).Asc("id").Find(&mm); err != nil {
- return nil, logx.Error(err)
- }
- return &mm, nil
- }
-
- func (m MediumPermissionGroupDb) FindMediumPermissionGroupV2() (*[]model.MediumPermissionGroup, error) {
- var mm []model.MediumPermissionGroup
- if err := m.Db.Asc("id").Find(&mm); err != nil {
- return nil, logx.Error(err)
- }
- return &mm, nil
- }
|