【fix sonar】SysRoleController文件
This commit is contained in:
+8
-14
@@ -77,7 +77,7 @@ public class SysRoleController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ISysPermissionService sysPermissionService;
|
private ISysPermissionService sysPermissionService;
|
||||||
|
|
||||||
private static String OPTION_SUCCESS = "操作成功!";
|
private static final String OPTION_SUCCESS = "操作成功!";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页列表查询
|
* 分页列表查询
|
||||||
@@ -223,19 +223,13 @@ public class SysRoleController {
|
|||||||
role = sysRoleService.getById(id);
|
role = sysRoleService.getById(id);
|
||||||
}
|
}
|
||||||
SysRole newRole = sysRoleService.getOne(new QueryWrapper<SysRole>().lambda().eq(SysRole::getRoleCode, roleCode));
|
SysRole newRole = sysRoleService.getOne(new QueryWrapper<SysRole>().lambda().eq(SysRole::getRoleCode, roleCode));
|
||||||
if(newRole!=null) {
|
//如果根据传入的roleCode查询到信息了,那么就需要做校验了。
|
||||||
//如果根据传入的roleCode查询到信息了,那么就需要做校验了。
|
if(newRole!=null && (role==null || !id.equals(newRole.getId()))) {
|
||||||
if(role==null) {
|
//role为空=>新增模式=>只要roleCode存在则返回false
|
||||||
//role为空=>新增模式=>只要roleCode存在则返回false
|
//否则=>编辑模式=>判断两者ID是否一致-
|
||||||
result.setSuccess(false);
|
result.setSuccess(false);
|
||||||
result.setMessage("角色编码已存在");
|
result.setMessage("角色编码已存在");
|
||||||
return result;
|
return result;
|
||||||
}else if(!id.equals(newRole.getId())) {
|
|
||||||
//否则=>编辑模式=>判断两者ID是否一致-
|
|
||||||
result.setSuccess(false);
|
|
||||||
result.setMessage("角色编码已存在");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
result.setSuccess(false);
|
result.setSuccess(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user