Browse Source

权限sql生成,如果网格列表为空列表,那么不报错,不执行sql拼接

dev_shibei_match
wxz 5 years ago
parent
commit
4f9ddf5521
  1. 27
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java

27
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java

@ -161,21 +161,25 @@ public class AccessServiceImpl implements AccessService {
} }
if (switchScopes.contains(OperationScopeConstant.SCOPE_IN_GRID)) { if (switchScopes.contains(OperationScopeConstant.SCOPE_IN_GRID)) {
if (CollectionUtils.isEmpty(gridIds)) { if (gridIds == null) {
String error = String.format("DataFilter:拼接SQL语句出错:需要in grid权限,但是代码中没有获取到gridIds"); String error = String.format("DataFilter:拼接SQL语句出错:需要in grid权限,但是代码中没有获取到gridIds");
logger.error(error); logger.error(error);
throw new RenException(error); throw new RenException(error);
} }
genInGrid(sb, gridIds, tableAlias); if (gridIds.size() != 0) {
genInGrid(sb, gridIds, tableAlias);
}
} }
if (switchScopes.contains(OperationScopeConstant.SCOPE_IN_DEPARTMENT)) { if (switchScopes.contains(OperationScopeConstant.SCOPE_IN_DEPARTMENT)) {
if (CollectionUtils.isEmpty(departmentIds)) { if (departmentIds == null) {
String error = String.format("DataFilter:拼接SQL语句出错:需要in department权限,但是代码中没有获取到, departmentIds"); String error = String.format("DataFilter:拼接SQL语句出错:需要in department权限,但是代码中没有获取到, departmentIds");
logger.error(error); logger.error(error);
throw new RenException(error); throw new RenException(error);
} }
genDepartmentFilterSql(sb, departmentIds, tableAlias); if (departmentIds.size() != 0) {
genDepartmentFilterSql(sb, departmentIds, tableAlias);
}
} }
} }
@ -221,6 +225,21 @@ public class AccessServiceImpl implements AccessService {
hasConditions.set(true); hasConditions.set(true);
} }
/**
* sql语句拼接FALSE
* @param sb
*/
private void genFalseCondition(StringBuilder sb) {
if (hasConditions.get()) {
// 之前没有条件
sb.append(" OR ");
}
sb.append(" FALSE ");
hasConditions.set(true);
}
/** /**
* 生成部门过滤sql * 生成部门过滤sql
* *

Loading…
Cancel
Save