diff --git a/api/version1/setupRoule/power.go b/api/version1/setupRoule/power.go index 843c107..8c762ef 100644 --- a/api/version1/setupRoule/power.go +++ b/api/version1/setupRoule/power.go @@ -282,8 +282,18 @@ func CopyRolePowerAry(oldRoleId int64, newRoleInfoEntry modelssystempermission.S return } var saveNewRole []modelssystempermission.AuthPower - for i, v := range authPowerList { - uuid := publicmethod.GetUUid(int64(i)) + var oldUuid []int64 + var uuid int64 + for _, v := range authPowerList { + // uuid := publicmethod.GetUUid(int64(i)) + for { + uuid = publicmethod.GetUUid(1) + if !publicmethod.IsInTrue[int64](uuid, oldUuid) { + oldUuid = append(oldUuid, uuid) + break + } + } + var newRoleInfo modelssystempermission.AuthPower newRoleInfo.Id = uuid // newRoleInfo.OrgPowerType = v.OrgPowerType //赋权类型(org:组织;job:岗位;role:角色;person:个人)\` @@ -346,16 +356,26 @@ func CopyGroupPower(oldRoleId int64, newRoleInfo modelssystempermission.SystemRo if err != nil { return } + var oldUuid []int64 + var uuid int64 var saveNewRoleGroup []modelssystempermission.AuthGroupPower - for i, v := range oldRoleGroupAry { + for _, v := range oldRoleGroupAry { + + for { + uuid = publicmethod.GetUUid(1) + if !publicmethod.IsInTrue[int64](uuid, oldUuid) { + oldUuid = append(oldUuid, uuid) + break + } + } var newCont modelssystempermission.AuthGroupPower - newCont.Id = publicmethod.GetUUid(int64(i)) // - newCont.AppType = v.AppType //系统类型(system:系统平台;app:自定义表单与应用)" - newCont.OrgPowerType = v.OrgPowerType //赋权类型(org:组织;job:岗位;role:角色;person:个人)" - newCont.OrgOrUserKey = newRoleInfo.Id //行政组织或角色、人员识别符 - newCont.Time = time.Now().Unix() //编辑时间 - newCont.PowerInfo = v.PowerInfo //权限结构体" - newCont.GroupStatus = v.GroupStatus //分组权限状态" + newCont.Id = uuid // + newCont.AppType = v.AppType //系统类型(system:系统平台;app:自定义表单与应用)" + newCont.OrgPowerType = v.OrgPowerType //赋权类型(org:组织;job:岗位;role:角色;person:个人)" + newCont.OrgOrUserKey = newRoleInfo.Id //行政组织或角色、人员识别符 + newCont.Time = time.Now().Unix() //编辑时间 + newCont.PowerInfo = v.PowerInfo //权限结构体" + newCont.GroupStatus = v.GroupStatus //分组权限状态" saveNewRoleGroup = append(saveNewRoleGroup, newCont) } if len(saveNewRoleGroup) > 0 {