|
|
|
@ -261,40 +261,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 统计多表查询的总记录数 -->
|
|
|
|
|
<select id="countFromTables" resultType="java.lang.Integer">
|
|
|
|
|
SELECT COUNT(*) FROM (
|
|
|
|
|
<foreach collection="tableNames" item="tableName" separator=" UNION ALL ">
|
|
|
|
|
SELECT objid
|
|
|
|
|
FROM ${tableName}
|
|
|
|
|
<where>
|
|
|
|
|
<if test="recordIotenvInstant.monitorId != null and recordIotenvInstant.monitorId != ''"> and monitorId = #{recordIotenvInstant.monitorId}</if>
|
|
|
|
|
<if test="recordIotenvInstant.temperature != null "> and temperature = #{recordIotenvInstant.temperature}</if>
|
|
|
|
|
<if test="recordIotenvInstant.humidity != null "> and humidity = #{recordIotenvInstant.humidity}</if>
|
|
|
|
|
<if test="recordIotenvInstant.illuminance != null "> and illuminance = #{recordIotenvInstant.illuminance}</if>
|
|
|
|
|
<if test="recordIotenvInstant.noise != null "> and noise = #{recordIotenvInstant.noise}</if>
|
|
|
|
|
<if test="recordIotenvInstant.concentration != null "> and concentration = #{recordIotenvInstant.concentration}</if>
|
|
|
|
|
<if test="recordIotenvInstant.vibrationSpeed != null "> and vibration_speed = #{recordIotenvInstant.vibrationSpeed}</if>
|
|
|
|
|
<if test="recordIotenvInstant.vibrationDisplacement != null "> and vibration_displacement = #{recordIotenvInstant.vibrationDisplacement}</if>
|
|
|
|
|
<if test="recordIotenvInstant.vibrationAcceleration != null "> and vibration_acceleration = #{recordIotenvInstant.vibrationAcceleration}</if>
|
|
|
|
|
<if test="recordIotenvInstant.vibrationTemp != null "> and vibration_temp = #{recordIotenvInstant.vibrationTemp}</if>
|
|
|
|
|
<if test="recordIotenvInstant.collectTime != null "> and collectTime = #{recordIotenvInstant.collectTime}</if>
|
|
|
|
|
<if test="recordIotenvInstant.recodeTime != null "> and recodeTime = #{recordIotenvInstant.recodeTime}</if>
|
|
|
|
|
<select id="countFromTables" resultType="java.lang.Integer">
|
|
|
|
|
SELECT COUNT(*) FROM (
|
|
|
|
|
<foreach collection="tableNames" item="tableName" separator=" UNION ALL ">
|
|
|
|
|
SELECT objid
|
|
|
|
|
FROM ${tableName}
|
|
|
|
|
<where>
|
|
|
|
|
<if test="recordIotenvInstant.monitorId != null and recordIotenvInstant.monitorId != ''"> and monitorId = #{recordIotenvInstant.monitorId}</if>
|
|
|
|
|
<if test="recordIotenvInstant.temperature != null "> and temperature = #{recordIotenvInstant.temperature}</if>
|
|
|
|
|
<if test="recordIotenvInstant.humidity != null "> and humidity = #{recordIotenvInstant.humidity}</if>
|
|
|
|
|
<if test="recordIotenvInstant.illuminance != null "> and illuminance = #{recordIotenvInstant.illuminance}</if>
|
|
|
|
|
<if test="recordIotenvInstant.noise != null "> and noise = #{recordIotenvInstant.noise}</if>
|
|
|
|
|
<if test="recordIotenvInstant.concentration != null "> and concentration = #{recordIotenvInstant.concentration}</if>
|
|
|
|
|
<if test="recordIotenvInstant.vibrationSpeed != null "> and vibration_speed = #{recordIotenvInstant.vibrationSpeed}</if>
|
|
|
|
|
<if test="recordIotenvInstant.vibrationDisplacement != null "> and vibration_displacement = #{recordIotenvInstant.vibrationDisplacement}</if>
|
|
|
|
|
<if test="recordIotenvInstant.vibrationAcceleration != null "> and vibration_acceleration = #{recordIotenvInstant.vibrationAcceleration}</if>
|
|
|
|
|
<if test="recordIotenvInstant.vibrationTemp != null "> and vibration_temp = #{recordIotenvInstant.vibrationTemp}</if>
|
|
|
|
|
<if test="recordIotenvInstant.collectTime != null "> and collectTime = #{recordIotenvInstant.collectTime}</if>
|
|
|
|
|
<if test="recordIotenvInstant.recodeTime != null "> and recodeTime = #{recordIotenvInstant.recodeTime}</if>
|
|
|
|
|
|
|
|
|
|
<if test="recordIotenvInstant.params.beginRecordTime!= null and recordIotenvInstant.params.endRecordTime != null">
|
|
|
|
|
AND recodeTime BETWEEN #{recordIotenvInstant.params.beginRecordTime} AND #{recordIotenvInstant.params.endRecordTime}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="recordIotenvInstant.params.beginRecordTime!= null and recordIotenvInstant.params.endRecordTime != null">
|
|
|
|
|
AND recodeTime BETWEEN #{recordIotenvInstant.params.beginRecordTime} AND #{recordIotenvInstant.params.endRecordTime}
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
<if test="recordIotenvInstant.monitorIds != null and recordIotenvInstant.monitorIds.length > 0">
|
|
|
|
|
AND monitorId IN
|
|
|
|
|
<foreach collection="recordIotenvInstant.monitorIds" item="monitorId" open="(" separator="," close=")">
|
|
|
|
|
#{monitorId}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="recordIotenvInstant.monitorIds != null and recordIotenvInstant.monitorIds.length > 0">
|
|
|
|
|
AND monitorId IN
|
|
|
|
|
<foreach collection="recordIotenvInstant.monitorIds" item="monitorId" open="(" separator="," close=")">
|
|
|
|
|
#{monitorId}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
</where>
|
|
|
|
|
</foreach>
|
|
|
|
|
) AS total_count
|
|
|
|
|
</select>
|
|
|
|
|
</where>
|
|
|
|
|
</foreach>
|
|
|
|
|
) AS total_count
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 从指定表查询最新的N条记录 -->
|
|
|
|
|
<select id="selectLatestRecordsFromTable" resultMap="RecordIotenvInstantResult">
|
|
|
|
|