WifiMapper.xml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.welampiot.dao.WifiDao">
  4. <select id="getWifiListByDTO" resultType="WifiDTO">
  5. select w.id,w.model,w.lamp_pole_id lampPoleId,w.online,w.device_count deviceCount,w.num,s.timezone,
  6. w.day_flow dayFlow,w.flow,w.status,w.version,w.fir_version firVersion,w.updatetime,w.net_type netType,
  7. w.DI0,w.DO0,w.signal,w.install_date installDate,w.expiration_date expirationDate,lp.name lampPoleName
  8. from wifi w left join lamp_pole lp on w.lamp_pole_id = lp.id
  9. left join section s on lp.sectionid = s.id
  10. where 1=1 <if test="sectionList != null and !sectionList.isEmpty()">
  11. and lp.sectionid in
  12. <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
  13. #{dto}
  14. </foreach>
  15. </if>
  16. <if test="areaId != null and areaId != 0">
  17. and lp.areaid = #{areaId}
  18. </if>
  19. <if test="sectionId != null and sectionId != 0">
  20. and lp.sectionid = #{sectionId}
  21. </if>
  22. <choose>
  23. <when test="onlineState == 0">
  24. and w.online = 0
  25. </when>
  26. <when test="onlineState == 1">
  27. and w.online = 1
  28. </when>
  29. </choose>
  30. <if test="keyword != null and keyword != ''">
  31. and w.num like '%${keyword}%'
  32. </if>
  33. <if test="lampPoleId != null">
  34. and w.lamp_pole_id = #{lampPoleId}
  35. </if>
  36. order by w.id desc
  37. <if test="page >= 0 and count > 0">
  38. limit #{page},#{count}
  39. </if>
  40. </select>
  41. <select id="getWifiTotalBySectionList" resultType="Integer" parameterType="WifiDTO">
  42. select count(w.id) as total from wifi w left join lamp_pole lp on w.lamp_pole_id = lp.id
  43. <if test="sectionList != null and !sectionList.isEmpty()">
  44. where lp.sectionid in
  45. <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
  46. #{dto}
  47. </foreach>
  48. </if>
  49. </select>
  50. <select id="getWifiOnlineTotalBySectionList" resultType="Integer" parameterType="WifiDTO">
  51. select count(w.id) as total from wifi w left join lamp_pole lp on w.lamp_pole_id = lp.id
  52. where w.online = 1
  53. <if test="sectionList != null and !sectionList.isEmpty()">
  54. and lp.sectionid in
  55. <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
  56. #{dto}
  57. </foreach>
  58. </if>
  59. </select>
  60. <select id="getWifiOutInfoByDTO" resultType="WifiDTO">
  61. select w.remark1,w.remark2,w.remark3,w.remark4,w.remark5,w.remark6,w.AC1,w.AC2,w.AC3,
  62. w.lna1_status lna1Status,w.lna2_status lna2Status,w.lna3_status lna3Status,w.type1,
  63. w.type2,w.type3,w.type4,w.type5,w.type6,w.close_time1 closeTime1,w.close_time2 closeTime2,
  64. w.close_time3 closeTime3,w.close_time4 closeTime4,w.close_time5 closeTime5,w.close_time6 closeTime6,
  65. w.open_time1 openTime1,w.open_time2 openTime2,w.open_time3 openTime3,w.open_time4 openTime4,w.open_time5 openTime5,w.open_time6 openTime6
  66. from wifi w left join lamp_pole lp on w.lamp_pole_id = lp.id
  67. where w.id = #{id}
  68. <if test="sectionList != null and !sectionList.isEmpty()">
  69. and lp.sectionid in
  70. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  71. #{item}
  72. </foreach>
  73. </if>
  74. </select>
  75. <select id="getCountByDTO" resultType="int" parameterType="WifiDTO">
  76. select count(*) as total
  77. from wifi w
  78. where w.id = #{id}
  79. <if test="sectionList != null and !sectionList.isEmpty()">
  80. and lp.sectionid in
  81. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  82. #{item}
  83. </foreach>
  84. </if>
  85. <if test="sn != null">
  86. and w.num = #{sn}
  87. </if>
  88. <if test="lampPoleId != null">
  89. and w.lamp_pole_id != #{lampPoleId}
  90. </if>
  91. </select>
  92. <insert id="add" parameterType="com.welampiot.dto.WifiDTO" useGeneratedKeys="true" keyProperty="id"
  93. >
  94. insert into wifi(num,model,lamp_pole_id,install_date,expiration_date
  95. <if test="ipAddr != null">,ip_addr</if>
  96. <if test="remark1 != null">,remark1</if>
  97. <if test="remark2 != null">,remark2</if>
  98. <if test="remark3 != null">,remark3</if>
  99. <if test="remark4 != null">,remark4</if>
  100. <if test="remark5 != null">,remark5</if>
  101. <if test="remark6 != null">,remark6</if>
  102. )
  103. values
  104. (#{sn},#{model},#{lampPoleId},#{installDate},#{expirationDate}
  105. <if test="ipAddr != null">,#{ipAddr}</if>
  106. <if test="remark1 != null">,#{remark1}</if>
  107. <if test="remark2 != null">,#{remark2}</if>
  108. <if test="remark3 != null">,#{remark3}</if>
  109. <if test="remark4 != null">,#{remark4}</if>
  110. <if test="remark5 != null">,#{remark5}</if>
  111. <if test="remark6 != null">,#{remark6}</if>
  112. )
  113. </insert>
  114. <insert id="update" parameterType="com.welampiot.dto.WifiDTO"
  115. >
  116. update wifi
  117. set
  118. num = #{sn},
  119. model = #{model},
  120. <if test="ipAddr != null">ip_addr=#{ipAddr},</if>
  121. <if test="remark1 != null">remark1=#{remark1},</if>
  122. <if test="remark2 != null">remark2=#{remark2},</if>
  123. <if test="remark3 != null">remark3=#{remark3},</if>
  124. <if test="remark4 != null">remark4=#{remark4},</if>
  125. <if test="remark5 != null">remark5=#{remark5},</if>
  126. <if test="remark6 != null">remark6=#{remark6},</if>
  127. install_date = #{installDate},
  128. expiration_date = #{expirationDate}
  129. where 1=1
  130. <if test="lampPoleId != null">
  131. and lamp_pole_id = #{lampPoleId}
  132. </if>
  133. <if test="id != null">
  134. and id = #{id}
  135. </if>
  136. </insert>
  137. <select id="getDetailByDTO" resultType="com.welampiot.dto.WifiDTO" parameterType="com.welampiot.dto.WifiDTO">
  138. 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
  139. from wifi w
  140. where 1=1
  141. <if test="lampPoleId != null">
  142. and w.lamp_pole_id = #{lampPoleId}
  143. </if>
  144. <if test="id != null">
  145. and w.id = #{id}
  146. </if>
  147. </select>
  148. <delete id="deleteById" parameterType="int">
  149. delete from wifi
  150. where id=#{id}
  151. </delete>
  152. <select id="getWifiInfoByLampPoleId" resultType="WifiDTO">
  153. select w.num,w.net_type as netType,w.model
  154. from wifi w
  155. where w.lamp_pole_id = #{lampPoleId}
  156. </select>
  157. <update id="updateWifiStatus" parameterType="WifiDTO">
  158. update
  159. wifi w
  160. set
  161. w.status = #{status}
  162. where
  163. w.lamp_pole_id = #{lampPoleId}
  164. </update>
  165. </mapper>