|
@@ -284,9 +284,20 @@ public class SysUserController {
|
|
|
|
|
|
@RequiresPermissions("system:user:queryUserRole")
|
|
@RequiresPermissions("system:user:queryUserRole")
|
|
@RequestMapping(value = "/queryUserRole", method = RequestMethod.GET)
|
|
@RequestMapping(value = "/queryUserRole", method = RequestMethod.GET)
|
|
- public Result<List<String>> queryUserRole(@RequestParam(name = "userid", required = true) String userid) {
|
|
|
|
|
|
+ public Result<List<String>> queryUserRole(@RequestParam(name = "userid", required = true) String userid,
|
|
|
|
+ @RequestParam(name = "appId", required = false) String appId) {
|
|
Result<List<String>> result = new Result<>();
|
|
Result<List<String>> result = new Result<>();
|
|
List<String> list = new ArrayList<String>();
|
|
List<String> list = new ArrayList<String>();
|
|
|
|
+
|
|
|
|
+ if (appId != null){
|
|
|
|
+ List<String> roleIds = sysUserRoleService.listByAppId(appId, userid);
|
|
|
|
+ if (roleIds != null && roleIds.size() > 0) {
|
|
|
|
+ result.setSuccess(true);
|
|
|
|
+ result.setResult(roleIds);
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+ result.error500("未找到应用下用户相关角色信息");
|
|
|
|
+ }
|
|
List<SysUserRole> userRole = sysUserRoleService.list(new QueryWrapper<SysUserRole>().lambda().eq(SysUserRole::getUserId, userid));
|
|
List<SysUserRole> userRole = sysUserRoleService.list(new QueryWrapper<SysUserRole>().lambda().eq(SysUserRole::getUserId, userid));
|
|
if (userRole == null || userRole.size() <= 0) {
|
|
if (userRole == null || userRole.size() <= 0) {
|
|
result.error500("未找到用户相关角色信息");
|
|
result.error500("未找到用户相关角色信息");
|
|
@@ -678,9 +689,7 @@ public class SysUserController {
|
|
SysUserRole one = sysUserRoleService.getOne(queryWrapper);
|
|
SysUserRole one = sysUserRoleService.getOne(queryWrapper);
|
|
if(one==null){
|
|
if(one==null){
|
|
sysUserRoleService.save(sysUserRole);
|
|
sysUserRoleService.save(sysUserRole);
|
|
-
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
result.setMessage("添加成功!");
|
|
result.setMessage("添加成功!");
|
|
result.setSuccess(true);
|
|
result.setSuccess(true);
|