|  | @@ -1,16 +1,14 @@
 | 
	
		
			
				|  |  |  <?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.IotAlarmDataMapper">
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |      <select id="selectPageList" resultType="com.xunmei.iot.vo.alarm.IotAlarmDataVo">
 | 
	
		
			
				|  |  |          SELECT
 | 
	
		
			
				|  |  | -            a.*,
 | 
	
		
			
				|  |  | -            b.affiliated_area AS city,
 | 
	
		
			
				|  |  | -            b.affiliated_bank AS bank,
 | 
	
		
			
				|  |  | -            b.short_name AS org_name
 | 
	
		
			
				|  |  | +        a.*,
 | 
	
		
			
				|  |  | +        b.affiliated_area AS city,
 | 
	
		
			
				|  |  | +        b.affiliated_bank AS bank,
 | 
	
		
			
				|  |  | +        b.short_name AS org_name
 | 
	
		
			
				|  |  |          FROM
 | 
	
		
			
				|  |  | -            iot_alarm_data a
 | 
	
		
			
				|  |  | +        iot_alarm_data a
 | 
	
		
			
				|  |  |          LEFT JOIN sys_org b ON a.org_id = b.id
 | 
	
		
			
				|  |  |          where 1=1
 | 
	
		
			
				|  |  |          <if test="param.deviceName != null and param.deviceName != ''">
 | 
	
	
		
			
				|  | @@ -41,4 +39,50 @@
 | 
	
		
			
				|  |  |              and a.end_time <= #{param.params.endAlarmEndTime}
 | 
	
		
			
				|  |  |          </if>
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  | +    <select id="selectAppPageList" resultType="com.xunmei.iot.vo.alarmData.AppAlarmDataPageVo">
 | 
	
		
			
				|  |  | +        SELECT
 | 
	
		
			
				|  |  | +        a.id,
 | 
	
		
			
				|  |  | +        a.device_name,
 | 
	
		
			
				|  |  | +        a.source_type_des,
 | 
	
		
			
				|  |  | +        a.time as start_time,
 | 
	
		
			
				|  |  | +        a.end_time,
 | 
	
		
			
				|  |  | +        b.short_name AS org_name
 | 
	
		
			
				|  |  | +        FROM
 | 
	
		
			
				|  |  | +        iot_alarm_data a
 | 
	
		
			
				|  |  | +        LEFT JOIN sys_org b ON a.org_id = b.id
 | 
	
		
			
				|  |  | +        where 1=1
 | 
	
		
			
				|  |  | +        <if test="param.deviceName != null and param.deviceName != ''">
 | 
	
		
			
				|  |  | +            and a.device_name like concat('%',#{param.deviceName},'%')
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        <if test="param.orgId != null and param.orgId != ''">
 | 
	
		
			
				|  |  | +            and a.org_id = #{param.orgId}
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        <if test="param.orgPath != null and param.orgPath != ''">
 | 
	
		
			
				|  |  | +            and b.path like concat(#{param.orgPath},'%')
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        <if test="param.alarmType != null and param.alarmType != ''">
 | 
	
		
			
				|  |  | +            and a.source_type = #{param.alarmType}
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        <if test="param.state==0">
 | 
	
		
			
				|  |  | +            and a.end_time is not null
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        <if test="param.state==1">
 | 
	
		
			
				|  |  | +            and a.end_time is null
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        order by a.end_time ,a.time desc
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +    <select id="detail" resultType="com.xunmei.iot.vo.alarm.IotAlarmDataVo">
 | 
	
		
			
				|  |  | +        SELECT a.*,
 | 
	
		
			
				|  |  | +               b.affiliated_area AS city,
 | 
	
		
			
				|  |  | +               b.affiliated_bank AS bank,
 | 
	
		
			
				|  |  | +               b.short_name      AS org_name
 | 
	
		
			
				|  |  | +        FROM iot_alarm_data a
 | 
	
		
			
				|  |  | +                 LEFT JOIN sys_org b ON a.org_id = b.id
 | 
	
		
			
				|  |  | +        where a.id = #{id}
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +    <select id="appBadge" resultType="java.lang.Integer">
 | 
	
		
			
				|  |  | +        SELECT count(0)
 | 
	
		
			
				|  |  | +        FROM iot_alarm_data a
 | 
	
		
			
				|  |  | +        where a.org_id = #{orgId} and a.end_time is null
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  |  </mapper>
 |