123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939 |
- <?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.sectionid = 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,a.status,
- 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="keyword != null and keyword != ''">
- and l.number like '%${keyword}%'
- </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,a.status,
- 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="keyword != null and keyword != ''">
- and l.number like '%${keyword}%'
- </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,a.status,
- 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="keyword != null and keyword != ''">
- and w.number like '%${keyword}%'
- </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,a.status,
- 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="keyword != null and keyword != ''">
- and e.address like '%${keyword}%'
- </if>
- <if test="limit >= 0 and offset > 0">
- limit #{limit},#{offset}
- </if>
- </select>
- <select id="getManholeAlarmListByVO" resultType="AllAlarmInfoLogDTO" parameterType="AllAlarmInfoLogVO">
- select
- a.id,a.updatetime as updateTime,a.stralarmtype as strAlarmType,a.status,
- s.name as section,a.devType,m.address as `number`,m.longitude,m.latitude,m.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 manhole m on a.lampid = m.id
- where a.devType = 2
- <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="keyword != null and keyword != ''">
- and m.address like '%${keyword}%'
- </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>
- <!-- 运维概览故障数 -->
- <select id="getAllAlarmInfoLogCount" resultType="Integer">
- select count(a.id)
- from all_alarm_info_log a
- where date(a.updatetime) <![CDATA[ <= ]]> #{endDate}
- <if test="startDate != null and startDate != ''">
- and date(a.updatetime) <![CDATA[ >= ]]> #{startDate}
- </if>
- <if test="sectionList != null and !sectionList.isEmpty()">
- and a.sectionId in
- <foreach collection="sectionList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </select>
- <!-- 运维概览故障数,前30天内的数据数量 -->
- <select id="getAllAlarmCountOnMonth" resultType="AllAlarmInfoLogDTO">
- select count(*) as dayCount,date(a.updatetime) as updateTime
- from all_alarm_info_log a
- where a.updatetime <![CDATA[ >= ]]> curdate() - interval 30 day
- and a.updatetime <![CDATA[ <= ]]> now()
- <if test="sectionList != null and !sectionList.isEmpty()">
- and a.sectionId in
- <foreach collection="sectionList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- group by date(a.updatetime)
- order by date(a.updatetime) desc
- </select>
- <!-- 运维概览故障未处理数,当月当年全部具体月份的数据数量 -->
- <select id="getAlarmUntreatedCount" resultType="Integer">
- select count(*) as dayCount
- from all_alarm_info_log a
- where a.status = 0
- and date(a.updatetime) <![CDATA[ <= ]]> #{endDate}
- <if test="startDate != null and startDate != ''">
- and date(a.updatetime) <![CDATA[ >= ]]> #{startDate}
- </if>
- <if test="sectionList != null and !sectionList.isEmpty()">
- and a.sectionId in
- <foreach collection="sectionList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </select>
- <!-- 运维概览故障处理中数,当月当年全部具体月份的数据数量 -->
- <select id="getAlarmHandlingCount" resultType="Integer">
- select count(*) as dayCount
- from all_alarm_info_log a
- where a.status = 1
- and date(a.updatetime) <![CDATA[ <= ]]> #{endDate}
- <if test="startDate != null and startDate != ''">
- and date(a.updatetime) <![CDATA[ >= ]]> #{startDate}
- </if>
- <if test="sectionList != null and !sectionList.isEmpty()">
- and a.sectionId in
- <foreach collection="sectionList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </select>
- <!-- 运维概览故障已处理数,当月当年全部具体月份的数据数量 -->
- <select id="getAlarmHandledCount" resultType="Integer">
- select count(*) as dayCount
- from all_alarm_info_log a
- where a.status = 2
- and date(a.updatetime) <![CDATA[ <= ]]> #{endDate}
- <if test="startDate != null and startDate != ''">
- and date(a.updatetime) <![CDATA[ >= ]]> #{startDate}
- </if>
- <if test="sectionList != null and !sectionList.isEmpty()">
- and a.sectionId in
- <foreach collection="sectionList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </select>
- <select id="getManholeAlarmTotal" resultType="Integer">
- select count(*)
- from all_alarm_info_log a
- left join manhole m on a.lampid = m.id
- 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
- where a.devType = 2
- <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="keyword != null and keyword != ''">
- and m.address like '%${keyword}%'
- </if>
- </select>
- <select id="getLampAlarmTotal" resultType="Integer">
- select count(*)
- from all_alarm_info_log a
- left join lampinfo m on a.lampid = m.id
- 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
- 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="keyword != null and keyword != ''">
- and m.number like '%${keyword}%'
- </if>
- </select>
- <select id="getLampPoleAlarmTotal" resultType="Integer">
- select count(*)
- 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 m on a.lampid = m.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="keyword != null and keyword != ''">
- and m.number like '%${keyword}%'
- </if>
- </select>
- <select id="getEleBoxAlarmTotal" resultType="Integer">
- select count(*)
- 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 m on a.lampid = m.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="keyword != null and keyword != ''">
- and m.address like '%${keyword}%'
- </if>
- </select>
- <select id="getWaterAlarmTotal" resultType="Integer">
- select count(*)
- 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 m on m.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="keyword != null and keyword != ''">
- and m.number like '%${keyword}%'
- </if>
- </select>
- <select id="getAlarmInfoDTOById" resultType="AllAlarmInfoLogDTO">
- select
- a.id,a.devType,a.lampid,s.name as section,a.alarmtype as alarmType,a.status
- <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>
- from all_alarm_info_log a
- left join section s on s.id = a.sectionId
- left join global_location gl on s.pid = gl.id
- where a.id = #{id}
- </select>
- <delete id="deleteAlarmData">
- delete
- from all_alarm_info_log
- where id in
- <foreach collection="id" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </delete>
- <select id="getAlarmOperationList" resultType="AllAlarmInfoLogDTO">
- select
- l.number,
- s.name as section,
- a.stralarmtype as strAlarmType,
- a.updatetime as updateTime
- <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>
- from all_alarm_info_log a
- left join lampinfo l on a.lampid = l.id
- left join section s on a.sectionId = s.id
- left join global_location gl on s.pid = gl.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>
- order by a.updatetime desc
- limit 100
- </select>
- <select id="getLampAlarmInfoList" resultType="AllAlarmInfoLogDTO">
- select
- a.updatetime as updateTime,
- lp.name,
- s.name as section,
- a.status,
- a.stralarmtype as strAlarmType
- from all_alarm_info_log a
- left join lamp_pole lp on a.lampid = lp.id
- left join section s on lp.sectionid = s.id
- where a.devType = 1
- <if test="sectionList != null and !sectionList.isEmpty()">
- and lp.sectionId in
- <foreach collection="sectionList" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="areaId != null and areaId != 0">
- and lp.areaid = #{areaId}
- </if>
- <if test="sectionId != null and sectionId != 0">
- and lp.sectionid = #{sectionId}
- </if>
- order by a.updatetime desc
- limit 100
- </select>
- <select id="getLessLampAlarmInfoList" resultType="AllAlarmInfoLogDTO">
- select
- a.updatetime as updateTime,
- lp.name,
- s.name as section,
- a.status,
- a.stralarmtype as strAlarmType
- from all_alarm_info_log a
- left join lamp_pole lp on a.lampid = lp.id
- left join section s on lp.sectionid = s.id
- where a.devType = 1
- <if test="sectionList != null and !sectionList.isEmpty()">
- and lp.sectionId in
- <foreach collection="sectionList" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="areaId != null and areaId != 0">
- and lp.areaid = #{areaId}
- </if>
- <if test="sectionId != null and sectionId != 0">
- and lp.sectionid = #{sectionId}
- </if>
- order by a.updatetime desc
- limit 50
- </select>
- <!-- 单个灯杆故障次数 -->
- <select id="getOneLampPoleAlarmTotal" resultType="Integer">
- select count(*)
- from all_alarm_info_log a
- where a.devType = 1 and a.lampid = #{lampPoleId} and a.status != 2
- </select>
- <select id="getOneLampPoleAlarmList" resultType="Integer">
- select a.id,a.stralarmtype as alarmInfo,a.status as alarmStatus,a.updatetime as beginDate,a.free_time as endDate
- from all_alarm_info_log a
- where a.devType = 1 and a.lampid = #{lampPoleId} and a.status != 2
- order by a.updatetime desc
- </select>
- <insert id="addAlarmData" parameterType="allAlarmInfoLogDTO" keyProperty="id" useGeneratedKeys="true">
- insert into all_alarm_info_log(lampid,stralarmtype,updatetime,devType,dType,source,level,alarm_status)
- values
- (#{lampId},#{strAlarmType},#{updateTime},#{devType},#{dType},#{source},#{level},#{alarmStatus})
- </insert>
- </mapper>
|