diff --git a/src/main/java/com/xkrs/utils/Query.java b/src/main/java/com/xkrs/utils/Query.java index 1eba0e4..a80fb90 100644 --- a/src/main/java/com/xkrs/utils/Query.java +++ b/src/main/java/com/xkrs/utils/Query.java @@ -25,13 +25,24 @@ public class Query { * 动态多条件查询项目信息(省) */ public List selectFirePointByPro(String proName, String cityCode, String satelliteType, String landType, String startTime, String endTime) { + try { + if (cityCode.substring(4).equals("00") && !cityCode.substring(2).equals("0000")) {//省的账号要查市的火点 + if (cityCode.length() > 4) { + cityCode = cityCode.substring(0, 4); + } + } + }catch (Exception e) { + e.printStackTrace(); + cityCode = null; + } + String finalCityCode = cityCode; Specification specification = (root, criteriaQuery, criteriaBuilder) -> { List list = new ArrayList<>(); if (proName != null && !"".equals(proName)) { list.add(criteriaBuilder.like(root.get("firePointAddress").as(String.class), "%" + proName + "%")); } - if (cityCode != null && !"".equals(cityCode)) { - list.add(criteriaBuilder.like(root.get("countyCode").as(String.class), "%" + cityCode + "%")); + if (finalCityCode != null && !"".equals(finalCityCode)) { + list.add(criteriaBuilder.like(root.get("countyCode").as(String.class), "%" + finalCityCode + "%")); } if (satelliteType != null && !"".equals(satelliteType)) { list.add(criteriaBuilder.equal(root.get("satelliteType").as(String.class), satelliteType));