瀏覽代碼

更新

master
huangjiajun 1 月之前
父節點
當前提交
2a209e73d2
共有 2 個檔案被更改,包括 23 行新增0 行删除
  1. +2
    -0
      src/dao/agent_dao.go
  2. +21
    -0
      src/implement/agent_implement.go

+ 2
- 0
src/dao/agent_dao.go 查看文件

@@ -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 查看文件

@@ -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…
取消
儲存