From 6880b83c2d3912169e703bd23e354d942a0a1168 Mon Sep 17 00:00:00 2001 From: HuangZhi Date: Mon, 10 Jul 2023 11:26:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=94=A8=E6=88=B7=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/bean/vo/response/system_role.go | 26 +++++++++++++------------- src/router/dict.go | 3 +-- src/service/system_menu.go | 6 +++--- src/service/system_role.go | 9 ++++++--- 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/bean/vo/response/system_role.go b/src/bean/vo/response/system_role.go index 6c0821d..162d457 100644 --- a/src/bean/vo/response/system_role.go +++ b/src/bean/vo/response/system_role.go @@ -55,17 +55,17 @@ type SystemRoleListRes struct { } type SystemAllotUserList struct { - Id int32 `json:"id" ` // id - SystemAccount string `json:"system_account"` // 系统账号 - IsAdmin int `json:"is_admin"` // 用户类型 - Phone string `json:"phone"` // 联系人电话 - OrganizationId string `json:"organization_id"` // 所属组织 - OrganizationName string `json:"organization_name" xorm:"name"` // 所属组织 - State int `json:"state"` // 状态0禁用1启用 - CreatedTime time.Time `json:"created_time"` // 创建时间 - SystemId string `json:"system_id" xorm:"system_id"` // 系统账号id - UrSystemId string `json:"ur_system_id" xorm:"ur_system_id"` // 系统账号id - IsBind int `json:"is_bind"` // 是否绑定 0否1是 + Id int32 `json:"id" ` // id + SystemAccount string `json:"system_account"` // 系统账号 + IsAdmin int `json:"is_admin"` // 用户类型 + Phone string `json:"phone"` // 联系人电话 + OrganizationId string `json:"organization_id"` // 所属组织 + OrganizationName string `json:"organization_name" xorm:"name"` // 所属组织 + State int `json:"state"` // 状态0禁用1启用 + CreatedTime time.Time `json:"created_time"` // 创建时间 + //SystemId string `json:"system_id" xorm:"system_id"` // 系统账号id + UrUserId int `json:"ur_user_id" xorm:"ur_user_id"` // 用户id + IsBind int `json:"is_bind"` // 是否绑定 0否1是 } type SystemAllotUserListRes struct { @@ -77,6 +77,6 @@ type SystemAllotUserListRes struct { OrganizationName string `json:"organization_name"` // 所属组织 State int `json:"state"` // 状态0禁用1启用 CreatedTime jsontime.Time `json:"created_time"` // 创建时间 - SystemId string `json:"system_id"` // 系统账号id - IsBind int `json:"is_bind"` // 是否绑定 0否1是 + //SystemId string `json:"system_id"` // 系统账号id + IsBind int `json:"is_bind"` // 是否绑定 0否1是 } diff --git a/src/router/dict.go b/src/router/dict.go index 20b6cca..5f31d2d 100644 --- a/src/router/dict.go +++ b/src/router/dict.go @@ -8,12 +8,11 @@ import ( "gitlab.wodcloud.com/smart-operation/so-operation-api/src/router/middleware/header" ) -// InitSystemLoginRouter 初始化登录相关路由 +// initDictRoute 初始化字典相关路由 func initDictRoute(e *gin.Engine) { base := e.Group(fmt.Sprintf("%s/dict", conf.Options.Prefix), header.SetContext) //系统字典 - dict := new(controller.Dict) base.POST("", dict.Add) //新增字典 base.PUT("", dict.Update) //修改字典 diff --git a/src/service/system_menu.go b/src/service/system_menu.go index 29fe1e8..2c8c64d 100644 --- a/src/service/system_menu.go +++ b/src/service/system_menu.go @@ -304,8 +304,8 @@ func (s *SystemMenu) GetSystemTree(search string) (interface{}, error) { Join("INNER", []string{"system_role_menu", "srm"}, "sur.role_id = srm.role_id"). Join("INNER", []string{"system_menu", "sm"}, "sm.menu_id = srm.menu_id"). Join("INNER", []string{"system_role", "sr"}, "sur.role_id = sr.role_id"). - Select("max(sur.system_id::varchar) as system_id,sm.*"). - Where("sm.is_deleted = 0 and sm.state = 1 and sur.role_id = ?", s.User.Id). + Select("max(sur.user_id) as user_id,sm.*"). + Where("sm.is_deleted = 0 and sm.state = 1 and sur.user_id = ?", s.User.Id). And("sr.state = 1 and sr.is_deleted = 0"). GroupBy("sm.id"). OrderBy("sm.level").OrderBy("sm.sort").Find(&menus); err != nil { @@ -317,7 +317,7 @@ func (s *SystemMenu) GetSystemTree(search string) (interface{}, error) { // 组装树形 for i, v := range menus { if v.Level == 1 { - if !strings.Contains(v.MenuName, search) { + if !strings.Contains(v.SystemType, search) { continue } changeMenuTreePer(&menus[i], menus, search) diff --git a/src/service/system_role.go b/src/service/system_role.go index 89c01fb..0aa806b 100644 --- a/src/service/system_role.go +++ b/src/service/system_role.go @@ -301,6 +301,9 @@ func SystemAllotUserList(params *request.SystemAllotUserListReq) (resultData []r modelObj.Where("su.system_account like ? or su.phone ? ", params.Search, params.Search) } + if systemRole.RoleType == 1 { + modelObj.Where("so.data_type < 2") + } if systemRole.RoleType == 2 { modelObj.Where("so.data_type = 2") } @@ -355,10 +358,10 @@ func SystemAllotUserList(params *request.SystemAllotUserListReq) (resultData []r OrganizationName: v.OrganizationName, State: v.State, CreatedTime: jsontime.Time(v.CreatedTime), - SystemId: v.SystemId, - IsBind: 0, + //SystemId: v.SystemId, + IsBind: 0, } - if v.UrSystemId != "" { + if v.UrUserId != 0 { SystemUserListRes.IsBind = 1 } SystemUserListResArr = append(SystemUserListResArr, SystemUserListRes) -- 2.26.0