diff --git a/src/main/java/com/xkrs/straw/utils/FirePointQueryManager.java b/src/main/java/com/xkrs/straw/utils/FirePointQueryManager.java index f2ba742..f146c7a 100644 --- a/src/main/java/com/xkrs/straw/utils/FirePointQueryManager.java +++ b/src/main/java/com/xkrs/straw/utils/FirePointQueryManager.java @@ -141,7 +141,10 @@ public class FirePointQueryManager { Specification specificationOrdinary = (root, criteriaQuery, criteriaBuilder) -> { List predicateList = new ArrayList<>(); //添加区划编码的过滤 - predicateList.add(criteriaBuilder.like(root.get("townCode").as(String.class), noRedundantUserCode + "%")); + if (!TextUtils.isEmpty(noRedundantUserCode)) { + predicateList.add(criteriaBuilder.like(root.get("townCode").as(String.class), noRedundantUserCode + "%")); + } + //添加子区域区划编码的过滤(比如查询火点的系统用户所属的区划是山东省,但是该用户目前只想查询青岛市的火点,那么noRedundantUserCode=山东省区划,userSubAreaCutCountyCode=青岛市区划) if (!TextUtils.isEmpty(userSubAreaCutCountyCode)) { predicateList.add(criteriaBuilder.like(root.get("townCode").as(String.class), userSubAreaCutCountyCode + "%")); } @@ -186,7 +189,13 @@ public class FirePointQueryManager { Specification specificationPrecise = (root, criteriaQuery, criteriaBuilder) -> { List predicateList = new ArrayList<>(); //添加区划编码的过滤 - predicateList.add(criteriaBuilder.like(root.get("townCode").as(String.class), noRedundantUserCode + "%")); + if (!TextUtils.isEmpty(noRedundantUserCode)) { + predicateList.add(criteriaBuilder.like(root.get("townCode").as(String.class), noRedundantUserCode + "%")); + } + //添加子区域区划编码的过滤(比如查询火点的系统用户所属的区划是山东省,但是该用户目前只想查询青岛市的火点,那么noRedundantUserCode=山东省区划,userSubAreaCutCountyCode=青岛市区划) + if (!TextUtils.isEmpty(userSubAreaCutCountyCode)) { + predicateList.add(criteriaBuilder.like(root.get("townCode").as(String.class), userSubAreaCutCountyCode + "%")); + } //开始时间查询条件 if (!TextUtils.isEmpty(startTime)) { LocalDateTime startTime1 = DateTimeUtils.stringToLocalDateTime(startTime);