| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 |
- <?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.LampPoleDao">
- <select id="getCountByVO" resultType="Integer" parameterType="com.welampiot.vo.LampPoleCountVO">
- select count(*) from lamp_pole a
- where 1=1
- <if test="sectionList != null and !sectionList.isEmpty()">
- and a.sectionid in
- <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
- #{vo}
- </foreach>
- </if>
- <if test="name != null">
- AND a.name = #{name}
- </if>
- <if test="number != null">
- AND a.number = #{number}
- </if>
- <if test="sectionId != null">
- AND a.sectionid = #{sectionId}
- </if>
- <if test="id != null">
- AND a.id != #{id}
- </if>
- </select>
- <select id="getNavByVO" resultType="com.welampiot.dto.LampPoleDTO" parameterType="com.welampiot.vo.LampPoleVO">
- select LP.id,LP.name,LP.longitude,LP.latitude,W.online from lamp_pole LP
- left join wifi as W on W.lamp_pole_id = LP.id
- left join envmonitor as E on E.lamp_pole_id = LP.id
- <if test="devType == 2">
- left join video_monitor as V on V.lamp_pole_id = LP.id
- </if>
- <if test="devType == 1">
- left join lampinfo as L on L.lamp_pole_id = LP.id
- </if>
- where 1=1
- <if test="sectionList != null and !sectionList.isEmpty()">
- and LP.sectionid in
- <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
- #{vo}
- </foreach>
- </if>
- <if test="devType != null">
- <choose>
- <when test="devType == 1">
- <if test="devId == null">
- AND (LP.devtype like "%0%")
- </if>
- <if test="devId != null">
- AND (LP.devtype like "%0%" OR L.id = #{devId})
- </if>
- </when>
- <when test="devType == 2">
- <if test="devId == null">
- AND (LP.devtype like "%1%")
- </if>
- <if test="devId != null">
- AND (LP.devtype like "%1%" OR L.id = #{devId})
- </if>
- </when>
- <otherwise>
- <if test="devId == null">
- AND (LP.devtype like "%7%")
- </if>
- <if test="devId != null">
- AND (LP.devtype like "%7%" OR L.id = #{devId})
- </if>
- </otherwise>
- </choose>
- </if>
- </select>
- <select id="getListByVO" resultType="com.welampiot.dto.LampPoleDTO" parameterType="com.welampiot.vo.LampPoleVO">
- select LP.id,LP.name,LP.devtype as devType,LP.createtime,LP.sn,LP.longitude,LP.latitude from lamp_pole LP
- where 1=1
- <if test="sectionList != null and !sectionList.isEmpty()">
- and LP.sectionid in
- <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
- #{vo}
- </foreach>
- </if>
- <if test="keyword != null">
- AND (LP.name like '%#{keyword}%' OR LP.sn like '%#{keyword}%')
- </if>
- </select>
- <select id="lampPoleList" resultType="com.welampiot.dto.LampPoleDTO" parameterType="com.welampiot.vo.LampPoleVO">
- select LP.id,LP.name,LP.devtype as devType,LP.sn,LP.longitude,LP.latitude,LP.createtime as createTime,L.faultstatus,LI.grid_active_power as power,LI.dim_value as lighteness,L.policy_type as policyType,P.name as policyName,LP.devtype as devType,LI.updatetime as updateTime,V.is_inspec as isInspec,S.timezone,S.name as section,C.name as company,L.policyid as policyId,LP.install_date as installDate,LP.expiration_date as expirationDate,
- <choose>
- <when test="version == 1">
- G.english_name as area,G2.english_name as city
- </when>
- <when test="version == 2">
- G.ru_name as area,G2.ru_name as city
- </when>
- <otherwise>
- G.chinese_name as area,G2.chinese_name as city
- </otherwise>
- </choose> from lamp_pole LP
- left join section as S on S.id = LP.sectionid
- left join lampinfo as L on L.lamp_pole_id = LP.id
- left join lamp_info_log_new as LI on LI.lampid = L.id
- left join global_location as G on G.id = S.pid
- left join global_location as G2 on G.pid = G2.id
- left join policy as P on L.policyid = P.id
- left join video_monitor as V on V.lamp_pole_id = LP.id
- left join user as U on U.id = LP.create_id
- left join company as C on U.company_id = C.id
- where 1=1
- <if test="sectionList != null and !sectionList.isEmpty()">
- and LP.sectionid in
- <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
- #{vo}
- </foreach>
- </if>
- <if test="keyword != null">
- AND (LP.name like '%#{keyword}%' OR LP.sn like '%#{keyword}%')
- </if>
- <if test="isInspec != null">
- and V.is_inspec = #{isInspec}
- </if>
- order by convert(LP.number using gbk) ASC,convert(LP.name using gbk) ASC,LP.id DESC
- <if test="offset != null and limit != null">
- limit #{offset},#{limit}
- </if>
- </select>
- <select id="lampPoleCount" resultType="int" parameterType="com.welampiot.vo.LampPoleVO">
- select count(LP.id) as total from lamp_pole LP
- left join video_monitor as V on V.lamp_pole_id = LP.id
- where 1=1
- <if test="sectionList != null and !sectionList.isEmpty()">
- and LP.sectionid in
- <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
- #{vo}
- </foreach>
- </if>
- <if test="keyword != null">
- AND (LP.name like '%#{keyword}%' OR LP.sn like '%#{keyword}%')
- </if>
- <if test="isInspec != null">
- and V.is_inspec = #{isInspec}
- </if>
- </select>
- <insert id="add" parameterType="com.welampiot.dto.LampPoleDTO" useGeneratedKeys="true" keyProperty="id"
- >
- insert into lamp_pole(name,number,height,areaid,sectionid,longitude,latitude,createtime,create_id,install_date,expiration_date
- <!-- <if test="mode != null">-->
- <!-- ,mode-->
- <!-- </if>-->
- )
- values
- (#{name},#{number},#{height},#{areaId},#{sectionId},#{longitude},#{latitude},#{createTime},#{createId},#{installDate},#{expirationDate}
- <!-- <if test="mode != null">-->
- <!-- ,#{mode}-->
- <!-- </if>-->
- )
- </insert>
- <insert id="update" parameterType="com.welampiot.dto.LampPoleDTO"
- >
- update lamp_pole
- set
- <if test="sn != null">sn = #{sn},</if>
- <if test="name != null">name = #{name},</if>
- <if test="number != null">number = #{number},</if>
- <if test="height != null">height = #{height},</if>
- <if test="areaId != null">areaid = #{areaId},</if>
- <if test="devType != null">devtype = #{devType},</if>
- <if test="sectionId != null">sectionid = #{sectionId},</if>
- <if test="longitude != null">longitude = #{longitude},</if>
- <if test="latitude != null">latitude = #{latitude},</if>
- <if test="installDate != null">install_date = #{installDate},</if>
- <if test="expirationDate != null">expiration_date = #{expirationDate},</if>
- id=#{id}
- where id = #{id}
- </insert>
- <select id="getDetailById" resultType="com.welampiot.dto.LampPoleDTO" parameterType="int">
- select id,name,number,height,areaid as areaId,sectionid as sectionId,longitude,latitude,install_date as installDate,expiration_date as expirationDate,devtype as devType from lamp_pole
- where id=#{id}
- </select>
- <delete id="deleteById" parameterType="int">
- delete from lamp_pole
- where id=#{id}
- </delete>
- </mapper>
|