| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- <?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.WifiDao">
- <select id="getWifiListByDTO" resultType="WifiDTO">
- select w.id,w.model,w.lamp_pole_id lampPoleId,w.online,w.device_count deviceCount,w.num,s.timezone,
- w.day_flow dayFlow,w.flow,w.status,w.version,w.fir_version firVersion,w.updatetime,w.net_type netType,
- w.DI0,w.DO0,w.signal,w.install_date installDate,w.expiration_date expirationDate,lp.name lampPoleName
- from wifi w left join lamp_pole lp on w.lamp_pole_id = lp.id
- left join section s on lp.sectionid = s.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="areaId != null and areaId != 0">
- and lp.areaid = #{areaId}
- </if>
- <if test="sectionId != null and sectionId != 0">
- and lp.sectionid = #{sectionId}
- </if>
- <choose>
- <when test="onlineState == 0">
- and w.online = 0
- </when>
- <when test="onlineState == 1">
- and w.online = 1
- </when>
- </choose>
- <if test="keyword != null and keyword != ''">
- and w.num like '%${keyword}%'
- </if>
- <if test="lampPoleId != null">
- and w.lamp_pole_id = #{lampPoleId}
- </if>
- order by w.id desc
- <if test="page >= 0 and count > 0">
- limit #{page},#{count}
- </if>
- </select>
- <select id="getWifiTotalBySectionList" resultType="Integer" parameterType="WifiDTO">
- select count(w.id) as total from wifi w left join lamp_pole lp on w.lamp_pole_id = lp.id
- <if test="sectionList != null and !sectionList.isEmpty()">
- where lp.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- </select>
- <select id="getWifiOnlineTotalBySectionList" resultType="Integer" parameterType="WifiDTO">
- select count(w.id) as total from wifi w left join lamp_pole lp on w.lamp_pole_id = lp.id
- where w.online = 1
- <if test="sectionList != null and !sectionList.isEmpty()">
- and lp.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- </select>
- <select id="getWifiOutInfoByDTO" resultType="WifiDTO">
- select w.remark1,w.remark2,w.remark3,w.remark4,w.remark5,w.remark6,w.AC1,w.AC2,w.AC3,
- w.lna1_status lna1Status,w.lna2_status lna2Status,w.lna3_status lna3Status,w.type1,
- w.type2,w.type3,w.type4,w.type5,w.type6,w.close_time1 closeTime1,w.close_time2 closeTime2,
- w.close_time3 closeTime3,w.close_time4 closeTime4,w.close_time5 closeTime5,w.close_time6 closeTime6,
- w.open_time1 openTime1,w.open_time2 openTime2,w.open_time3 openTime3,w.open_time4 openTime4,w.open_time5 openTime5,w.open_time6 openTime6
- from wifi w left join lamp_pole lp on w.lamp_pole_id = lp.id
- where w.id = #{id}
- <if test="sectionList != null and !sectionList.isEmpty()">
- and lp.sectionid in
- <foreach collection="sectionList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </select>
- <select id="getCountByDTO" resultType="int" parameterType="WifiDTO">
- select count(*) as total
- from wifi w
- where w.id = #{id}
- <if test="sectionList != null and !sectionList.isEmpty()">
- and lp.sectionid in
- <foreach collection="sectionList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="sn != null">
- and w.num = #{sn}
- </if>
- <if test="lampPoleId != null">
- and w.lamp_pole_id != #{lampPoleId}
- </if>
- </select>
- <insert id="add" parameterType="com.welampiot.dto.WifiDTO" useGeneratedKeys="true" keyProperty="id"
- >
- insert into wifi(num,model,lamp_pole_id,install_date,expiration_date
- <if test="ipAddr != null">,ip_addr</if>
- <if test="remark1 != null">,remark1</if>
- <if test="remark2 != null">,remark2</if>
- <if test="remark3 != null">,remark3</if>
- <if test="remark4 != null">,remark4</if>
- <if test="remark5 != null">,remark5</if>
- <if test="remark6 != null">,remark6</if>
- )
- values
- (#{sn},#{model},#{lampPoleId},#{installDate},#{expirationDate}
- <if test="ipAddr != null">,#{ipAddr}</if>
- <if test="remark1 != null">,#{remark1}</if>
- <if test="remark2 != null">,#{remark2}</if>
- <if test="remark3 != null">,#{remark3}</if>
- <if test="remark4 != null">,#{remark4}</if>
- <if test="remark5 != null">,#{remark5}</if>
- <if test="remark6 != null">,#{remark6}</if>
- )
- </insert>
- <insert id="update" parameterType="com.welampiot.dto.WifiDTO"
- >
- update wifi
- set
- num = #{sn},
- model = #{model},
- <if test="ipAddr != null">ip_addr=#{ipAddr},</if>
- <if test="remark1 != null">remark1=#{remark1},</if>
- <if test="remark2 != null">remark2=#{remark2},</if>
- <if test="remark3 != null">remark3=#{remark3},</if>
- <if test="remark4 != null">remark4=#{remark4},</if>
- <if test="remark5 != null">remark5=#{remark5},</if>
- <if test="remark6 != null">remark6=#{remark6},</if>
- install_date = #{installDate},
- expiration_date = #{expirationDate}
- where 1=1
- <if test="lampPoleId != null">
- and lamp_pole_id = #{lampPoleId}
- </if>
- <if test="id != null">
- and id = #{id}
- </if>
- </insert>
- <select id="getDetailByDTO" resultType="com.welampiot.dto.WifiDTO" parameterType="com.welampiot.dto.WifiDTO">
- select id,num,model,lamp_pole_id as lampPoleId,install_date as installDate,expiration_date as expirationDate,remark1,remark2,remark3,remark4,remark5,remark6,ip_addr as ipAddr,num as sn
- from wifi w
- where 1=1
- <if test="lampPoleId != null">
- and w.lamp_pole_id = #{lampPoleId}
- </if>
- <if test="id != null">
- and w.id = #{id}
- </if>
- </select>
- <delete id="deleteById" parameterType="int">
- delete from wifi
- where id=#{id}
- </delete>
- <select id="getWifiInfoByLampPoleId" resultType="WifiDTO">
- select w.num,w.net_type as netType,w.model
- from wifi w
- where w.lamp_pole_id = #{lampPoleId}
- </select>
- <update id="updateWifiStatus" parameterType="WifiDTO">
- update
- wifi w
- set
- w.status = #{status}
- where
- w.lamp_pole_id = #{lampPoleId}
- </update>
- </mapper>
|