优化火点查询

This commit is contained in:
liuchengqian 2023-03-16 21:28:29 +08:00
parent 4834696a6c
commit 8fac34f648

View File

@ -134,6 +134,13 @@ public class FirePointQueryManager {
//查询未审核的普通火点
Specification<FirePointOrdinaryEntity> specificationOrdinary = (root, criteriaQuery, criteriaBuilder) -> {
List<Predicate> predicateList = new ArrayList<>();
//非空判断
predicateList.add(criteriaBuilder.isNotNull(root.get("proCode").as(String.class)));
predicateList.add(criteriaBuilder.isNotNull(root.get("proName").as(String.class)));
predicateList.add(criteriaBuilder.isNotNull(root.get("cityCode").as(String.class)));
predicateList.add(criteriaBuilder.isNotNull(root.get("cityName").as(String.class)));
predicateList.add(criteriaBuilder.isNotNull(root.get("countyCode").as(String.class)));
predicateList.add(criteriaBuilder.isNotNull(root.get("countyName").as(String.class)));
//添加区划编码的过滤
if (!TextUtils.isEmpty(noRedundantUserCode)) {
predicateList.add(criteriaBuilder.like(root.get("townCode").as(String.class), noRedundantUserCode + "%"));
@ -182,6 +189,13 @@ public class FirePointQueryManager {
//查询审核通过的精准火点
Specification<FirePointPreciseEntity> specificationPrecise = (root, criteriaQuery, criteriaBuilder) -> {
List<Predicate> predicateList = new ArrayList<>();
//非空判断
predicateList.add(criteriaBuilder.isNotNull(root.get("proCode").as(String.class)));
predicateList.add(criteriaBuilder.isNotNull(root.get("proName").as(String.class)));
predicateList.add(criteriaBuilder.isNotNull(root.get("cityCode").as(String.class)));
predicateList.add(criteriaBuilder.isNotNull(root.get("cityName").as(String.class)));
predicateList.add(criteriaBuilder.isNotNull(root.get("countyCode").as(String.class)));
predicateList.add(criteriaBuilder.isNotNull(root.get("countyName").as(String.class)));
//添加区划编码的过滤
if (!TextUtils.isEmpty(noRedundantUserCode)) {
predicateList.add(criteriaBuilder.like(root.get("townCode").as(String.class), noRedundantUserCode + "%"));