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