123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- <?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.CableDao">
- <select id="getDevListByCableDTO" resultType="CableDTO">
- select c.id,c.name,c.online,c.type,c.manhole1_X manhole1X,c.manhole1_Y manhole1Y,c.manhole1_Z manhole1Z,
- c.manhole1_V manhole1V,c.manhole1_A manhole1A,c.manhole2_X manhole2X,c.manhole2_Y manhole2Y,c.manhole2_Z manhole2Z,
- c.manhole2_V manhole2V,c.manhole2_A manhole2A,c.manhole3_X manhole3X,c.manhole3_Y manhole3Y,c.manhole3_Z manhole3Z,
- c.manhole3_V manhole3V,c.manhole3_A manhole3A,c.manhole4_X manhole4X,c.manhole4_Y manhole4Y,c.manhole4_Z manhole4Z,
- c.manhole4_V manhole4V,c.manhole4_A manhole4A,c.manhole5_X manhole5X,c.manhole5_Y manhole5Y,c.manhole5_Z manhole5Z,
- c.manhole5_V manhole5V,c.manhole5_A manhole5A,c.temperature1_T temperature1T,c.temperature1_V temperature1V,
- c.temperature1_A temperature1A,c.temperature2_T temperature2T,c.temperature2_V temperature2V,c.temperature2_A temperature2A,
- c.temperature3_T temperature3T,c.temperature3_V temperature3V,c.temperature3_A temperature3A,c.water_W waterW,c.water_V waterV,
- c.water_A waterA,c.ch4,c.co,c.h2s,c.o2,c.gas_V gasV,c.gas_A gasA,c.updatetime as updateTime,s.timezone
- from cable c left join lamp_pole lp on lp.id = c.lamp_pole_id
- left join section s on lp.sectionid = s.id
- where 1=1
- <if test="keyword != null and keyword != ''">
- and (c.name like '%${keyword}%' or c.address like '%${keyword}%')
- </if>
- <if test="sectionList != null and !sectionList.isEmpty()">
- and lp.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- order by convert(c.name using gbk) asc,c.id desc
- <if test="page >= 0 and count > 0">
- limit #{page},#{count}
- </if>
- </select>
- <!-- 设备总数 -->
- <select id="getTotalByCableDTO" resultType="Integer">
- select count(c.id) as total
- from cable c left join lamp_pole lp on c.lamp_pole_id = lp.id
- where 1=1
- <if test="sectionList != null and !sectionList.isEmpty()">
- and lp.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- <if test="keyword != null and keyword != ''">
- and (c.address like '%${keyword}%' or c.name like '%${keyword}%')
- </if>
- </select>
- <!-- 在线数 -->
- <select id="getOnlineTotalByCableDTO" resultType="Integer">
- select count(c.id) as total
- from cable c left join lamp_pole lp on c.lamp_pole_id = lp.id
- where c.online = 1
- <if test="sectionList != null and !sectionList.isEmpty()">
- and lp.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- <if test="keyword != null and keyword != ''">
- and (c.address like '%${keyword}%' or c.name like '%${keyword}%')
- </if>
- </select>
- <!-- 高温告警数 -->
- <select id="getTempAlarmTotalByCableDTO" resultType="Integer">
- select count(c.id) as total
- from cable c left join lamp_pole lp on c.lamp_pole_id = lp.id
- where c.online = 1 and (c.temperature1_A != 0 or c.temperature2_A != 0 or c.temperature3_A != 0)
- <if test="sectionList != null and !sectionList.isEmpty()">
- and lp.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- <if test="keyword != null and keyword != ''">
- and (c.address like '%${keyword}%' or c.name like '%${keyword}%')
- </if>
- </select>
- <!-- 水浸告警数 -->
- <select id="getWaterAlarmTotalByCableDTO" resultType="Integer">
- select count(c.id) as total
- from cable c left join lamp_pole lp on c.lamp_pole_id = lp.id
- where c.online = 1 and c.water_A != 0
- <if test="sectionList != null and !sectionList.isEmpty()">
- and lp.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- <if test="keyword != null and keyword != ''">
- and (c.address like '%${keyword}%' or c.name like '%${keyword}%')
- </if>
- </select>
- <!-- 井盖位移告警数 -->
- <select id="getManholeAlarmTotalByCableDTO" resultType="Integer">
- select count(c.id) as total
- from cable c left join lamp_pole lp on c.lamp_pole_id = lp.id
- where c.online = 1 and (c.manhole1_A != 0 or c.manhole2_A != 0 or c.manhole3_A != 0 or c.manhole4_A != 0 or c.manhole5_A != 0)
- <if test="sectionList != null and !sectionList.isEmpty()">
- and lp.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- <if test="keyword != null and keyword != ''">
- and (c.address like '%${keyword}%' or c.name like '%${keyword}%')
- </if>
- </select>
- <!-- ch4告警数 -->
- <select id="getCh4AlarmTotalByCableDTO" resultType="Integer">
- select count(c.id) as total
- from cable c left join lamp_pole lp on c.lamp_pole_id = lp.id
- where c.online = 1 and c.gas_A = 1
- <if test="sectionList != null and !sectionList.isEmpty()">
- and lp.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- <if test="keyword != null and keyword != ''">
- and (c.address like '%${keyword}%' or c.name like '%${keyword}%')
- </if>
- </select>
- <!-- co2告警数 -->
- <select id="getCo2AlarmTotalByCableDTO" resultType="Integer">
- select count(c.id) as total
- from cable c left join lamp_pole lp on c.lamp_pole_id = lp.id
- where c.online = 1 and c.gas_A = 2
- <if test="sectionList != null and !sectionList.isEmpty()">
- and lp.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- <if test="keyword != null and keyword != ''">
- and (c.address like '%${keyword}%' or c.name like '%${keyword}%')
- </if>
- </select>
- <!-- h2s告警数 -->
- <select id="getH2sAlarmTotalByCableDTO" resultType="Integer">
- select count(c.id) as total
- from cable c left join lamp_pole lp on c.lamp_pole_id = lp.id
- where c.online = 1 and c.gas_A = 4
- <if test="sectionList != null and !sectionList.isEmpty()">
- and lp.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- <if test="keyword != null and keyword != ''">
- and (c.address like '%${keyword}%' or c.name like '%${keyword}%')
- </if>
- </select>
- <!-- o2告警数 -->
- <select id="getO2AlarmTotalByCableDTO" resultType="Integer">
- select count(c.id) as total
- from cable c left join lamp_pole lp on c.lamp_pole_id = lp.id
- where c.online = 1 and c.gas_A = 8
- <if test="sectionList != null and !sectionList.isEmpty()">
- and lp.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- <if test="keyword != null and keyword != ''">
- and (c.address like '%${keyword}%' or c.name like '%${keyword}%')
- </if>
- </select>
- <delete id="deleteCableById">
- delete
- from cable
- where id = #{id};
- </delete>
- <select id="getCableById" resultType="CableDTO">
- select b.lamp_pole_id,lp.sectionid as sectionId
- from cable b
- left join lamp_pole lp on lp.id = b.lamp_pole_id
- left join section s on lp.sectionid = s.id
- where b.id = #{id}
- </select>
- <select id="getCableCountByLampPoleId" resultType="Integer">
- select count(*)
- from cable b
- where b.lamp_pole_id = #{lampPoleId}
- </select>
- <select id="getCableByLampPoleId" resultType="CableDTO">
- select b.lamp_pole_id,lp.sectionid as sectionId
- from cable b
- left join lamp_pole lp on lp.id = b.lamp_pole_id
- left join section s on lp.sectionid = s.id
- where b.lamp_pole_id = #{lampPoleId}
- </select>
- <select id="checkCableData" resultType="Integer">
- select count(*)
- from cable b
- where 1=1
- <if test="address != null and address != ''">
- and b.address = #{address}
- </if>
- <if test="lampPoleId != null and lampPoleId != 0">
- and b.lamp_pole_id != #{lampPoleId}
- </if>
- <if test="name != null and name != ''">
- and b.name = #{name}
- </if>
- <if test="id != null and id != 0">
- and b.id != #{id}
- </if>
- </select>
- <update id="updateLampPoleCableData" parameterType="CableDTO">
- update
- cable e
- set
- <if test="installDate != null and installDate != ''">e.install_date = #{installDate},</if>
- <if test="expirationDate != null and installDate != ''">e.expiration_date = #{expirationDate},</if>
- <if test="address != null and address != ''">e.address = #{address},</if>
- e.type = #{type},
- e.name = #{name}
- where 1=1
- <if test="lampPoleId != null and lampPoleId != 0">
- and e.lamp_pole_id = #{lampPoleId}
- </if>
- <if test="id != null and id != 0">
- and e.id = #{id}
- </if>
- </update>
- </mapper>
|