From 9f3563121c398f788c87d0a59d16fda341947175 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Wed, 11 May 2022 15:12:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=81=AB=E7=82=B9=E7=9A=84?= =?UTF-8?q?=E8=A1=97=E9=81=93=E7=BC=96=E5=8F=B7=E6=95=B0=E6=8D=AE=20//?= =?UTF-8?q?=E7=9C=81=E7=9A=84=E8=B4=A6=E5=8F=B7=E8=A6=81=E6=9F=A5=E5=B8=82?= =?UTF-8?q?=E7=9A=84=E7=81=AB=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/xkrs/utils/Query.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) 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));