return roleService.savePermission(roleMenuDto); | return roleService.savePermission(roleMenuDto); | ||||
} | } | ||||
/** | |||||
* 初始化租户固定角色 | |||||
* @param ids | |||||
* @return | |||||
*/ | |||||
@GetMapping("/test/{ids}") | |||||
public JsonResult test(@PathVariable("ids") Integer[] ids){ | |||||
return roleService.roleToTenant(ids); | |||||
} | |||||
} | } |
JsonResult updateStatus(Role entity); | JsonResult updateStatus(Role entity); | ||||
JsonResult savePermission(RoleMenuDto roleMenuDto); | JsonResult savePermission(RoleMenuDto roleMenuDto); | ||||
JsonResult roleToTenant(Integer[] ids); | |||||
} | } |
return JsonResult.success("权限保存成功"); | return JsonResult.success("权限保存成功"); | ||||
} | } | ||||
/** | |||||
* 初始化租户固定角色 | |||||
* @param ids | |||||
* @return | |||||
*/ | |||||
@Override | |||||
public JsonResult roleToTenant(Integer[] ids) { | |||||
for (Integer id : ids) { | |||||
//批量初始化租户对应角色配置 | |||||
List<Role> roles = roleMapper.selectList(Wrappers.<Role>lambdaQuery() | |||||
.eq(Role::getMark, 1).eq(Role::getStatus, 1) | |||||
.eq(Role::getTenantId, 1) | |||||
.ne(Role::getCode, "super")); | |||||
for (Role role : roles) { | |||||
role.setTenantId(id.toString()); | |||||
roleMapper.insert(role); | |||||
} | |||||
} | |||||
return JsonResult.success(); | |||||
} | |||||
} | } |