diff --git a/api/version1/setupRoule/orgPeople.go b/api/version1/setupRoule/orgPeople.go index 80d24f5..93e7103 100644 --- a/api/version1/setupRoule/orgPeople.go +++ b/api/version1/setupRoule/orgPeople.go @@ -5,9 +5,9 @@ import ( "appPlatform/models/modelssystempermission" "appPlatform/overall" "appPlatform/overall/publicmethod" - "encoding/json" "fmt" "strconv" + "strings" "time" "github.com/gin-gonic/gin" @@ -362,7 +362,8 @@ func (a *ApiMethod) GetRolePeople(c *gin.Context) { } var userKey []string - json.Unmarshal([]byte(roleInfo.Roleuser), &userKey) + userKey = strings.Split(roleInfo.Roleuser, ",") + // json.Unmarshal([]byte(roleInfo.Roleuser), &userKey) var userList []modelshr.PersonArchives gormDb := overall.CONSTANT_DB_HR.Model(&modelshr.PersonArchives{}).Select("`id`,`key`,`name`,`number`,`icon`,`company`,`maindeparment`,`admin_org`,`icon_photo`").Where("`key` IN ?", userKey).Find(&userList) if requestData.Name != "" { @@ -444,8 +445,9 @@ func (a *ApiMethod) SavePickRoleMan(c *gin.Context) { } saveData := publicmethod.MapOut[string]() if len(requestData.UserKey) > 0 { - peopleJson, _ := json.Marshal(requestData.UserKey) - saveData["roleuser"] = string(peopleJson) + // peopleJson, _ := json.Marshal(requestData.UserKey) + // saveData["roleuser"] = string(peopleJson) + saveData["roleuser"] = strings.Join(requestData.UserKey, ",") } else { saveData["roleuser"] = "" } diff --git a/api/version1/user/setPower.go b/api/version1/user/setPower.go index e653f73..cfab403 100644 --- a/api/version1/user/setPower.go +++ b/api/version1/user/setPower.go @@ -21,6 +21,7 @@ func GetMyPower(powerType string, oupk, org, poetId int64) (allPower SendAllPowe //获取系统权限 var systemPower []modelssystempermission.AuthPowerList err = overall.CONSTANT_DB_System_Permission.Model(&modelssystempermission.AuthPowerList{}).Where("`appType` = 'system' AND `orgPowerType` = 'person' AND `orgOrUserKey` = ? AND `appKey` = 0", oupk).Find(&systemPower).Error + fmt.Printf("\n\nsystemPower--------->%v----->%v\n\n", oupk, systemPower) if len(systemPower) > 0 { //首先判断个人是否已经赋权 for _, v := range systemPower { var sysPower SystemInfoPower @@ -59,7 +60,10 @@ func GetMyPower(powerType string, oupk, org, poetId int64) (allPower SendAllPowe mySysMenuPower.GetPowerSystem(mySysMenuPower.SysTemList) allPower.MenuIdAry = mySysMenuPower.MenuId var menuList []modelAppPlatform.Menus - overall.CONSTANT_DB_AppPlatform.Model(&modelAppPlatform.Menus{}).Select("`id`,`name`").Where("`id` IN ?", mySysMenuPower.MenuId).Find(&menuList) + if len(mySysMenuPower.MenuId) > 0 { + overall.CONSTANT_DB_AppPlatform.Model(&modelAppPlatform.Menus{}).Select("`id`,`name`").Where("`id` IN ?", mySysMenuPower.MenuId).Find(&menuList) + } + for _, v := range menuList { for si, sv := range mySysMenuPower.SystemPower { if strconv.Itoa(v.Id) == sv.AppId { @@ -326,8 +330,8 @@ func (x *XieChengPowerSys) GetOrgSysPower(sysType, powerType string, key int64) // goromDb.Find(&x.SysTemList) case "role": var roleId []int64 - overall.CONSTANT_DB_System_Permission.Model(&modelssystempermission.SystemRole{}).Select("`id`").Where("FIND_IN_SET(?, `superior`)", key).Find(&roleId) - // fmt.Printf("role----->%v\n\n", roleId) + overall.CONSTANT_DB_System_Permission.Model(&modelssystempermission.SystemRole{}).Select("`id`").Where("FIND_IN_SET(?, `roleuser`)", key).Find(&roleId) + fmt.Printf("role----->%v----->%v\n\n", roleId, len(roleId)) if len(roleId) > 0 { goromDb = goromDb.Where("`orgOrUserKey` IN ?", roleId) goromDb.Find(&x.SysTemList)