From 2b3a75a842db754d1ca53fe73fa67f1f2d427f79 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Sun, 4 Feb 2024 20:10:04 +0800 Subject: [PATCH] =?UTF-8?q?#=20=E9=A3=8E=E9=99=A9=E7=82=B9=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=AF=BC=E5=87=BA=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzims/common/support/utils/Condition.java | 20 +++++++++++--------- .../hazard/service/IDangerSourceService.java | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/hzims-biz-common/src/main/java/com/hnac/hzims/common/support/utils/Condition.java b/hzims-biz-common/src/main/java/com/hnac/hzims/common/support/utils/Condition.java index c1a2f53..27819a6 100644 --- a/hzims-biz-common/src/main/java/com/hnac/hzims/common/support/utils/Condition.java +++ b/hzims-biz-common/src/main/java/com/hnac/hzims/common/support/utils/Condition.java @@ -32,16 +32,18 @@ public class Condition extends org.springblade.core.mp.support.Condition { QueryWrapper queryWrapper = getQueryWrapper(query,clazz); List fields = getFieldList(query); // 填充排序字段 - orderFields.forEach((fieldName,order) -> { - Optional existField = fields.stream().filter(field -> camel2under(fieldName).equals(camel2under(field.getName()))).findAny(); - if(existField.isPresent()) { - if(Order.ASC.equals(order)) { - queryWrapper.orderByAsc(fieldName); + orderFields.forEach((fieldNames,order) -> { + Func.toStrList(",",fieldNames).stream().forEach(fieldName -> { + Optional existField = fields.stream().filter(field -> camel2under(fieldName).equals(camel2under(field.getName()))).findAny(); + if(existField.isPresent()) { + if(Order.ASC.equals(order)) { + queryWrapper.orderByAsc(fieldName); + } + else if(Order.DESC.equals(order)) { + queryWrapper.orderByDesc(fieldName); + } } - else if(Order.DESC.equals(order)) { - queryWrapper.orderByDesc(fieldName); - } - } + }); }); return queryWrapper.lambda(); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/IDangerSourceService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/IDangerSourceService.java index 53b565a..96480f5 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/IDangerSourceService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/IDangerSourceService.java @@ -60,7 +60,7 @@ public interface IDangerSourceService extends BaseService { default LambdaQueryWrapper getQueryWrapper(Object req) { Map param = new HashMap<>(); - param.put("create_time",Order.DESC); + param.put("create_time,update_time",Order.DESC); return Condition.getQueryWrapper(req,DangerSourceEntity.class,param); } }