| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460 |
- <?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.welampiot.dao.AllAlarmInfoLogDao">
- <select id="getListByVO" resultType="com.welampiot.dto.AllAlarmInfoLogDTO" parameterType="com.welampiot.vo.LampCountVO">
- select L.number,
- <choose>
- <when test="version == 1">
- G.english_name as area,
- </when>
- <when test="version == 2">
- G.ru_name as area,
- </when>
- <otherwise>
- G.chinese_name as area,
- </otherwise>
- </choose>
- S.name as section,AI.stralarmtype as strAlarmType,AI.updatetime from all_alarm_info_log AI inner join lampinfo L on L.id = AI.lampid left join section S on L.sectionid = S.id left join global_location G on S.pid = G.id
- where L.faultstatus != 0
- <if test="sectionList != null and !sectionList.isEmpty()">
- and L.sectionid in
- <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
- #{vo}
- </foreach>
- </if>
- order by AI.updatetime desc
- <if test="offset != null and limit != null">
- limit #{offset},#{limit}
- </if>
- </select>
-
- <select id="getListByAllAlarmInfoLogVO" resultType="com.welampiot.dto.AllAlarmInfoLogDTO" parameterType="com.welampiot.vo.AllAlarmInfoLogVO">
- select
- <choose>
- <when test="version == 0">
- gl.chinese_name as area,
- </when>
- <when test="version == 1">
- gl.english_name as area,
- </when>
- <otherwise>
- gl.ru_name as area,
- </otherwise>
- </choose>
- a.id,s.name as secton,l.number,l.name,a.devType,a.dType,a.stralarmtype as strAlarmType,
- a.updatetime as updateTime,a.status,a.alarmtype as alarmType,s.timezone
- from all_alarm_info_log a
- left join lampinfo l on a.lampid = l.id
- left join section s on l.section_id = s.id
- left join global_location gl on s.pid = gl.id
- where 1=1
- <if test="keyword != null and keyword != ''">
- and (l.number like '%${keyword}%' or a.stralarmtype like '%${keyword}%')
- </if>
- <if test="sectionList != null and !sectionList.isEmpty()">
- and l.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- <choose>
- <when test="status == 0">
- and a.status = 0
- </when>
- <when test="status == 1">
- and a.status = 1
- </when>
- <when test="status == 2">
- and a.status = 2
- </when>
- </choose>
- <choose>
- <when test="devType == 0">
- and a.devType = 0
- </when>
- <when test="devType == 1">
- and a.devType = 1
- </when>
- <when test="devType == 2">
- and a.devType = 2
- </when>
- <when test="devType == 3">
- and a.devType = 3
- </when>
- <when test="devType == 4">
- and a.devType = 4
- </when>
- <when test="devType == 5">
- and a.devType = 5
- </when>
- </choose>
- order by a.updatetime desc
- <if test="offset >= 0 and limit > 0">
- limit #{offset},#{limit}
- </if>
- </select>
- <select id="getUnTreatedCountByStatus" resultType="Integer">
- select count(a.id) as total
- from all_alarm_info_log a
- left join lampinfo l on a.lampid = l.id
- where a.status = 0
- <if test="sectionList != null and !sectionList.isEmpty()">
- and l.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- </select>
- <select id="getProcessingCountByStatus" resultType="Integer">
- select count(a.id) as total
- from all_alarm_info_log a
- left join lampinfo l on a.lampid = l.id
- where a.status = 1
- <if test="sectionList != null and !sectionList.isEmpty()">
- and l.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- </select>
- <select id="getHandleCountByStatus" resultType="Integer">
- select count(a.id) as total
- from all_alarm_info_log a
- left join lampinfo l on a.lampid = l.id
- where a.status = 2
- <if test="sectionList != null and !sectionList.isEmpty()">
- and l.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- </select>
- <select id="getAlarmTotalByStatus" resultType="Integer">
- select count(a.id) as total
- from all_alarm_info_log a
- left join lampinfo l on a.lampid = l.id
- <if test="sectionList != null and !sectionList.isEmpty()">
- where l.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- </select>
- <update id="updateAlarmStatusByAlarmId" parameterType="com.welampiot.dto.AllAlarmInfoLogDTO">
- update
- all_alarm_info_log a
- set
- a.status = #{status}
- where a.id = #{id}
- </update>
- <select id="getAlarmListBySectionList" resultType="com.welampiot.dto.AllAlarmInfoLogDTO">
- select a.id,l.number,a.stralarmtype as strAlarmType,a.status,a.updatetime as updateTime,
- r.repair_userid as repairUserid,r.repair_time as repairTime
- from all_alarm_info_log a
- left join lampinfo l on a.lampid = l.id
- left join repair_info r on r.lampid = l.id
- where 1=1
- <if test="sectionList != null and !sectionList.isEmpty()">
- and l.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- </select>
-
- <select id="getLampAlarmListByVO" resultType="AllAlarmInfoLogDTO" parameterType="AllAlarmInfoLogVO">
- select
- a.id,a.updatetime as updateTime,a.stralarmtype as strAlarmType,
- s.name as section,a.devType,l.number,l.longitude,l.latitude,l.name
- <choose>
- <when test="version == 0">
- ,gl.chinese_name as area
- </when>
- <when test="version == 1">
- ,gl.english_name as area
- </when>
- <otherwise>
- ,gl.ru_name as area
- </otherwise>
- </choose>
- <choose>
- <when test="version == 0">
- ,gl1.chinese_name as city
- </when>
- <when test="version == 1">
- ,gl1.english_name as city
- </when>
- <otherwise>
- ,gl1.ru_name as city
- </otherwise>
- </choose>
- <choose>
- <when test="version == 0">
- ,gl2.chinese_name as province
- </when>
- <when test="version == 1">
- ,gl2.english_name as province
- </when>
- <otherwise>
- ,gl2.ru_name as province
- </otherwise>
- </choose>
- from all_alarm_info_log a
- left join section s on a.sectionId = s.id
- left join global_location gl on s.pid = gl.id
- left join global_location gl1 on gl.pid = gl1.id
- left join global_location gl2 on gl1.pid = gl2.id
- left join lampinfo l on a.lampid = l.id
- where a.devType = 0
- <if test="sectionList != null and !sectionList.isEmpty()">
- and a.sectionId in
- <foreach collection="sectionList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="sectionId != null and sectionId != 0">
- and s.id = #{sectionId}
- </if>
- <if test="areaId != null and areaId != 0">
- and gl.id = #{areaId}
- </if>
- <if test="cityId != null and cityId != 0">
- and gl1.id = #{cityId}
- </if>
- <if test="provinceId != null and provinceId != 0">
- and gl2.id = #{provinceId}
- </if>
- <if test="alarmType != null and alarmType != ''">
- and a.stralarmtype like '%${alarmType}%'
- </if>
- <if test="limit >= 0 and offset > 0">
- limit #{limit},#{offset}
- </if>
- </select>
- <select id="getLampPoleAlarmListByVO" resultType="AllAlarmInfoLogDTO" parameterType="AllAlarmInfoLogVO">
- select
- a.id,a.updatetime as updateTime,a.stralarmtype as strAlarmType,
- s.name as section,a.devType,l.number,l.longitude,l.latitude,l.name
- <choose>
- <when test="version == 0">
- ,gl.chinese_name as area
- </when>
- <when test="version == 1">
- ,gl.english_name as area
- </when>
- <otherwise>
- ,gl.ru_name as area
- </otherwise>
- </choose>
- <choose>
- <when test="version == 0">
- ,gl1.chinese_name as city
- </when>
- <when test="version == 1">
- ,gl1.english_name as city
- </when>
- <otherwise>
- ,gl1.ru_name as city
- </otherwise>
- </choose>
- <choose>
- <when test="version == 0">
- ,gl2.chinese_name as province
- </when>
- <when test="version == 1">
- ,gl2.english_name as province
- </when>
- <otherwise>
- ,gl2.ru_name as province
- </otherwise>
- </choose>
- from all_alarm_info_log a
- left join section s on a.sectionId = s.id
- left join global_location gl on s.pid = gl.id
- left join global_location gl1 on gl.pid = gl1.id
- left join global_location gl2 on gl1.pid = gl2.id
- left join lamp_pole l on a.lampid = l.id
- where a.devType = 1
- <if test="sectionList != null and !sectionList.isEmpty()">
- and a.sectionId in
- <foreach collection="sectionList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="sectionId != null and sectionId != 0">
- and s.id = #{sectionId}
- </if>
- <if test="areaId != null and areaId != 0">
- and gl.id = #{areaId}
- </if>
- <if test="cityId != null and cityId != 0">
- and gl1.id = #{cityId}
- </if>
- <if test="provinceId != null and provinceId != 0">
- and gl2.id = #{provinceId}
- </if>
- <if test="alarmType != null and alarmType != ''">
- and a.stralarmtype like '%${alarmType}%'
- </if>
- <if test="limit >= 0 and offset > 0">
- limit #{limit},#{offset}
- </if>
- </select>
- <select id="getWaterImmersionAlarmListByVO" resultType="AllAlarmInfoLogDTO" parameterType="AllAlarmInfoLogVO">
- select
- a.id,a.updatetime as updateTime,a.stralarmtype as strAlarmType,
- s.name as section,a.devType,w.number,lp.longitude,lp.latitude,w.name
- <choose>
- <when test="version == 0">
- ,gl.chinese_name as area
- </when>
- <when test="version == 1">
- ,gl.english_name as area
- </when>
- <otherwise>
- ,gl.ru_name as area
- </otherwise>
- </choose>
- <choose>
- <when test="version == 0">
- ,gl1.chinese_name as city
- </when>
- <when test="version == 1">
- ,gl1.english_name as city
- </when>
- <otherwise>
- ,gl1.ru_name as city
- </otherwise>
- </choose>
- <choose>
- <when test="version == 0">
- ,gl2.chinese_name as province
- </when>
- <when test="version == 1">
- ,gl2.english_name as province
- </when>
- <otherwise>
- ,gl2.ru_name as province
- </otherwise>
- </choose>
- from all_alarm_info_log a
- left join section s on a.sectionId = s.id
- left join global_location gl on s.pid = gl.id
- left join global_location gl1 on gl.pid = gl1.id
- left join global_location gl2 on gl1.pid = gl2.id
- left join lamp_pole lp on a.lampid = lp.id
- left join water_immersion_dev_info w on w.lamp_pole_id = lp.id
- where a.devType = 3
- <if test="sectionList != null and !sectionList.isEmpty()">
- and a.sectionId in
- <foreach collection="sectionList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="sectionId != null and sectionId != 0">
- and s.id = #{sectionId}
- </if>
- <if test="areaId != null and areaId != 0">
- and gl.id = #{areaId}
- </if>
- <if test="cityId != null and cityId != 0">
- and gl1.id = #{cityId}
- </if>
- <if test="provinceId != null and provinceId != 0">
- and gl2.id = #{provinceId}
- </if>
- <if test="alarmType != null and alarmType != ''">
- and a.stralarmtype like '%${alarmType}%'
- </if>
- <if test="limit >= 0 and offset > 0">
- limit #{limit},#{offset}
- </if>
- </select>
- <select id="getElectricBoxAlarmListByVO" resultType="AllAlarmInfoLogDTO" parameterType="AllAlarmInfoLogVO">
- select
- a.id,a.updatetime as updateTime,a.stralarmtype as strAlarmType,
- s.name as section,a.devType,e.address as `number`,e.longitude,e.latitude,e.name
- <choose>
- <when test="version == 0">
- ,gl.chinese_name as area
- </when>
- <when test="version == 1">
- ,gl.english_name as area
- </when>
- <otherwise>
- ,gl.ru_name as area
- </otherwise>
- </choose>
- <choose>
- <when test="version == 0">
- ,gl1.chinese_name as city
- </when>
- <when test="version == 1">
- ,gl1.english_name as city
- </when>
- <otherwise>
- ,gl1.ru_name as city
- </otherwise>
- </choose>
- <choose>
- <when test="version == 0">
- ,gl2.chinese_name as province
- </when>
- <when test="version == 1">
- ,gl2.english_name as province
- </when>
- <otherwise>
- ,gl2.ru_name as province
- </otherwise>
- </choose>
- from all_alarm_info_log a
- left join section s on a.sectionId = s.id
- left join global_location gl on s.pid = gl.id
- left join global_location gl1 on gl.pid = gl1.id
- left join global_location gl2 on gl1.pid = gl2.id
- left join electric_box e on a.lampid = e.id
- where a.devType = 4
- <if test="sectionList != null and !sectionList.isEmpty()">
- and a.sectionId in
- <foreach collection="sectionList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="sectionId != null and sectionId != 0">
- and s.id = #{sectionId}
- </if>
- <if test="areaId != null and areaId != 0">
- and gl.id = #{areaId}
- </if>
- <if test="cityId != null and cityId != 0">
- and gl1.id = #{cityId}
- </if>
- <if test="provinceId != null and provinceId != 0">
- and gl2.id = #{provinceId}
- </if>
- <if test="alarmType != null and alarmType != ''">
- and a.stralarmtype like '%${alarmType}%'
- </if>
- <if test="limit >= 0 and offset > 0">
- limit #{limit},#{offset}
- </if>
- </select>
- <!-- 更新故障状态 -->
- <update id="updateAlarmStatus" parameterType="Integer">
- update all_alarm_info_log a
- set
- a.status = #{status}
- where a.id = #{id}
- </update>
- </mapper>
|