【fix sonar】SysPermissionServiceImpl文件
This commit is contained in:
+4
-15
@@ -197,12 +197,9 @@ public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, S
|
|||||||
this.sysPermissionMapper.setMenuLeaf(pid, 0);
|
this.sysPermissionMapper.setMenuLeaf(pid, 0);
|
||||||
//b.判断老的菜单下是否还有其他子菜单,没有的话则设置为叶子节点
|
//b.判断老的菜单下是否还有其他子菜单,没有的话则设置为叶子节点
|
||||||
int cc = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, p.getParentId()));
|
int cc = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, p.getParentId()));
|
||||||
if(cc==0) {
|
if(cc == 0 && oConvertUtils.isNotEmpty(p.getParentId())) {
|
||||||
if(oConvertUtils.isNotEmpty(p.getParentId())) {
|
this.sysPermissionMapper.setMenuLeaf(p.getParentId(), 1);
|
||||||
this.sysPermissionMapper.setMenuLeaf(p.getParentId(), 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,11 +235,7 @@ public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, S
|
|||||||
@Override
|
@Override
|
||||||
public boolean hasPermission(String username, SysPermission sysPermission) {
|
public boolean hasPermission(String username, SysPermission sysPermission) {
|
||||||
int count = baseMapper.queryCountByUsername(username,sysPermission);
|
int count = baseMapper.queryCountByUsername(username,sysPermission);
|
||||||
if(count>0){
|
return count > 0;
|
||||||
return true;
|
|
||||||
}else{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -250,11 +243,7 @@ public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, S
|
|||||||
SysPermission sysPermission = new SysPermission();
|
SysPermission sysPermission = new SysPermission();
|
||||||
sysPermission.setUrl(url);
|
sysPermission.setUrl(url);
|
||||||
int count = baseMapper.queryCountByUsername(username,sysPermission);
|
int count = baseMapper.queryCountByUsername(username,sysPermission);
|
||||||
if(count>0){
|
return count > 0;
|
||||||
return true;
|
|
||||||
}else{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user