Browse Source

优化设备状态统计SQL语句

develop
zhaoxianglong 5 months ago
parent
commit
3d4db19b26
  1. 24
      zc-business/src/main/resources/mapper/business/StatusMapper.xml

24
zc-business/src/main/resources/mapper/business/StatusMapper.xml

@ -120,6 +120,12 @@
<if test="status.useState != null and status.useState != 0">
AND d.use_state = #{status.useState}
</if>
<if test="status.deviceName != null and status.deviceName != ''">
AND s.device_name like concat('%', #{status.deviceName}, '%')
</if>
<if test="status.direction != null">
AND d.direction = #{status.direction}
</if>
</where>
<if test="status.orderByField != null and status.orderDirection != null">
ORDER BY ${status.orderByField} ${status.orderDirection}
@ -148,6 +154,12 @@
<if test="status.useState != null and status.useState != 0">
AND d.use_state = #{status.useState}
</if>
<if test="status.deviceName != null and status.deviceName != ''">
AND s.device_name like concat('%', #{status.deviceName}, '%')
</if>
<if test="status.direction != null">
AND d.direction = #{status.direction}
</if>
</where>
<if test="status.orderByField != null and status.orderDirection != null">
@ -274,6 +286,12 @@
<if test="status.useState != null and status.useState != 0">
AND d.use_state = #{status.useState}
</if>
<if test="status.deviceName != null and status.deviceName != ''">
AND s.device_name like concat('%', #{status.deviceName}, '%')
</if>
<if test="status.direction != null">
AND d.direction = #{status.direction}
</if>
</where>
<if test="status.orderByField != null and status.orderDirection != null">
ORDER BY ${status.orderByField} ${status.orderDirection}
@ -290,6 +308,12 @@
<if test="status.deviceId != null">
AND s.device_id = #{status.deviceId}
</if>
<if test="status.deviceName != null and status.deviceName != ''">
AND s.device_name like concat('%', #{status.deviceName}, '%')
</if>
<if test="status.direction != null">
AND d.direction = #{status.direction}
</if>
</where>
<if test="status.orderByField != null and status.orderDirection != null">
ORDER BY ${status.orderByField} ${status.orderDirection}

Loading…
Cancel
Save