| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 | 
							- <?xml version="1.0" encoding="UTF-8"?>
 
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 
- <mapper namespace="com.xunmei.iot.mapper.DiagnoseThresholdChMapper">
 
-     <select id="selectPageData" resultType="com.xunmei.iot.vo.sensor.DiagnoseThresholdPageVo">
 
-         select c.* from
 
-         (
 
-             select s.id,s.org_id, s.org_name,s.org_path, s.device_name, dvs.device_name as host_name,
 
-             (select group_concat(threshold_code) from iot_device_diagnose_threshold_ch ch where ch.iot_token = s.iot_token
 
-             and ch.device_product=s.device_product and ch.dvs = s.host_code and ch.channel = s.device_code) threshold_codes
 
-             from iot_device_info s
 
-             inner join iot_device_info dvs on dvs.iot_token = s.iot_token
 
-             and dvs.device_product = s.device_product and dvs.device_code = s.host_code
 
-             and dvs.deleted = 0 and s.enable = 0 and dvs.device_type = 1
 
-             where s.deleted=0 and s.enable=0 and s.device_type = 2
 
-             <if test="request.orgId!= null">
 
-                 and s.org_id=#{request.orgId}
 
-             </if>
 
-             <if test="request.orgPath!= null">
 
-                 and s.org_path like CONCAT(#{request.orgPath}, '%')
 
-             </if>
 
-             <if test="request.deviceName != null and request.deviceName!= ''">
 
-                 and s.device_name like CONCAT('%',#{request.deviceName},'%')
 
-             </if>
 
-             order by s.host_code ,cast(s.device_code as signed)
 
-         ) c where 1=1
 
-         <choose>
 
-             <when test=" request.state == null">
 
-             </when>
 
-             <when test=" request.state == 0">
 
-                 and c.threshold_codes is null
 
-             </when>
 
-             <otherwise>
 
-                 and c.threshold_codes is not null
 
-             </otherwise>
 
-         </choose>
 
-         <choose>
 
-             <when test=" request.thresholdCode != null and request.thresholdCode != '' ">
 
-                 and c.threshold_codes like CONCAT('%',#{request.thresholdCode}, '%')
 
-             </when>
 
-             <otherwise>
 
-             </otherwise>
 
-         </choose>
 
-     </select>
 
-     <select id="selectCamerasCount" resultType="java.lang.Integer">
 
-         select count(1) from
 
-         (
 
-         select s.iot_token,s.device_product,s.host_code dvs,s.device_code channel,
 
-         (select group_concat(threshold_code) from iot_device_diagnose_threshold_ch ch where ch.iot_token = s.iot_token
 
-         and ch.device_product=s.device_product and ch.dvs = s.host_code and ch.channel = s.device_code) threshold_codes
 
-         from iot_device_info s
 
-         inner join iot_device_info dvs on dvs.iot_token = s.iot_token
 
-         and dvs.device_product = s.device_product and dvs.device_code = s.host_code
 
-         and dvs.deleted = 0 and s.enable = 0 and dvs.device_type = 1
 
-         where s.deleted=0 and s.enable=0 and s.device_type = 2
 
-         <if test="request.orgId!= null">
 
-             and s.org_id=#{request.orgId}
 
-         </if>
 
-         <if test="request.orgPath!= null">
 
-             and s.org_path like CONCAT(#{request.orgPath}, '%')
 
-         </if>
 
-         <if test="request.deviceName != null and request.deviceName!= ''">
 
-             and s.device_name like CONCAT('%',#{request.deviceName},'%')
 
-         </if>
 
-         order by s.host_code ,cast(s.device_code as signed)
 
-         ) c where 1=1
 
-         <choose>
 
-             <when test=" request.state == null">
 
-             </when>
 
-             <when test=" request.state == 0">
 
-                 and c.threshold_codes is null
 
-             </when>
 
-             <otherwise>
 
-                 and c.threshold_codes is not null
 
-             </otherwise>
 
-         </choose>
 
-         <choose>
 
-             <when test=" request.thresholdCode != null and request.thresholdCode != '' ">
 
-                 and c.threshold_codes like CONCAT('%',#{request.thresholdCode}, '%')
 
-             </when>
 
-             <otherwise>
 
-             </otherwise>
 
-         </choose>
 
-     </select>
 
-     <select id="selectCamerasBind" resultType="com.xunmei.iot.vo.sensor.DiagnoseThresholdBindVo">
 
-         select c.* from
 
-         (
 
-         select s.iot_token,s.device_product,s.host_code dvs,s.device_code channel,
 
-         (select group_concat(concat(threshold_code,'#',id)) from iot_device_diagnose_threshold_ch ch where ch.iot_token = s.iot_token
 
-         and ch.device_product=s.device_product and ch.dvs = s.host_code and ch.channel = s.device_code) threshold_codes
 
-         from iot_device_info s
 
-         inner join iot_device_info dvs on dvs.iot_token = s.iot_token
 
-         and dvs.device_product = s.device_product and dvs.device_code = s.host_code
 
-         and dvs.deleted = 0 and s.enable = 0 and dvs.device_type = 1
 
-         where s.deleted=0 and s.enable=0 and s.device_type = 2
 
-         <if test="request.orgId!= null">
 
-             and s.org_id=#{request.orgId}
 
-         </if>
 
-         <if test="request.orgPath!= null">
 
-             and s.org_path like CONCAT(#{request.orgPath}, '%')
 
-         </if>
 
-         <if test="request.deviceName != null and request.deviceName!= ''">
 
-             and s.device_name like CONCAT('%',#{request.deviceName},'%')
 
-         </if>
 
-         order by s.host_code ,cast(s.device_code as signed)
 
-         ) c where 1=1
 
-         <choose>
 
-             <when test=" request.state == null">
 
-             </when>
 
-             <when test=" request.state == 0">
 
-                 and c.threshold_codes is null
 
-             </when>
 
-             <otherwise>
 
-                 and c.threshold_codes is not null
 
-             </otherwise>
 
-         </choose>
 
-         <choose>
 
-             <when test=" request.thresholdCode != null and request.thresholdCode != '' ">
 
-                 and c.threshold_codes like CONCAT('%',#{request.thresholdCode}, '%')
 
-             </when>
 
-             <otherwise>
 
-             </otherwise>
 
-         </choose>
 
-     </select>
 
-     <insert id="batchInsertThresholdCh" parameterType="java.util.List">
 
-         insert into iot_device_diagnose_threshold_ch (id,threshold_code,iot_token,device_product,dvs,channel)
 
-         values
 
-         <foreach collection="list" item="item" index="index" separator=",">
 
-             (#{item.id},#{item.thresholdCode},#{item.iotToken},#{item.deviceProduct},#{item.dvs}, #{item.channel})
 
-         </foreach>
 
-     </insert>
 
-     <delete id="batchDeleteThresholdCh" parameterType="java.lang.Long">
 
-         delete from iot_device_diagnose_threshold_ch where id in
 
-         <foreach collection="ids" item="item" index="index"
 
-                  open="(" separator="," close=")">#{item}
 
-         </foreach>
 
-     </delete>
 
-     <select id="updateDiagnoseNumber" resultType="java.lang.Integer">
 
-         update iot_device_diagnose_threshold set diagnose_number =
 
-         (
 
-            select count(1) from iot_device_diagnose_threshold_ch where threshold_code = #{thresholdCode}
 
-         )
 
-         where threshold_code =  #{thresholdCode}
 
-     </select>
 
-     <delete id="deleteCamerasByThresholdCode">
 
-         delete from iot_device_diagnose_threshold_ch where threshold_code = #{thresholdCode}
 
-     </delete>
 
-     <select id="selectExcelData" resultType="com.xunmei.iot.vo.sensor.DiagnoseThresholdPageVo">
 
-         select c.* from
 
-         (
 
-         select s.id,s.org_id, s.org_name,s.org_path, s.device_name, dvs.device_name as host_name,
 
-         (select group_concat(threshold_code) from iot_device_diagnose_threshold_ch ch where ch.iot_token = s.iot_token
 
-         and ch.device_product=s.device_product and ch.dvs = s.host_code and ch.channel = s.device_code) threshold_codes
 
-         from iot_device_info s
 
-         inner join iot_device_info dvs on dvs.iot_token = s.iot_token
 
-         and dvs.device_product = s.device_product and dvs.device_code = s.host_code
 
-         and dvs.deleted = 0 and s.enable = 0 and dvs.device_type = 1
 
-         where s.deleted=0 and s.enable=0 and s.device_type = 2
 
-         <if test="request.orgId!= null">
 
-             and s.org_id=#{request.orgId}
 
-         </if>
 
-         <if test="request.orgPath!= null">
 
-             and s.org_path like CONCAT(#{request.orgPath}, '%')
 
-         </if>
 
-         <if test="request.deviceName != null and request.deviceName!= ''">
 
-             and s.device_name like CONCAT('%',#{request.deviceName},'%')
 
-         </if>
 
-         order by s.host_code ,cast(s.device_code as signed)
 
-         ) c where 1=1
 
-         <choose>
 
-             <when test=" request.state == null">
 
-             </when>
 
-             <when test=" request.state == 0">
 
-                 and c.threshold_codes is null
 
-             </when>
 
-             <otherwise>
 
-                 and c.threshold_codes is not null
 
-             </otherwise>
 
-         </choose>
 
-         <choose>
 
-             <when test=" request.thresholdCode != null and request.thresholdCode != '' ">
 
-                 and c.threshold_codes like CONCAT('%',#{request.thresholdCode}, '%')
 
-             </when>
 
-             <otherwise>
 
-             </otherwise>
 
-         </choose>
 
-     </select>
 
-     <select id="selectAllDiagnoseThreshold" resultType="com.xunmei.common.core.domain.iot.domain.IotDeviceDiagnoseThreshold">
 
-         select * from iot_device_diagnose_threshold
 
-     </select>
 
- </mapper>
 
 
  |