diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java index f47ac58ef4..25afa314fa 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java +++ b/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 (CollectionUtils.isEmpty(gridIds)) { + if (gridIds == null) { String error = String.format("DataFilter:拼接SQL语句出错:需要in grid权限,但是代码中没有获取到gridIds"); logger.error(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 (CollectionUtils.isEmpty(departmentIds)) { + if (departmentIds == null) { String error = String.format("DataFilter:拼接SQL语句出错:需要in department权限,但是代码中没有获取到, departmentIds"); logger.error(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); } + /** + * sql语句拼接FALSE + * @param sb + */ + private void genFalseCondition(StringBuilder sb) { + if (hasConditions.get()) { + // 之前没有条件 + sb.append(" OR "); + } + + sb.append(" FALSE "); + + hasConditions.set(true); + } + /** * 生成部门过滤sql *