WifiMapper.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  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,w.voltage,w.current,w.power,
  62. w.lna1_status lna1Status,w.lna2_status lna2Status,w.lna3_status lna3Status,w.type1,w.power_factor as powerFactor,
  63. w.type2,w.type3,w.type4,w.type5,w.type6,w.close_time1 closeTime1,w.close_time2 closeTime2,w.flow as totalFlow,w.fir_version as firVersion,
  64. w.version as softVesion,w.ledStatus,w.online,w.ACI,w.lna1_vol as lna1Vol,w.lna1_cur as lna1Cur,w.lna2_vol as lna2Vol,w.lna2_cur as lna2Cur,
  65. w.lna3_vol as lna3Vol,w.lna3_cur as lna3Cur,
  66. w.close_time3 closeTime3,w.close_time4 closeTime4,w.close_time5 closeTime5,w.close_time6 closeTime6,w.device_count as wifiCount,
  67. w.open_time1 openTime1,w.open_time2 openTime2,w.open_time3 openTime3,w.open_time4 openTime4,w.open_time5 openTime5,w.open_time6 openTime6
  68. from wifi w left join lamp_pole lp on w.lamp_pole_id = lp.id
  69. where w.id = #{id}
  70. <if test="sectionList != null and !sectionList.isEmpty()">
  71. and lp.sectionid in
  72. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  73. #{item}
  74. </foreach>
  75. </if>
  76. </select>
  77. <select id="getCountByDTO" resultType="int" parameterType="WifiDTO">
  78. select count(*) as total
  79. from wifi w
  80. left join lamp_pole lp on lp.id = w.lamp_pole_id
  81. where w.id = #{id}
  82. <if test="sectionList != null and !sectionList.isEmpty()">
  83. and lp.sectionid in
  84. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  85. #{item}
  86. </foreach>
  87. </if>
  88. <if test="sn != null">
  89. and w.num = #{sn}
  90. </if>
  91. <if test="lampPoleId != null">
  92. and w.lamp_pole_id != #{lampPoleId}
  93. </if>
  94. </select>
  95. <insert id="add" parameterType="com.welampiot.dto.WifiDTO" useGeneratedKeys="true" keyProperty="id"
  96. >
  97. insert into wifi(num,model,lamp_pole_id,install_date,expiration_date
  98. <if test="ipAddr != null">,ip_addr</if>
  99. <if test="remark1 != null">,remark1</if>
  100. <if test="remark2 != null">,remark2</if>
  101. <if test="remark3 != null">,remark3</if>
  102. <if test="remark4 != null">,remark4</if>
  103. <if test="remark5 != null">,remark5</if>
  104. <if test="remark6 != null">,remark6</if>
  105. )
  106. values
  107. (#{sn},#{model},#{lampPoleId},#{installDate},#{expirationDate}
  108. <if test="ipAddr != null">,#{ipAddr}</if>
  109. <if test="remark1 != null">,#{remark1}</if>
  110. <if test="remark2 != null">,#{remark2}</if>
  111. <if test="remark3 != null">,#{remark3}</if>
  112. <if test="remark4 != null">,#{remark4}</if>
  113. <if test="remark5 != null">,#{remark5}</if>
  114. <if test="remark6 != null">,#{remark6}</if>
  115. )
  116. </insert>
  117. <insert id="update" parameterType="com.welampiot.dto.WifiDTO"
  118. >
  119. update wifi
  120. set
  121. num = #{sn},
  122. model = #{model},
  123. <if test="ipAddr != null">ip_addr=#{ipAddr},</if>
  124. <if test="remark1 != null">remark1=#{remark1},</if>
  125. <if test="remark2 != null">remark2=#{remark2},</if>
  126. <if test="remark3 != null">remark3=#{remark3},</if>
  127. <if test="remark4 != null">remark4=#{remark4},</if>
  128. <if test="remark5 != null">remark5=#{remark5},</if>
  129. <if test="remark6 != null">remark6=#{remark6},</if>
  130. <if test="type1 != null">type1=#{type1},</if>
  131. <if test="type2 != null">type2=#{type2},</if>
  132. <if test="type3 != null">type3=#{type3},</if>
  133. <if test="type4 != null">type4=#{type4},</if>
  134. <if test="type5 != null">type5=#{type5},</if>
  135. <if test="type6 != null">type6=#{type6},</if>
  136. <if test="AC1 != null">AC1=#{AC1},</if>
  137. <if test="AC2 != null">AC2=#{AC2},</if>
  138. <if test="AC3 != null">AC3=#{AC3},</if>
  139. <if test="lna1Status != null">lna1_status=#{lna1Status},</if>
  140. <if test="lna2Status != null">lna2_status=#{lna2Status},</if>
  141. <if test="lna3Status != null">lna3_status=#{lna3Status},</if>
  142. <if test="closeTime1 != null">close_time1=#{closeTime1},</if>
  143. <if test="closeTime2 != null">close_time2=#{closeTime2},</if>
  144. <if test="closeTime3 != null">close_time3=#{closeTime3},</if>
  145. <if test="closeTime4 != null">close_time4=#{closeTime4},</if>
  146. <if test="closeTime5 != null">close_time5=#{closeTime5},</if>
  147. <if test="closeTime6 != null">close_time6=#{closeTime6},</if>
  148. <if test="openTime1 != null">open_time1=#{openTime1},</if>
  149. <if test="openTime2 != null">open_time1=#{openTime2},</if>
  150. <if test="openTime3 != null">open_time1=#{openTime3},</if>
  151. <if test="openTime4 != null">open_time1=#{openTime4},</if>
  152. <if test="openTime5 != null">open_time1=#{openTime5},</if>
  153. <if test="openTime6 != null">open_time1=#{openTime6},</if>
  154. install_date = #{installDate},
  155. expiration_date = #{expirationDate}
  156. where 1=1
  157. <if test="lampPoleId != null">
  158. and lamp_pole_id = #{lampPoleId}
  159. </if>
  160. <if test="id != null">
  161. and id = #{id}
  162. </if>
  163. </insert>
  164. <select id="getDetailByDTO" resultType="com.welampiot.dto.WifiDTO" parameterType="com.welampiot.dto.WifiDTO">
  165. select w.id,w.num,w.model,w.lamp_pole_id as lampPoleId,w.install_date as installDate,w.expiration_date as expirationDate,w.remark1,w.remark2,w.remark3,w.remark4,w.remark5,w.remark6,w.ip_addr as ipAddr,w.num as sn,b.sectionid as sectionId
  166. from wifi w left join lamp_pole b on w.lamp_pole_id = b.id
  167. where 1=1
  168. <if test="lampPoleId != null">
  169. and w.lamp_pole_id = #{lampPoleId}
  170. </if>
  171. <if test="id != null">
  172. and w.id = #{id}
  173. </if>
  174. </select>
  175. <delete id="deleteById" parameterType="int">
  176. delete from wifi
  177. where id=#{id}
  178. </delete>
  179. <select id="getWifiInfoByLampPoleId" resultType="WifiDTO">
  180. select
  181. w.num,
  182. w.net_type as netType,
  183. w.model,
  184. w.powerModel,
  185. w.powerWaste,
  186. protectLevel,
  187. w.freq
  188. from wifi w
  189. where w.lamp_pole_id = #{lampPoleId}
  190. </select>
  191. <update id="updateWifiStatus" parameterType="WifiDTO">
  192. update
  193. wifi w
  194. set
  195. w.status = #{status}
  196. where
  197. w.lamp_pole_id = #{lampPoleId}
  198. </update>
  199. <update id="updateWifiByLampPoleId" parameterType="com.welampiot.dto.WifiDTO">
  200. update wifi
  201. set
  202. num = #{sn},
  203. <if test="ipAddr != null and ipAddr != ''">ip_addr = #{ipAddr},</if>
  204. <if test="remark1 != null and remark1 != ''">remark1 = #{remark1},</if>
  205. <if test="remark2 != null and remark2 != ''">remark2 = #{remark2},</if>
  206. <if test="remark3 != null and remark3 != ''">remark3 = #{remark3},</if>
  207. <if test="remark4 != null and remark4 != ''">remark4 = #{remark4},</if>
  208. <if test="remark5 != null and remark5 != ''">remark5 = #{remark5},</if>
  209. <if test="remark6 != null and remark6 != ''">remark6 = #{remark6},</if>
  210. <if test="installDate != null and installDate != ''">install_date = #{installDate},</if>
  211. <if test="expirationDate != null and expirationDate != ''">expiration_date = #{expirationDate},</if>
  212. model = #{model}
  213. where 1=1
  214. <if test="lampPoleId != null and lampPoleId != 0">
  215. and lamp_pole_id = #{lampPoleId}
  216. </if>
  217. <if test="id != null and id != 0">
  218. and id = #{id}
  219. </if>
  220. </update>
  221. <select id="checkWifiData" resultType="Integer">
  222. select count(*)
  223. from wifi w
  224. where 1=1
  225. <if test="lampPoleId != null and lampPoleId != 0">
  226. and w.lamp_pole_id != #{lampPoleId}
  227. </if>
  228. <if test="sn != null and sn != ''">
  229. and w.num = #{sn}
  230. </if>
  231. <if test="id != null and id != 0">
  232. and w.id != #{id}
  233. </if>
  234. </select>
  235. <select id="getWifiInfoDetails" resultType="WifiDTO">
  236. select w.remark1,w.remark2,w.remark3,w.remark4,w.remark5,w.remark6,w.AC1,w.AC2,w.AC3,w.voltage,w.current,w.power,
  237. w.lna1_status lna1Status,w.lna2_status lna2Status,w.lna3_status lna3Status,w.type1,w.power_factor as powerFactor,
  238. w.type2,w.type3,w.type4,w.type5,w.type6,w.close_time1 closeTime1,w.close_time2 closeTime2,w.flow as totalFlow,w.fir_version as firVersion,
  239. w.version as softVesion,w.ledStatus,w.online,w.ACI,w.lna1_vol as lna1Vol,w.lna1_cur as lna1Cur,w.lna2_vol as lna2Vol,w.lna2_cur as lna2Cur,
  240. w.lna3_vol as lna3Vol,w.lna3_cur as lna3Cur,
  241. w.close_time3 closeTime3,w.close_time4 closeTime4,w.close_time5 closeTime5,w.close_time6 closeTime6,w.device_count as wifiCount,
  242. w.open_time1 openTime1,w.open_time2 openTime2,w.open_time3 openTime3,w.open_time4 openTime4,w.open_time5 openTime5,w.open_time6 openTime6
  243. from wifi w
  244. where 1=1
  245. <if test="id != null and id != 0">
  246. and w.id = #{id}
  247. </if>
  248. <if test="lampPoleId != null and lampPoleId != 0">
  249. and w.lamp_pole_id = #{lampPoleId}
  250. </if>
  251. </select>
  252. <!-- 智诺云信息概览累计流量和wifi连接次数 -->
  253. <select id="getTotalWifiCountAndFlow" resultType="WifiDTO">
  254. select
  255. sum(w.device_count) as deviceCount,
  256. sum(w.flow) as flow
  257. from wifi w
  258. left join lamp_pole lp on lp.id = w.lamp_pole_id
  259. where 1=1
  260. <if test="sectionList != null and !sectionList.isEmpty()">
  261. and lp.sectionid in
  262. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  263. #{item}
  264. </foreach>
  265. </if>
  266. <if test="sectionId != null and sectionId != 0">
  267. and lp.sectionid = #{sectionId}
  268. </if>
  269. <if test="areaId != null and areaId != 0">
  270. and lp.areaid = #{areaId}
  271. </if>
  272. </select>
  273. <select id="getWifiByLampPoleId" resultType="WifiDTO">
  274. select
  275. w.num,w.model,w.status,w.net_type as netType,w.device_count deviceCount,
  276. w.flow,w.day_flow as dayFlow,w.day_device_count as dayDeviceCount,w.power,
  277. w.lanStatus,w.ledStatus,w.online,w.ACI,w.voltage,w.current,w.power_factor as powerFactor
  278. from wifi w
  279. where w.lamp_pole_id = #{lampPoleId}
  280. </select>
  281. <select id="getOneWifi" resultType="WifiDTO" parameterType="HashMap">
  282. select W.id
  283. from wifi W
  284. left join lamp_pole P on P.id = W.lamp_pole_id
  285. where P.areaid = #{areaId} and P.sectionid = #{sectionid}
  286. <choose>
  287. <when test="name != null and number == null">
  288. and W.num = #{name}
  289. </when>
  290. <when test="name == null and number != null">
  291. and W.num = #{number}
  292. </when>
  293. <otherwise>
  294. and (W.num = #{name} or W.num = #{number})
  295. </otherwise>
  296. </choose>
  297. </select>
  298. </mapper>