Browse Source

流程条件查询增加租户过滤

test
smallchill 3 years ago
parent
commit
5df0e755b8
  1. 4
      blade-service/blade-system/src/main/java/org/springblade/system/service/impl/DeptServiceImpl.java
  2. 4
      blade-service/blade-system/src/main/java/org/springblade/system/service/impl/RoleServiceImpl.java

4
blade-service/blade-system/src/main/java/org/springblade/system/service/impl/DeptServiceImpl.java

@ -155,7 +155,11 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
@Override
public List<DeptVO> search(String deptName, Long parentId) {
String tenantId = AuthUtil.getTenantId();
LambdaQueryWrapper<Dept> queryWrapper = Wrappers.<Dept>query().lambda();
if (Func.isNotEmpty(tenantId)) {
queryWrapper.eq(Dept::getTenantId, tenantId);
}
if (Func.isNotEmpty(deptName)) {
queryWrapper.like(Dept::getDeptName, deptName);
}

4
blade-service/blade-system/src/main/java/org/springblade/system/service/impl/RoleServiceImpl.java

@ -203,6 +203,7 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
@Override
public List<RoleVO> search(String roleName, Long parentId) {
String tenantId = AuthUtil.getTenantId();
LambdaQueryWrapper<Role> queryWrapper = Wrappers.<Role>query().lambda();
if (Func.isNotEmpty(roleName)) {
queryWrapper.like(Role::getRoleName, roleName);
@ -210,6 +211,9 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
if (Func.isNotEmpty(parentId) && parentId > 0L) {
queryWrapper.eq(Role::getParentId, parentId);
}
if (Func.isNotEmpty(tenantId)) {
queryWrapper.eq(Role::getTenantId, tenantId);
}
List<Role> roleList = baseMapper.selectList(queryWrapper);
return RoleWrapper.build().listNodeVO(roleList);
}

Loading…
Cancel
Save