| | |
| | | 1=1 |
| | | </sql> |
| | | |
| | | <sql id="getPatrolListSqlParam"> |
| | | select a.id,a.alarmType,a.alarmPeople,a.alarmTime,a.galarmPeople,a.sex,a.phoneNumber,a.content,a.waringType,a.bz, |
| | | a.deviceNumber,a.region,e.district,a.vaddress,a.aaddress, |
| | | a.alarmId,a.LEVEL,a.jd,a.wd,a.jtype,a.rname,a.jjTime,e.province,e.city,a.cid, |
| | | a.securityArr,a.securityId, |
| | | e.serialNumber,e.oneContacts,e.ThreeContacts,e.twoContacts,e.onePhone,e.twoPhone,e.ThreePhone, |
| | | e.stype, |
| | | e.oneId, |
| | | e.twoId, |
| | | e.threeId, |
| | | e.deptId, |
| | | e.deviceName, |
| | | a.place as place, |
| | | e.channelNumber |
| | | FROM |
| | | sys_alarm a |
| | | LEFT JOIN sys_equipment e ON e.deviceNumber = a.deviceNumber |
| | | WHERE |
| | | 1=1 AND a.alarmType = "巡逻任务" |
| | | </sql> |
| | | |
| | | <!--查询当前保安所有警情信息--> |
| | | <!-- <select id="getAllAlarmList" resultMap="alarmResultMap">--> |
| | | <!-- (select * from (--> |
| | |
| | | where securityId =#{alarm.securityId} and jtype = 1) |
| | | </select> |
| | | |
| | | |
| | | <!--查询当前保安所有巡逻信息--> |
| | | <select id="getAllPatrolList" resultMap="alarmResultMap"> |
| | | (select * from ( |
| | | <include refid="getPatrolListSqlParam"/> |
| | | and (securityId = "" or securityId IS NULL |
| | | AND securityArr LIKE concat('%',#{alarm.securityId},'%')) |
| | | order by alarmTime desc limit 9999 |
| | | )a) |
| | | union |
| | | (select * from ( |
| | | <include refid="getPatrolListSqlParam"/> |
| | | and securityId =#{alarm.securityId} and jtype = 1 order by alarmTime limit 9999 |
| | | )a) |
| | | union |
| | | (select * from ( |
| | | <include refid="getPatrolListSqlParam"/> |
| | | and securityId =#{alarm.securityId} and jtype = 2 order by alarmTime desc limit 9999 |
| | | )a) |
| | | </select> |
| | | |
| | | <!--查询当前保安需要处理和未处理的巡逻信息--> |
| | | <select id="getPatrolList" resultMap="alarmResultMap"> |
| | | <include refid="getPatrolListSqlParam"/> |
| | | <if test="alarm.status==2"> |
| | | and (securityId = "" or securityId IS NULL |
| | | AND securityArr LIKE concat('%',#{alarm.securityId},'%')) |
| | | order by alarmTime desc |
| | | </if> |
| | | <if test="alarm.status==3"> |
| | | and securityId =#{alarm.securityId} and jtype = 2 |
| | | order by alarmTime desc |
| | | </if> |
| | | <if test="alarm.status==4"> |
| | | and securityId =#{alarm.securityId} and jtype = 1 |
| | | order by alarmTime desc |
| | | </if> |
| | | </select> |
| | | |
| | | <!--获取巡逻数量的集合,全部,未处理,已处理的数量--> |
| | | <select id="getPatrolNumber" resultType="java.lang.Integer"> |
| | | (select ifnull(count(*),0) number from sys_alarm |
| | | where |
| | | alarmType = "巡逻任务" AND |
| | | (securityId =#{alarm.securityId} |
| | | or securityId = "" or securityId IS NULL |
| | | and securityArr LIKE concat('%',#{alarm.securityId},'%')) |
| | | ) |
| | | |
| | | UNION ALL |
| | | (select ifnull(count(*),0) number from sys_alarm |
| | | where |
| | | alarmType = "巡逻任务" AND |
| | | (securityId = "" or securityId IS NULL |
| | | and securityArr LIKE concat('%',#{alarm.securityId},'%')) |
| | | ) |
| | | |
| | | UNION ALL |
| | | (select ifnull(count(*),0) number from sys_alarm |
| | | where |
| | | alarmType = "巡逻任务" AND |
| | | securityId =#{alarm.securityId} and jtype = 2) |
| | | |
| | | UNION ALL |
| | | (select ifnull(count(*),0) number from sys_alarm |
| | | where |
| | | alarmType = "巡逻任务" AND |
| | | securityId =#{alarm.securityId} and jtype = 1) |
| | | </select> |
| | | |
| | | <update id="setAlarm"> |
| | | update sys_alarm SET securityId=#{alarm.securityId} where id=#{alarm.id} |
| | | </update> |