AllAlarmInfoLogMapper.xml 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939
  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.AllAlarmInfoLogDao">
  4. <select id="getListByVO" resultType="com.welampiot.dto.AllAlarmInfoLogDTO" parameterType="com.welampiot.vo.LampCountVO">
  5. select L.number,
  6. <choose>
  7. <when test="version == 1">
  8. G.english_name as area,
  9. </when>
  10. <when test="version == 2">
  11. G.ru_name as area,
  12. </when>
  13. <otherwise>
  14. G.chinese_name as area,
  15. </otherwise>
  16. </choose>
  17. S.name as section,AI.stralarmtype as strAlarmType,AI.updatetime from all_alarm_info_log AI inner join lampinfo L on L.id = AI.lampid left join section S on L.sectionid = S.id left join global_location G on S.pid = G.id
  18. where L.faultstatus != 0
  19. <if test="sectionList != null and !sectionList.isEmpty()">
  20. and L.sectionid in
  21. <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
  22. #{vo}
  23. </foreach>
  24. </if>
  25. order by AI.updatetime desc
  26. <if test="offset != null and limit != null">
  27. limit #{offset},#{limit}
  28. </if>
  29. </select>
  30. <select id="getListByAllAlarmInfoLogVO" resultType="com.welampiot.dto.AllAlarmInfoLogDTO" parameterType="com.welampiot.vo.AllAlarmInfoLogVO">
  31. select
  32. <choose>
  33. <when test="version == 0">
  34. gl.chinese_name as area,
  35. </when>
  36. <when test="version == 1">
  37. gl.english_name as area,
  38. </when>
  39. <otherwise>
  40. gl.ru_name as area,
  41. </otherwise>
  42. </choose>
  43. a.id,s.name as secton,l.number,l.name,a.devType,a.dType,a.stralarmtype as strAlarmType,
  44. a.updatetime as updateTime,a.status,a.alarmtype as alarmType,s.timezone
  45. from all_alarm_info_log a
  46. left join lampinfo l on a.lampid = l.id
  47. left join section s on l.sectionid = s.id
  48. left join global_location gl on s.pid = gl.id
  49. where 1=1
  50. <if test="keyword != null and keyword != ''">
  51. and (l.number like '%${keyword}%' or a.stralarmtype like '%${keyword}%')
  52. </if>
  53. <if test="sectionList != null and !sectionList.isEmpty()">
  54. and l.sectionid in
  55. <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
  56. #{dto}
  57. </foreach>
  58. </if>
  59. <choose>
  60. <when test="status == 0">
  61. and a.status = 0
  62. </when>
  63. <when test="status == 1">
  64. and a.status = 1
  65. </when>
  66. <when test="status == 2">
  67. and a.status = 2
  68. </when>
  69. </choose>
  70. <choose>
  71. <when test="devType == 0">
  72. and a.devType = 0
  73. </when>
  74. <when test="devType == 1">
  75. and a.devType = 1
  76. </when>
  77. <when test="devType == 2">
  78. and a.devType = 2
  79. </when>
  80. <when test="devType == 3">
  81. and a.devType = 3
  82. </when>
  83. <when test="devType == 4">
  84. and a.devType = 4
  85. </when>
  86. <when test="devType == 5">
  87. and a.devType = 5
  88. </when>
  89. </choose>
  90. order by a.updatetime desc
  91. <if test="offset >= 0 and limit > 0">
  92. limit #{offset},#{limit}
  93. </if>
  94. </select>
  95. <select id="getUnTreatedCountByStatus" resultType="Integer">
  96. select count(a.id) as total
  97. from all_alarm_info_log a
  98. left join lampinfo l on a.lampid = l.id
  99. where a.status = 0
  100. <if test="sectionList != null and !sectionList.isEmpty()">
  101. and l.sectionid in
  102. <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
  103. #{dto}
  104. </foreach>
  105. </if>
  106. </select>
  107. <select id="getProcessingCountByStatus" resultType="Integer">
  108. select count(a.id) as total
  109. from all_alarm_info_log a
  110. left join lampinfo l on a.lampid = l.id
  111. where a.status = 1
  112. <if test="sectionList != null and !sectionList.isEmpty()">
  113. and l.sectionid in
  114. <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
  115. #{dto}
  116. </foreach>
  117. </if>
  118. </select>
  119. <select id="getHandleCountByStatus" resultType="Integer">
  120. select count(a.id) as total
  121. from all_alarm_info_log a
  122. left join lampinfo l on a.lampid = l.id
  123. where a.status = 2
  124. <if test="sectionList != null and !sectionList.isEmpty()">
  125. and l.sectionid in
  126. <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
  127. #{dto}
  128. </foreach>
  129. </if>
  130. </select>
  131. <select id="getAlarmTotalByStatus" resultType="Integer">
  132. select count(a.id) as total
  133. from all_alarm_info_log a
  134. left join lampinfo l on a.lampid = l.id
  135. <if test="sectionList != null and !sectionList.isEmpty()">
  136. where l.sectionid in
  137. <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
  138. #{dto}
  139. </foreach>
  140. </if>
  141. </select>
  142. <update id="updateAlarmStatusByAlarmId" parameterType="com.welampiot.dto.AllAlarmInfoLogDTO">
  143. update
  144. all_alarm_info_log a
  145. set
  146. a.status = #{status}
  147. where a.id = #{id}
  148. </update>
  149. <select id="getAlarmListBySectionList" resultType="com.welampiot.dto.AllAlarmInfoLogDTO">
  150. select a.id,l.number,a.stralarmtype as strAlarmType,a.status,a.updatetime as updateTime,
  151. r.repair_userid as repairUserid,r.repair_time as repairTime
  152. from all_alarm_info_log a
  153. left join lampinfo l on a.lampid = l.id
  154. left join repair_info r on r.lampid = l.id
  155. where 1=1
  156. <if test="sectionList != null and !sectionList.isEmpty()">
  157. and l.sectionid in
  158. <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
  159. #{dto}
  160. </foreach>
  161. </if>
  162. </select>
  163. <select id="getLampAlarmListByVO" resultType="AllAlarmInfoLogDTO" parameterType="AllAlarmInfoLogVO">
  164. select
  165. a.id,a.updatetime as updateTime,a.stralarmtype as strAlarmType,a.status,
  166. s.name as section,a.devType,l.number,l.longitude,l.latitude,l.name
  167. <choose>
  168. <when test="version == 0">
  169. ,gl.chinese_name as area
  170. </when>
  171. <when test="version == 1">
  172. ,gl.english_name as area
  173. </when>
  174. <otherwise>
  175. ,gl.ru_name as area
  176. </otherwise>
  177. </choose>
  178. <choose>
  179. <when test="version == 0">
  180. ,gl1.chinese_name as city
  181. </when>
  182. <when test="version == 1">
  183. ,gl1.english_name as city
  184. </when>
  185. <otherwise>
  186. ,gl1.ru_name as city
  187. </otherwise>
  188. </choose>
  189. <choose>
  190. <when test="version == 0">
  191. ,gl2.chinese_name as province
  192. </when>
  193. <when test="version == 1">
  194. ,gl2.english_name as province
  195. </when>
  196. <otherwise>
  197. ,gl2.ru_name as province
  198. </otherwise>
  199. </choose>
  200. from all_alarm_info_log a
  201. left join section s on a.sectionId = s.id
  202. left join global_location gl on s.pid = gl.id
  203. left join global_location gl1 on gl.pid = gl1.id
  204. left join global_location gl2 on gl1.pid = gl2.id
  205. left join lampinfo l on a.lampid = l.id
  206. where a.devType = 0
  207. <if test="sectionList != null and !sectionList.isEmpty()">
  208. and a.sectionId in
  209. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  210. #{item}
  211. </foreach>
  212. </if>
  213. <if test="sectionId != null and sectionId != 0">
  214. and s.id = #{sectionId}
  215. </if>
  216. <if test="areaId != null and areaId != 0">
  217. and gl.id = #{areaId}
  218. </if>
  219. <if test="cityId != null and cityId != 0">
  220. and gl1.id = #{cityId}
  221. </if>
  222. <if test="provinceId != null and provinceId != 0">
  223. and gl2.id = #{provinceId}
  224. </if>
  225. <if test="alarmType != null and alarmType != ''">
  226. and a.stralarmtype like '%${alarmType}%'
  227. </if>
  228. <if test="keyword != null and keyword != ''">
  229. and l.number like '%${keyword}%'
  230. </if>
  231. <if test="limit >= 0 and offset > 0">
  232. limit #{limit},#{offset}
  233. </if>
  234. </select>
  235. <select id="getLampPoleAlarmListByVO" resultType="AllAlarmInfoLogDTO" parameterType="AllAlarmInfoLogVO">
  236. select
  237. a.id,a.updatetime as updateTime,a.stralarmtype as strAlarmType,a.status,
  238. s.name as section,a.devType,l.number,l.longitude,l.latitude,l.name
  239. <choose>
  240. <when test="version == 0">
  241. ,gl.chinese_name as area
  242. </when>
  243. <when test="version == 1">
  244. ,gl.english_name as area
  245. </when>
  246. <otherwise>
  247. ,gl.ru_name as area
  248. </otherwise>
  249. </choose>
  250. <choose>
  251. <when test="version == 0">
  252. ,gl1.chinese_name as city
  253. </when>
  254. <when test="version == 1">
  255. ,gl1.english_name as city
  256. </when>
  257. <otherwise>
  258. ,gl1.ru_name as city
  259. </otherwise>
  260. </choose>
  261. <choose>
  262. <when test="version == 0">
  263. ,gl2.chinese_name as province
  264. </when>
  265. <when test="version == 1">
  266. ,gl2.english_name as province
  267. </when>
  268. <otherwise>
  269. ,gl2.ru_name as province
  270. </otherwise>
  271. </choose>
  272. from all_alarm_info_log a
  273. left join section s on a.sectionId = s.id
  274. left join global_location gl on s.pid = gl.id
  275. left join global_location gl1 on gl.pid = gl1.id
  276. left join global_location gl2 on gl1.pid = gl2.id
  277. left join lamp_pole l on a.lampid = l.id
  278. where a.devType = 1
  279. <if test="sectionList != null and !sectionList.isEmpty()">
  280. and a.sectionId in
  281. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  282. #{item}
  283. </foreach>
  284. </if>
  285. <if test="sectionId != null and sectionId != 0">
  286. and s.id = #{sectionId}
  287. </if>
  288. <if test="areaId != null and areaId != 0">
  289. and gl.id = #{areaId}
  290. </if>
  291. <if test="cityId != null and cityId != 0">
  292. and gl1.id = #{cityId}
  293. </if>
  294. <if test="provinceId != null and provinceId != 0">
  295. and gl2.id = #{provinceId}
  296. </if>
  297. <if test="alarmType != null and alarmType != ''">
  298. and a.stralarmtype like '%${alarmType}%'
  299. </if>
  300. <if test="keyword != null and keyword != ''">
  301. and l.number like '%${keyword}%'
  302. </if>
  303. <if test="limit >= 0 and offset > 0">
  304. limit #{limit},#{offset}
  305. </if>
  306. </select>
  307. <select id="getWaterImmersionAlarmListByVO" resultType="AllAlarmInfoLogDTO" parameterType="AllAlarmInfoLogVO">
  308. select
  309. a.id,a.updatetime as updateTime,a.stralarmtype as strAlarmType,a.status,
  310. s.name as section,a.devType,w.number,lp.longitude,lp.latitude,w.name
  311. <choose>
  312. <when test="version == 0">
  313. ,gl.chinese_name as area
  314. </when>
  315. <when test="version == 1">
  316. ,gl.english_name as area
  317. </when>
  318. <otherwise>
  319. ,gl.ru_name as area
  320. </otherwise>
  321. </choose>
  322. <choose>
  323. <when test="version == 0">
  324. ,gl1.chinese_name as city
  325. </when>
  326. <when test="version == 1">
  327. ,gl1.english_name as city
  328. </when>
  329. <otherwise>
  330. ,gl1.ru_name as city
  331. </otherwise>
  332. </choose>
  333. <choose>
  334. <when test="version == 0">
  335. ,gl2.chinese_name as province
  336. </when>
  337. <when test="version == 1">
  338. ,gl2.english_name as province
  339. </when>
  340. <otherwise>
  341. ,gl2.ru_name as province
  342. </otherwise>
  343. </choose>
  344. from all_alarm_info_log a
  345. left join section s on a.sectionId = s.id
  346. left join global_location gl on s.pid = gl.id
  347. left join global_location gl1 on gl.pid = gl1.id
  348. left join global_location gl2 on gl1.pid = gl2.id
  349. left join lamp_pole lp on a.lampid = lp.id
  350. left join water_immersion_dev_info w on w.lamp_pole_id = lp.id
  351. where a.devType = 3
  352. <if test="sectionList != null and !sectionList.isEmpty()">
  353. and a.sectionId in
  354. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  355. #{item}
  356. </foreach>
  357. </if>
  358. <if test="sectionId != null and sectionId != 0">
  359. and s.id = #{sectionId}
  360. </if>
  361. <if test="areaId != null and areaId != 0">
  362. and gl.id = #{areaId}
  363. </if>
  364. <if test="cityId != null and cityId != 0">
  365. and gl1.id = #{cityId}
  366. </if>
  367. <if test="provinceId != null and provinceId != 0">
  368. and gl2.id = #{provinceId}
  369. </if>
  370. <if test="alarmType != null and alarmType != ''">
  371. and a.stralarmtype like '%${alarmType}%'
  372. </if>
  373. <if test="keyword != null and keyword != ''">
  374. and w.number like '%${keyword}%'
  375. </if>
  376. <if test="limit >= 0 and offset > 0">
  377. limit #{limit},#{offset}
  378. </if>
  379. </select>
  380. <select id="getElectricBoxAlarmListByVO" resultType="AllAlarmInfoLogDTO" parameterType="AllAlarmInfoLogVO">
  381. select
  382. a.id,a.updatetime as updateTime,a.stralarmtype as strAlarmType,a.status,
  383. s.name as section,a.devType,e.address as `number`,e.longitude,e.latitude,e.name
  384. <choose>
  385. <when test="version == 0">
  386. ,gl.chinese_name as area
  387. </when>
  388. <when test="version == 1">
  389. ,gl.english_name as area
  390. </when>
  391. <otherwise>
  392. ,gl.ru_name as area
  393. </otherwise>
  394. </choose>
  395. <choose>
  396. <when test="version == 0">
  397. ,gl1.chinese_name as city
  398. </when>
  399. <when test="version == 1">
  400. ,gl1.english_name as city
  401. </when>
  402. <otherwise>
  403. ,gl1.ru_name as city
  404. </otherwise>
  405. </choose>
  406. <choose>
  407. <when test="version == 0">
  408. ,gl2.chinese_name as province
  409. </when>
  410. <when test="version == 1">
  411. ,gl2.english_name as province
  412. </when>
  413. <otherwise>
  414. ,gl2.ru_name as province
  415. </otherwise>
  416. </choose>
  417. from all_alarm_info_log a
  418. left join section s on a.sectionId = s.id
  419. left join global_location gl on s.pid = gl.id
  420. left join global_location gl1 on gl.pid = gl1.id
  421. left join global_location gl2 on gl1.pid = gl2.id
  422. left join electric_box e on a.lampid = e.id
  423. where a.devType = 4
  424. <if test="sectionList != null and !sectionList.isEmpty()">
  425. and a.sectionId in
  426. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  427. #{item}
  428. </foreach>
  429. </if>
  430. <if test="sectionId != null and sectionId != 0">
  431. and s.id = #{sectionId}
  432. </if>
  433. <if test="areaId != null and areaId != 0">
  434. and gl.id = #{areaId}
  435. </if>
  436. <if test="cityId != null and cityId != 0">
  437. and gl1.id = #{cityId}
  438. </if>
  439. <if test="provinceId != null and provinceId != 0">
  440. and gl2.id = #{provinceId}
  441. </if>
  442. <if test="alarmType != null and alarmType != ''">
  443. and a.stralarmtype like '%${alarmType}%'
  444. </if>
  445. <if test="keyword != null and keyword != ''">
  446. and e.address like '%${keyword}%'
  447. </if>
  448. <if test="limit >= 0 and offset > 0">
  449. limit #{limit},#{offset}
  450. </if>
  451. </select>
  452. <select id="getManholeAlarmListByVO" resultType="AllAlarmInfoLogDTO" parameterType="AllAlarmInfoLogVO">
  453. select
  454. a.id,a.updatetime as updateTime,a.stralarmtype as strAlarmType,a.status,
  455. s.name as section,a.devType,m.address as `number`,m.longitude,m.latitude,m.name
  456. <choose>
  457. <when test="version == 0">
  458. ,gl.chinese_name as area
  459. </when>
  460. <when test="version == 1">
  461. ,gl.english_name as area
  462. </when>
  463. <otherwise>
  464. ,gl.ru_name as area
  465. </otherwise>
  466. </choose>
  467. <choose>
  468. <when test="version == 0">
  469. ,gl1.chinese_name as city
  470. </when>
  471. <when test="version == 1">
  472. ,gl1.english_name as city
  473. </when>
  474. <otherwise>
  475. ,gl1.ru_name as city
  476. </otherwise>
  477. </choose>
  478. <choose>
  479. <when test="version == 0">
  480. ,gl2.chinese_name as province
  481. </when>
  482. <when test="version == 1">
  483. ,gl2.english_name as province
  484. </when>
  485. <otherwise>
  486. ,gl2.ru_name as province
  487. </otherwise>
  488. </choose>
  489. from all_alarm_info_log a
  490. left join section s on a.sectionId = s.id
  491. left join global_location gl on s.pid = gl.id
  492. left join global_location gl1 on gl.pid = gl1.id
  493. left join global_location gl2 on gl1.pid = gl2.id
  494. left join manhole m on a.lampid = m.id
  495. where a.devType = 2
  496. <if test="sectionList != null and !sectionList.isEmpty()">
  497. and a.sectionId in
  498. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  499. #{item}
  500. </foreach>
  501. </if>
  502. <if test="sectionId != null and sectionId != 0">
  503. and s.id = #{sectionId}
  504. </if>
  505. <if test="areaId != null and areaId != 0">
  506. and gl.id = #{areaId}
  507. </if>
  508. <if test="cityId != null and cityId != 0">
  509. and gl1.id = #{cityId}
  510. </if>
  511. <if test="provinceId != null and provinceId != 0">
  512. and gl2.id = #{provinceId}
  513. </if>
  514. <if test="alarmType != null and alarmType != ''">
  515. and a.stralarmtype like '%${alarmType}%'
  516. </if>
  517. <if test="keyword != null and keyword != ''">
  518. and m.address like '%${keyword}%'
  519. </if>
  520. <if test="limit >= 0 and offset > 0">
  521. limit #{limit},#{offset}
  522. </if>
  523. </select>
  524. <!-- 更新故障状态 -->
  525. <update id="updateAlarmStatus" parameterType="Integer">
  526. update all_alarm_info_log a
  527. set
  528. a.status = #{status}
  529. where a.id = #{id}
  530. </update>
  531. <!-- 运维概览故障数 -->
  532. <select id="getAllAlarmInfoLogCount" resultType="Integer">
  533. select count(a.id)
  534. from all_alarm_info_log a
  535. where date(a.updatetime) <![CDATA[ <= ]]> #{endDate}
  536. <if test="startDate != null and startDate != ''">
  537. and date(a.updatetime) <![CDATA[ >= ]]> #{startDate}
  538. </if>
  539. <if test="sectionList != null and !sectionList.isEmpty()">
  540. and a.sectionId in
  541. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  542. #{item}
  543. </foreach>
  544. </if>
  545. </select>
  546. <!-- 运维概览故障数,前30天内的数据数量 -->
  547. <select id="getAllAlarmCountOnMonth" resultType="AllAlarmInfoLogDTO">
  548. select count(*) as dayCount,date(a.updatetime) as updateTime
  549. from all_alarm_info_log a
  550. where a.updatetime <![CDATA[ >= ]]> curdate() - interval 30 day
  551. and a.updatetime <![CDATA[ <= ]]> now()
  552. <if test="sectionList != null and !sectionList.isEmpty()">
  553. and a.sectionId in
  554. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  555. #{item}
  556. </foreach>
  557. </if>
  558. group by date(a.updatetime)
  559. order by date(a.updatetime) desc
  560. </select>
  561. <!-- 运维概览故障未处理数,当月当年全部具体月份的数据数量 -->
  562. <select id="getAlarmUntreatedCount" resultType="Integer">
  563. select count(*) as dayCount
  564. from all_alarm_info_log a
  565. where a.status = 0
  566. and date(a.updatetime) <![CDATA[ <= ]]> #{endDate}
  567. <if test="startDate != null and startDate != ''">
  568. and date(a.updatetime) <![CDATA[ >= ]]> #{startDate}
  569. </if>
  570. <if test="sectionList != null and !sectionList.isEmpty()">
  571. and a.sectionId in
  572. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  573. #{item}
  574. </foreach>
  575. </if>
  576. </select>
  577. <!-- 运维概览故障处理中数,当月当年全部具体月份的数据数量 -->
  578. <select id="getAlarmHandlingCount" resultType="Integer">
  579. select count(*) as dayCount
  580. from all_alarm_info_log a
  581. where a.status = 1
  582. and date(a.updatetime) <![CDATA[ <= ]]> #{endDate}
  583. <if test="startDate != null and startDate != ''">
  584. and date(a.updatetime) <![CDATA[ >= ]]> #{startDate}
  585. </if>
  586. <if test="sectionList != null and !sectionList.isEmpty()">
  587. and a.sectionId in
  588. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  589. #{item}
  590. </foreach>
  591. </if>
  592. </select>
  593. <!-- 运维概览故障已处理数,当月当年全部具体月份的数据数量 -->
  594. <select id="getAlarmHandledCount" resultType="Integer">
  595. select count(*) as dayCount
  596. from all_alarm_info_log a
  597. where a.status = 2
  598. and date(a.updatetime) <![CDATA[ <= ]]> #{endDate}
  599. <if test="startDate != null and startDate != ''">
  600. and date(a.updatetime) <![CDATA[ >= ]]> #{startDate}
  601. </if>
  602. <if test="sectionList != null and !sectionList.isEmpty()">
  603. and a.sectionId in
  604. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  605. #{item}
  606. </foreach>
  607. </if>
  608. </select>
  609. <select id="getManholeAlarmTotal" resultType="Integer">
  610. select count(*)
  611. from all_alarm_info_log a
  612. left join manhole m on a.lampid = m.id
  613. left join section s on a.sectionId = s.id
  614. left join global_location gl on s.pid = gl.id
  615. left join global_location gl1 on gl.pid = gl1.id
  616. left join global_location gl2 on gl1.pid = gl2.id
  617. where a.devType = 2
  618. <if test="sectionList != null and !sectionList.isEmpty()">
  619. and a.sectionId in
  620. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  621. #{item}
  622. </foreach>
  623. </if>
  624. <if test="sectionId != null and sectionId != 0">
  625. and s.id = #{sectionId}
  626. </if>
  627. <if test="areaId != null and areaId != 0">
  628. and gl.id = #{areaId}
  629. </if>
  630. <if test="cityId != null and cityId != 0">
  631. and gl1.id = #{cityId}
  632. </if>
  633. <if test="provinceId != null and provinceId != 0">
  634. and gl2.id = #{provinceId}
  635. </if>
  636. <if test="alarmType != null and alarmType != ''">
  637. and a.stralarmtype like '%${alarmType}%'
  638. </if>
  639. <if test="keyword != null and keyword != ''">
  640. and m.address like '%${keyword}%'
  641. </if>
  642. </select>
  643. <select id="getLampAlarmTotal" resultType="Integer">
  644. select count(*)
  645. from all_alarm_info_log a
  646. left join lampinfo m on a.lampid = m.id
  647. left join section s on a.sectionId = s.id
  648. left join global_location gl on s.pid = gl.id
  649. left join global_location gl1 on gl.pid = gl1.id
  650. left join global_location gl2 on gl1.pid = gl2.id
  651. where a.devType = 0
  652. <if test="sectionList != null and !sectionList.isEmpty()">
  653. and a.sectionId in
  654. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  655. #{item}
  656. </foreach>
  657. </if>
  658. <if test="sectionId != null and sectionId != 0">
  659. and s.id = #{sectionId}
  660. </if>
  661. <if test="areaId != null and areaId != 0">
  662. and gl.id = #{areaId}
  663. </if>
  664. <if test="cityId != null and cityId != 0">
  665. and gl1.id = #{cityId}
  666. </if>
  667. <if test="provinceId != null and provinceId != 0">
  668. and gl2.id = #{provinceId}
  669. </if>
  670. <if test="alarmType != null and alarmType != ''">
  671. and a.stralarmtype like '%${alarmType}%'
  672. </if>
  673. <if test="keyword != null and keyword != ''">
  674. and m.number like '%${keyword}%'
  675. </if>
  676. </select>
  677. <select id="getLampPoleAlarmTotal" resultType="Integer">
  678. select count(*)
  679. from all_alarm_info_log a
  680. left join section s on a.sectionId = s.id
  681. left join global_location gl on s.pid = gl.id
  682. left join global_location gl1 on gl.pid = gl1.id
  683. left join global_location gl2 on gl1.pid = gl2.id
  684. left join lamp_pole m on a.lampid = m.id
  685. where a.devType = 1
  686. <if test="sectionList != null and !sectionList.isEmpty()">
  687. and a.sectionId in
  688. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  689. #{item}
  690. </foreach>
  691. </if>
  692. <if test="sectionId != null and sectionId != 0">
  693. and s.id = #{sectionId}
  694. </if>
  695. <if test="areaId != null and areaId != 0">
  696. and gl.id = #{areaId}
  697. </if>
  698. <if test="cityId != null and cityId != 0">
  699. and gl1.id = #{cityId}
  700. </if>
  701. <if test="provinceId != null and provinceId != 0">
  702. and gl2.id = #{provinceId}
  703. </if>
  704. <if test="alarmType != null and alarmType != ''">
  705. and a.stralarmtype like '%${alarmType}%'
  706. </if>
  707. <if test="keyword != null and keyword != ''">
  708. and m.number like '%${keyword}%'
  709. </if>
  710. </select>
  711. <select id="getEleBoxAlarmTotal" resultType="Integer">
  712. select count(*)
  713. from all_alarm_info_log a
  714. left join section s on a.sectionId = s.id
  715. left join global_location gl on s.pid = gl.id
  716. left join global_location gl1 on gl.pid = gl1.id
  717. left join global_location gl2 on gl1.pid = gl2.id
  718. left join electric_box m on a.lampid = m.id
  719. where a.devType = 4
  720. <if test="sectionList != null and !sectionList.isEmpty()">
  721. and a.sectionId in
  722. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  723. #{item}
  724. </foreach>
  725. </if>
  726. <if test="sectionId != null and sectionId != 0">
  727. and s.id = #{sectionId}
  728. </if>
  729. <if test="areaId != null and areaId != 0">
  730. and gl.id = #{areaId}
  731. </if>
  732. <if test="cityId != null and cityId != 0">
  733. and gl1.id = #{cityId}
  734. </if>
  735. <if test="provinceId != null and provinceId != 0">
  736. and gl2.id = #{provinceId}
  737. </if>
  738. <if test="alarmType != null and alarmType != ''">
  739. and a.stralarmtype like '%${alarmType}%'
  740. </if>
  741. <if test="keyword != null and keyword != ''">
  742. and m.address like '%${keyword}%'
  743. </if>
  744. </select>
  745. <select id="getWaterAlarmTotal" resultType="Integer">
  746. select count(*)
  747. from all_alarm_info_log a
  748. left join section s on a.sectionId = s.id
  749. left join global_location gl on s.pid = gl.id
  750. left join global_location gl1 on gl.pid = gl1.id
  751. left join global_location gl2 on gl1.pid = gl2.id
  752. left join lamp_pole lp on a.lampid = lp.id
  753. left join water_immersion_dev_info m on m.lamp_pole_id = lp.id
  754. where a.devType = 3
  755. <if test="sectionList != null and !sectionList.isEmpty()">
  756. and a.sectionId in
  757. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  758. #{item}
  759. </foreach>
  760. </if>
  761. <if test="sectionId != null and sectionId != 0">
  762. and s.id = #{sectionId}
  763. </if>
  764. <if test="areaId != null and areaId != 0">
  765. and gl.id = #{areaId}
  766. </if>
  767. <if test="cityId != null and cityId != 0">
  768. and gl1.id = #{cityId}
  769. </if>
  770. <if test="provinceId != null and provinceId != 0">
  771. and gl2.id = #{provinceId}
  772. </if>
  773. <if test="alarmType != null and alarmType != ''">
  774. and a.stralarmtype like '%${alarmType}%'
  775. </if>
  776. <if test="keyword != null and keyword != ''">
  777. and m.number like '%${keyword}%'
  778. </if>
  779. </select>
  780. <select id="getAlarmInfoDTOById" resultType="AllAlarmInfoLogDTO">
  781. select
  782. a.id,a.devType,a.lampid,s.name as section,a.alarmtype as alarmType,a.status
  783. <choose>
  784. <when test="version == 0">
  785. ,gl.chinese_name as area
  786. </when>
  787. <when test="version == 1">
  788. ,gl.english_name as area
  789. </when>
  790. <otherwise>
  791. ,gl.ru_name as area
  792. </otherwise>
  793. </choose>
  794. from all_alarm_info_log a
  795. left join section s on s.id = a.sectionId
  796. left join global_location gl on s.pid = gl.id
  797. where a.id = #{id}
  798. </select>
  799. <delete id="deleteAlarmData">
  800. delete
  801. from all_alarm_info_log
  802. where id in
  803. <foreach collection="id" item="item" open="(" separator="," close=")">
  804. #{item}
  805. </foreach>
  806. </delete>
  807. <select id="getAlarmOperationList" resultType="AllAlarmInfoLogDTO">
  808. select
  809. l.number,
  810. s.name as section,
  811. a.stralarmtype as strAlarmType,
  812. a.updatetime as updateTime
  813. <choose>
  814. <when test="version == 0">
  815. ,gl.chinese_name as area
  816. </when>
  817. <when test="version == 1">
  818. ,gl.english_name as area
  819. </when>
  820. <otherwise>
  821. ,gl.ru_name as area
  822. </otherwise>
  823. </choose>
  824. from all_alarm_info_log a
  825. left join lampinfo l on a.lampid = l.id
  826. left join section s on a.sectionId = s.id
  827. left join global_location gl on s.pid = gl.id
  828. where a.devType = 0
  829. <if test="sectionList != null and !sectionList.isEmpty()">
  830. and a.sectionId in
  831. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  832. #{item}
  833. </foreach>
  834. </if>
  835. order by a.updatetime desc
  836. limit 100
  837. </select>
  838. <select id="getLampAlarmInfoList" resultType="AllAlarmInfoLogDTO">
  839. select
  840. a.updatetime as updateTime,
  841. lp.name,
  842. s.name as section,
  843. a.status,
  844. a.stralarmtype as strAlarmType
  845. from all_alarm_info_log a
  846. left join lamp_pole lp on a.lampid = lp.id
  847. left join section s on lp.sectionid = s.id
  848. where a.devType = 1
  849. <if test="sectionList != null and !sectionList.isEmpty()">
  850. and lp.sectionId in
  851. <foreach collection="sectionList" item="item" separator="," open="(" close=")">
  852. #{item}
  853. </foreach>
  854. </if>
  855. <if test="areaId != null and areaId != 0">
  856. and lp.areaid = #{areaId}
  857. </if>
  858. <if test="sectionId != null and sectionId != 0">
  859. and lp.sectionid = #{sectionId}
  860. </if>
  861. order by a.updatetime desc
  862. limit 100
  863. </select>
  864. <select id="getLessLampAlarmInfoList" resultType="AllAlarmInfoLogDTO">
  865. select
  866. a.updatetime as updateTime,
  867. lp.name,
  868. s.name as section,
  869. a.status,
  870. a.stralarmtype as strAlarmType
  871. from all_alarm_info_log a
  872. left join lamp_pole lp on a.lampid = lp.id
  873. left join section s on lp.sectionid = s.id
  874. where a.devType = 1
  875. <if test="sectionList != null and !sectionList.isEmpty()">
  876. and lp.sectionId in
  877. <foreach collection="sectionList" item="item" separator="," open="(" close=")">
  878. #{item}
  879. </foreach>
  880. </if>
  881. <if test="areaId != null and areaId != 0">
  882. and lp.areaid = #{areaId}
  883. </if>
  884. <if test="sectionId != null and sectionId != 0">
  885. and lp.sectionid = #{sectionId}
  886. </if>
  887. order by a.updatetime desc
  888. limit 50
  889. </select>
  890. <!-- 单个灯杆故障次数 -->
  891. <select id="getOneLampPoleAlarmTotal" resultType="Integer">
  892. select count(*)
  893. from all_alarm_info_log a
  894. where a.devType = 1 and a.lampid = #{lampPoleId} and a.status != 2
  895. </select>
  896. <select id="getOneLampPoleAlarmList" resultType="Integer">
  897. select a.id,a.stralarmtype as alarmInfo,a.status as alarmStatus,a.updatetime as beginDate,a.free_time as endDate
  898. from all_alarm_info_log a
  899. where a.devType = 1 and a.lampid = #{lampPoleId} and a.status != 2
  900. order by a.updatetime desc
  901. </select>
  902. <insert id="addAlarmData" parameterType="allAlarmInfoLogDTO" keyProperty="id" useGeneratedKeys="true">
  903. insert into all_alarm_info_log(lampid,stralarmtype,updatetime,devType,dType,source,level,alarm_status)
  904. values
  905. (#{lampId},#{strAlarmType},#{updateTime},#{devType},#{dType},#{source},#{level},#{alarmStatus})
  906. </insert>
  907. </mapper>