|
@@ -52,4 +52,73 @@
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
|
+ <select id="getLoopStatusMap" resultType="java.util.Map">
|
|
|
+ select
|
|
|
+ *
|
|
|
+ from user_site as us
|
|
|
+ inner join device as d
|
|
|
+ on us.site_id = d.site_id
|
|
|
+ inner join rt_switch_data as rsd
|
|
|
+ on d.device_code = rsd.deviceName
|
|
|
+ <where>
|
|
|
+ and d.enable = 1
|
|
|
+ <if test="siteId != null and siteId != 0">
|
|
|
+ and us.site_id = #{siteId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ limit 1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getOffCountDMap" resultType="java.lang.Integer">
|
|
|
+ select count(1)
|
|
|
+ from user_site as us
|
|
|
+ inner join device as d
|
|
|
+ on us.site_id = d.site_id
|
|
|
+ inner join alarm_power as ap
|
|
|
+ on d.device_code = ap.device_code
|
|
|
+ <where>
|
|
|
+ and ap.meas_name = 'LoadLive'
|
|
|
+ and ap.digital_value = 1
|
|
|
+ and d.enable = 1
|
|
|
+ and to_days(ap.sending_time) = to_days(now())
|
|
|
+ <if test="siteId != null and siteId != 0">
|
|
|
+ and us.site_id = #{siteId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+ <select id="getOffCountMMap" resultType="java.lang.Integer">
|
|
|
+ select count(1)
|
|
|
+ from user_site as us
|
|
|
+ inner join device as d
|
|
|
+ on us.site_id = d.site_id
|
|
|
+ inner join alarm_power as ap
|
|
|
+ on d.device_code = ap.device_code
|
|
|
+ <where>
|
|
|
+ and ap.meas_name = 'LoadLive'
|
|
|
+ and ap.digital_value = 1
|
|
|
+ and d.enable = 1
|
|
|
+ and DATE_FORMAT( sending_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
|
|
|
+ <if test="siteId != null and siteId != 0">
|
|
|
+ and us.site_id = #{siteId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getLoopStatusListMap" resultType="java.util.Map">
|
|
|
+ select
|
|
|
+ *
|
|
|
+ from user_site as us
|
|
|
+ inner join device as d
|
|
|
+ on us.site_id = d.site_id
|
|
|
+ inner join rt_switch_data as rsd
|
|
|
+ on d.device_code = rsd.deviceName
|
|
|
+ <where>
|
|
|
+ and d.enable = 1
|
|
|
+ <if test="siteId != null and siteId != 0">
|
|
|
+ and us.site_id = #{siteId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ limit 1
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|