|
@@ -286,9 +286,20 @@ public class SysUserController {
|
|
|
|
|
|
@RequiresPermissions("system:user:queryUserRole")
|
|
|
@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<>();
|
|
|
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));
|
|
|
if (userRole == null || userRole.size() <= 0) {
|
|
|
result.error500("未找到用户相关角色信息");
|
|
@@ -767,9 +778,7 @@ public class SysUserController {
|
|
|
SysUserRole one = sysUserRoleService.getOne(queryWrapper);
|
|
|
if(one==null){
|
|
|
sysUserRoleService.save(sysUserRole);
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
result.setMessage("添加成功!");
|
|
|
result.setSuccess(true);
|