【fix sonar】SysPermissionServiceImpl文件

This commit is contained in:
梁琦涛
2023-03-08 17:56:23 +08:00
parent 38aeb36783
commit d87b7f1351
@@ -197,12 +197,9 @@ public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, S
this.sysPermissionMapper.setMenuLeaf(pid, 0);
//b.判断老的菜单下是否还有其他子菜单,没有的话则设置为叶子节点
int cc = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, p.getParentId()));
if(cc==0) {
if(oConvertUtils.isNotEmpty(p.getParentId())) {
this.sysPermissionMapper.setMenuLeaf(p.getParentId(), 1);
}
if(cc == 0 && oConvertUtils.isNotEmpty(p.getParentId())) {
this.sysPermissionMapper.setMenuLeaf(p.getParentId(), 1);
}
}
}
@@ -238,11 +235,7 @@ public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, S
@Override
public boolean hasPermission(String username, SysPermission sysPermission) {
int count = baseMapper.queryCountByUsername(username,sysPermission);
if(count>0){
return true;
}else{
return false;
}
return count > 0;
}
@Override
@@ -250,11 +243,7 @@ public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, S
SysPermission sysPermission = new SysPermission();
sysPermission.setUrl(url);
int count = baseMapper.queryCountByUsername(username,sysPermission);
if(count>0){
return true;
}else{
return false;
}
return count > 0;
}
}