From 5e3dfbdee15b39e006b8ca6b5f5050ed89075d03 Mon Sep 17 00:00:00 2001 From: zch Date: Wed, 30 Apr 2025 16:19:59 +0800 Subject: [PATCH] =?UTF-8?q?feat(ems):=20=EF=BC=88=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E7=89=88=EF=BC=89=E4=BC=98=E5=8C=96=E7=89=A9=E8=81=94=E7=BD=91?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9F=A5=E8=AF=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加新的分页查询方法,提高查询效率 - 增加 monitorIds 参数的处理,支持多设备查询 - 优化查询条件,提高查询灵活性 - 调整排序方式,按 recodeTime 降序排列 --- .../ems/record/RecordIotenvInstantMapper.xml | 79 ++++++++++++++++--- 1 file changed, 67 insertions(+), 12 deletions(-) diff --git a/os-ems/src/main/resources/mapper/ems/record/RecordIotenvInstantMapper.xml b/os-ems/src/main/resources/mapper/ems/record/RecordIotenvInstantMapper.xml index 9ccbf48..bba9923 100644 --- a/os-ems/src/main/resources/mapper/ems/record/RecordIotenvInstantMapper.xml +++ b/os-ems/src/main/resources/mapper/ems/record/RecordIotenvInstantMapper.xml @@ -151,26 +151,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND recodeTime BETWEEN #{recordIotenvInstant.params.beginRecordTime} AND #{recordIotenvInstant.params.endRecordTime} - + - ORDER BY recodeTime ASC + ORDER BY recodeTime desc - - - - + SELECT * FROM ( + SELECT *, ROW_NUMBER() OVER (ORDER BY recodeTime DESC) as row_num + FROM ( + + (SELECT objid, monitorId, temperature, humidity, illuminance, noise, concentration, + vibration_speed, vibration_displacement, vibration_acceleration, vibration_temp, + collectTime, recodeTime + FROM ${tableName} + + and monitorId = #{recordIotenvInstant.monitorId} + and temperature = #{recordIotenvInstant.temperature} + and humidity = #{recordIotenvInstant.humidity} + and illuminance = #{recordIotenvInstant.illuminance} + and noise = #{recordIotenvInstant.noise} + and concentration = #{recordIotenvInstant.concentration} + and vibration_speed = #{recordIotenvInstant.vibrationSpeed} + and vibration_displacement = #{recordIotenvInstant.vibrationDisplacement} + and vibration_acceleration = #{recordIotenvInstant.vibrationAcceleration} + and vibration_temp = #{recordIotenvInstant.vibrationTemp} + and collectTime = #{recordIotenvInstant.collectTime} + and recodeTime = #{recordIotenvInstant.recodeTime} + + + AND recodeTime BETWEEN #{recordIotenvInstant.params.beginRecordTime} AND #{recordIotenvInstant.params.endRecordTime} + + + + AND monitorId IN + + #{monitorId} + + + + + ORDER BY objid DESC) + + ) AS all_data + ) AS paged_data + WHERE row_num > #{offset} AND row_num <= (#{offset} + #{pageSize}) + + + + + +