Browse Source

更新

master
huangjiajun 1 day ago
parent
commit
2a209e73d2
2 changed files with 23 additions and 0 deletions
  1. +2
    -0
      src/dao/agent_dao.go
  2. +21
    -0
      src/implement/agent_implement.go

+ 2
- 0
src/dao/agent_dao.go View File

@@ -16,6 +16,8 @@ type AgentDao interface {
FindAgentRolePermissionGroup(id int) (list []*AgentWithRolePermissionGroup, total int64, err error)
GetSuperAdmin(agentId int) (list *model.Agent)
GetSuperAgentByUsername(username string) (agent *model.Agent, err error)
FindSuperAdminByAgebtId(agentId string, page, limit int) (list []model.Agent, total int64, err error)
FindAllSuperAdmin() (list *[]model.Agent)
}

type AgentWithRolePermissionGroup struct {


+ 21
- 0
src/implement/agent_implement.go View File

@@ -5,6 +5,7 @@ import (
"code.fnuoos.com/zhimeng/model.git/src/model"
zhios_order_relate_logx "code.fnuoos.com/zhimeng/model.git/utils/logx"
"reflect"
"strings"
"xorm.io/xorm"
)

@@ -118,3 +119,23 @@ func (a AgentDb) GetSuperAgentByUsername(username string) (agent *model.Agent, e
}
return agent, nil
}
func (a AgentDb) FindSuperAdminByAgebtId(agentId string, page, limit int) (list []model.Agent, total int64, err error) {
sess := a.Db.Where("is_super_administrator=1").Desc("id").Limit(limit, (page-1)*limit)
if agentId != "" {
sess.In("agent_id", strings.Split(agentId, ","))
}
total, err = sess.FindAndCount(&list)
if err != nil {
return nil, 0, err
}
return
}
func (a AgentDb) FindAllSuperAdmin() (list *[]model.Agent) {
list = &[]model.Agent{}
sess := a.Db.Where("is_super_administrator=1")
err := sess.Find(list)
if err != nil {
return nil
}
return list
}

Loading…
Cancel
Save