Commit 6880b83c authored by 黄智's avatar 黄智

新增用户菜单接口

parent 478ef3ef
...@@ -63,8 +63,8 @@ type SystemAllotUserList struct { ...@@ -63,8 +63,8 @@ type SystemAllotUserList struct {
OrganizationName string `json:"organization_name" xorm:"name"` // 所属组织 OrganizationName string `json:"organization_name" xorm:"name"` // 所属组织
State int `json:"state"` // 状态0禁用1启用 State int `json:"state"` // 状态0禁用1启用
CreatedTime time.Time `json:"created_time"` // 创建时间 CreatedTime time.Time `json:"created_time"` // 创建时间
SystemId string `json:"system_id" xorm:"system_id"` // 系统账号id //SystemId string `json:"system_id" xorm:"system_id"` // 系统账号id
UrSystemId string `json:"ur_system_id" xorm:"ur_system_id"` // 系统账号id UrUserId int `json:"ur_user_id" xorm:"ur_user_id"` // 用户id
IsBind int `json:"is_bind"` // 是否绑定 0否1是 IsBind int `json:"is_bind"` // 是否绑定 0否1是
} }
...@@ -77,6 +77,6 @@ type SystemAllotUserListRes struct { ...@@ -77,6 +77,6 @@ type SystemAllotUserListRes struct {
OrganizationName string `json:"organization_name"` // 所属组织 OrganizationName string `json:"organization_name"` // 所属组织
State int `json:"state"` // 状态0禁用1启用 State int `json:"state"` // 状态0禁用1启用
CreatedTime jsontime.Time `json:"created_time"` // 创建时间 CreatedTime jsontime.Time `json:"created_time"` // 创建时间
SystemId string `json:"system_id"` // 系统账号id //SystemId string `json:"system_id"` // 系统账号id
IsBind int `json:"is_bind"` // 是否绑定 0否1是 IsBind int `json:"is_bind"` // 是否绑定 0否1是
} }
...@@ -8,12 +8,11 @@ import ( ...@@ -8,12 +8,11 @@ import (
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/router/middleware/header" "gitlab.wodcloud.com/smart-operation/so-operation-api/src/router/middleware/header"
) )
// InitSystemLoginRouter 初始化登录相关路由 // initDictRoute 初始化字典相关路由
func initDictRoute(e *gin.Engine) { func initDictRoute(e *gin.Engine) {
base := e.Group(fmt.Sprintf("%s/dict", conf.Options.Prefix), header.SetContext) base := e.Group(fmt.Sprintf("%s/dict", conf.Options.Prefix), header.SetContext)
//系统字典 //系统字典
dict := new(controller.Dict) dict := new(controller.Dict)
base.POST("", dict.Add) //新增字典 base.POST("", dict.Add) //新增字典
base.PUT("", dict.Update) //修改字典 base.PUT("", dict.Update) //修改字典
......
...@@ -304,8 +304,8 @@ func (s *SystemMenu) GetSystemTree(search string) (interface{}, error) { ...@@ -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_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_menu", "sm"}, "sm.menu_id = srm.menu_id").
Join("INNER", []string{"system_role", "sr"}, "sur.role_id = sr.role_id"). Join("INNER", []string{"system_role", "sr"}, "sur.role_id = sr.role_id").
Select("max(sur.system_id::varchar) as system_id,sm.*"). Select("max(sur.user_id) as user_id,sm.*").
Where("sm.is_deleted = 0 and sm.state = 1 and sur.role_id = ?", s.User.Id). 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"). And("sr.state = 1 and sr.is_deleted = 0").
GroupBy("sm.id"). GroupBy("sm.id").
OrderBy("sm.level").OrderBy("sm.sort").Find(&menus); err != nil { OrderBy("sm.level").OrderBy("sm.sort").Find(&menus); err != nil {
...@@ -317,7 +317,7 @@ func (s *SystemMenu) GetSystemTree(search string) (interface{}, error) { ...@@ -317,7 +317,7 @@ func (s *SystemMenu) GetSystemTree(search string) (interface{}, error) {
// 组装树形 // 组装树形
for i, v := range menus { for i, v := range menus {
if v.Level == 1 { if v.Level == 1 {
if !strings.Contains(v.MenuName, search) { if !strings.Contains(v.SystemType, search) {
continue continue
} }
changeMenuTreePer(&menus[i], menus, search) changeMenuTreePer(&menus[i], menus, search)
......
...@@ -301,6 +301,9 @@ func SystemAllotUserList(params *request.SystemAllotUserListReq) (resultData []r ...@@ -301,6 +301,9 @@ func SystemAllotUserList(params *request.SystemAllotUserListReq) (resultData []r
modelObj.Where("su.system_account like ? or su.phone ? ", params.Search, params.Search) 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 { if systemRole.RoleType == 2 {
modelObj.Where("so.data_type = 2") modelObj.Where("so.data_type = 2")
} }
...@@ -355,10 +358,10 @@ func SystemAllotUserList(params *request.SystemAllotUserListReq) (resultData []r ...@@ -355,10 +358,10 @@ func SystemAllotUserList(params *request.SystemAllotUserListReq) (resultData []r
OrganizationName: v.OrganizationName, OrganizationName: v.OrganizationName,
State: v.State, State: v.State,
CreatedTime: jsontime.Time(v.CreatedTime), CreatedTime: jsontime.Time(v.CreatedTime),
SystemId: v.SystemId, //SystemId: v.SystemId,
IsBind: 0, IsBind: 0,
} }
if v.UrSystemId != "" { if v.UrUserId != 0 {
SystemUserListRes.IsBind = 1 SystemUserListRes.IsBind = 1
} }
SystemUserListResArr = append(SystemUserListResArr, SystemUserListRes) SystemUserListResArr = append(SystemUserListResArr, SystemUserListRes)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment