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}) + + + + + +