【fix sonar】 SysPermissionServiceImpl.java文件
This commit is contained in:
+6
-4
@@ -51,6 +51,8 @@ public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, S
|
||||
@Resource
|
||||
private SysDepartPermissionMapper sysDepartPermissionMapper;
|
||||
|
||||
private static final String ERROR_MSG = "未找到菜单信息";
|
||||
|
||||
@Override
|
||||
public List<TreeModel> queryListByParentId(String parentId) {
|
||||
return sysPermissionMapper.queryListByParentId(parentId);
|
||||
@@ -65,7 +67,7 @@ public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, S
|
||||
public void deletePermission(String id) throws JeroBootException {
|
||||
SysPermission sysPermission = this.getById(id);
|
||||
if(sysPermission==null) {
|
||||
throw new JeroBootException("未找到菜单信息");
|
||||
throw new JeroBootException(ERROR_MSG);
|
||||
}
|
||||
String pid = sysPermission.getParentId();
|
||||
if(oConvertUtils.isNotEmpty(pid)) {
|
||||
@@ -100,7 +102,7 @@ public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, S
|
||||
query.eq(SysPermission::getParentId, parentId);
|
||||
// 查出该主键下的所有子级
|
||||
List<SysPermission> permissionList = this.list(query);
|
||||
if (permissionList != null && permissionList.size() > 0) {
|
||||
if (permissionList != null && !permissionList.isEmpty()) {
|
||||
String id = ""; // id
|
||||
int num = 0; // 查出的子级数量
|
||||
// 如果查出的集合不为空, 则先删除所有
|
||||
@@ -134,7 +136,7 @@ public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, S
|
||||
public void deletePermissionLogical(String id) throws JeroBootException {
|
||||
SysPermission sysPermission = this.getById(id);
|
||||
if(sysPermission==null) {
|
||||
throw new JeroBootException("未找到菜单信息");
|
||||
throw new JeroBootException(ERROR_MSG);
|
||||
}
|
||||
String pid = sysPermission.getParentId();
|
||||
int count = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, pid));
|
||||
@@ -172,7 +174,7 @@ public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, S
|
||||
SysPermission p = this.getById(sysPermission.getId());
|
||||
//TODO 该节点判断是否还有子节点
|
||||
if(p==null) {
|
||||
throw new JeroBootException("未找到菜单信息");
|
||||
throw new JeroBootException(ERROR_MSG);
|
||||
}else {
|
||||
sysPermission.setUpdateTime(new Date());
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user