VideoMonitorMapper.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  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.VideoMonitorDao">
  4. <select id="getLampPoleCountByVO" resultType="int" parameterType="com.welampiot.vo.VideoMonitorVO">
  5. select count(*) from video_monitor
  6. where lamp_pole_id != 0
  7. <if test="sectionList != null and !sectionList.isEmpty()">
  8. and sectionid in
  9. <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
  10. #{vo}
  11. </foreach>
  12. </if>
  13. </select>
  14. <select id="getLampPoleListByVO" resultType="com.welampiot.dto.VideoMonitorDTO" parameterType="com.welampiot.vo.VideoMonitorVO">
  15. select a.id,a.name,a.image,b.name as section,a.gb_address as gbAddress,b.pid as areaId
  16. <choose>
  17. <when test="version == 1">
  18. ,c.english_name as area
  19. ,d.english_name as city
  20. </when>
  21. <when test="version == 2">
  22. ,c.ru_name as area
  23. ,d.ru_name as city
  24. </when>
  25. <otherwise>
  26. ,c.chinese_name as area
  27. ,d.chinese_name as city
  28. </otherwise>
  29. </choose>
  30. from video_monitor a
  31. left join section b on a.sectionid = b.id
  32. left join global_location as c on c.id = b.pid
  33. left join global_location as d on d.id = c.pid
  34. where a.lamp_pole_id != 0
  35. <if test="sectionList != null and !sectionList.isEmpty()">
  36. and a.sectionid in
  37. <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
  38. #{vo}
  39. </foreach>
  40. </if>
  41. <if test="netStatus != null">
  42. and a.netStatus = #{netStatus}
  43. </if>
  44. order by a.id desc
  45. <if test="offset != null and limit != null">
  46. limit #{offset},#{limit}
  47. </if>
  48. </select>
  49. <update id="setAIStatus" parameterType="VideoMonitorDTO">
  50. update
  51. video_monitor v
  52. set
  53. v.status = #{isInspect}
  54. where v.lamp_pole_id = #{lampPoleId}
  55. </update>
  56. <select id="getOneById" resultType="com.welampiot.dto.VideoMonitorDTO" parameterType="int">
  57. select a.gb_address as gbAddress,a.netStatus,id,name,status,deviceType,longitude,latitude,devid as devId,password from video_monitor a
  58. where a.id = #{id}
  59. </select>
  60. <select id="getListByVO" resultType="com.welampiot.dto.VideoMonitorDTO" parameterType="com.welampiot.vo.VideoMonitorVO">
  61. select id,name,image from video_monitor
  62. where lamp_pole_id = 0
  63. <if test="sectionList != null and !sectionList.isEmpty()">
  64. and sectionid in
  65. <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
  66. #{vo}
  67. </foreach>
  68. </if>
  69. order by id desc
  70. <if test="offset != null and limit != null">
  71. limit #{offset},#{limit}
  72. </if>
  73. </select>
  74. <select id="getVideoListBySectionList" resultType="com.welampiot.dto.VideoMonitorDTO">
  75. select v.id,v.name,v.latitude,v.longitude,v.image
  76. from video_monitor v
  77. where 1=1
  78. <if test="sectionList != null and !sectionList.isEmpty()">
  79. and v.sectionid in
  80. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  81. #{item}
  82. </foreach>
  83. </if>
  84. </select>
  85. <update id="changeVideoMonitorLocationById" parameterType="VideoMonitorDTO">
  86. update
  87. video_monitor v
  88. set
  89. v.longitude = #{longitude},
  90. v.latitude = #{latitude}
  91. where v.id = #{id}
  92. </update>
  93. <select id="getVideoInfoListByVO" resultType="VideoMonitorDTO">
  94. select
  95. v.id,v.lamp_pole_id as lampPoleId,v.name,v.netStatus,v.status,v.devid as devId,
  96. v.password,v.day_personCountTotal as dayPersonCountTotal,v.peopleCountTotal,
  97. v.`day_ carCountTotal` as dayCarCountTotal,v.carCountTotal,v.deviceType,
  98. v.type,v.net_type as netType,v.rtmp,v.rtmpHd,v.hlsHd,v.channel,v.lastTime,
  99. v.gb_address as gbAddress,v.gb_address2 as gbAddress2,v.install_date as installDate,
  100. v.expiration_date as expirationDate,lp.name as lampPoleName
  101. from video_monitor v
  102. left join lamp_pole lp on lp.id = v.lamp_pole_id
  103. where 1=1
  104. <if test="sectionList != null and !sectionList.isEmpty()">
  105. and v.sectionid in
  106. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  107. #{item}
  108. </foreach>
  109. </if>
  110. <if test="areaId != null and areaId != 0">
  111. and v.areaid = #{areaId}
  112. </if>
  113. <if test="sectionId != null and sectionId != 0">
  114. and v.sectionid = #{sectionId}
  115. </if>
  116. <if test="limit >= 0 and offset > 0">
  117. limit #{limit},#{offset}
  118. </if>
  119. </select>
  120. <select id="getVideoTotal" resultType="Integer">
  121. select
  122. count(*)
  123. from video_monitor v
  124. where 1=1
  125. <if test="sectionList != null and !sectionList.isEmpty()">
  126. and v.sectionid in
  127. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  128. #{item}
  129. </foreach>
  130. </if>
  131. <if test="areaId != null and areaId != 0">
  132. and v.areaid = #{areaId}
  133. </if>
  134. <if test="sectionId != null and sectionId != 0">
  135. and v.sectionid = #{sectionId}
  136. </if>
  137. </select>
  138. <select id="getVideoOnlineTotal" resultType="Integer">
  139. select
  140. count(*)
  141. from video_monitor v
  142. where v.netStatus = 1
  143. <if test="sectionList != null and !sectionList.isEmpty()">
  144. and v.sectionid in
  145. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  146. #{item}
  147. </foreach>
  148. </if>
  149. <if test="areaId != null and areaId != 0">
  150. and v.areaid = #{areaId}
  151. </if>
  152. <if test="sectionId != null and sectionId != 0">
  153. and v.sectionid = #{sectionId}
  154. </if>
  155. </select>
  156. <select id="getVideoUsableTotal" resultType="Integer">
  157. select
  158. count(*)
  159. from video_monitor v
  160. where v.netStatus = 1 and v.status = 0
  161. <if test="sectionList != null and !sectionList.isEmpty()">
  162. and v.sectionid in
  163. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  164. #{item}
  165. </foreach>
  166. </if>
  167. <if test="areaId != null and areaId != 0">
  168. and v.areaid = #{areaId}
  169. </if>
  170. <if test="sectionId != null and sectionId != 0">
  171. and v.sectionid = #{sectionId}
  172. </if>
  173. </select>
  174. <delete id="deleteVideoMonitorById">
  175. delete
  176. from video_monitor
  177. where id = #{id};
  178. </delete>
  179. <select id="getLampPoleIdByVideoMonitorId" resultType="Integer">
  180. select v.lamp_pole_id
  181. from video_monitor v
  182. where v.id = #{id}
  183. </select>
  184. <select id="getVideoCountByLampPoleId" resultType="Integer">
  185. select count(*)
  186. from video_monitor v
  187. where v.lamp_pole_id = #{lampPoleId}
  188. </select>
  189. <select id="getOneByDbAddress" resultType="com.welampiot.dto.VideoMonitorDTO" parameterType="String">
  190. select back_address as backAddress
  191. from video_monitor v
  192. where v.gb_address = #{gbAddress}
  193. </select>
  194. <update id="updateBackAddress" parameterType="VideoMonitorDTO">
  195. update
  196. video_monitor v
  197. set
  198. v.back_address = #{backAddress}
  199. where v.gb_address = #{gbAddress}
  200. </update>
  201. <select id="getVideoListBySectionId" resultType="VideoMonitorDTO">
  202. select v.id,v.name
  203. from video_monitor v
  204. where v.sectionid = #{sectionId}
  205. </select>
  206. <select id="getVideoListByVO" resultType="VideoMonitorDTO">
  207. select
  208. v.id,
  209. v.name,
  210. v.image,
  211. v.deviceType,
  212. v.devid as devId,
  213. v.netStatus,
  214. v.rtmp,
  215. v.rtmpHd,
  216. v.hlsHd,
  217. v.channel
  218. from video_monitor v
  219. where 1=1
  220. <if test="sectionList != null and !sectionList.isEmpty()">
  221. and v.sectionid in
  222. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  223. #{item}
  224. </foreach>
  225. </if>
  226. <if test="keyword != null and keyword != ''">
  227. and v.name like '%${keyword}%'
  228. </if>
  229. <if test="areaId != null and areaId != 0">
  230. and v.areaid = #{areaId}
  231. </if>
  232. <if test="sectionId != null and sectionId != 0">
  233. and v.sectionid = #{sectionId}
  234. </if>
  235. <if test="limit >= 0 and offset > 0">
  236. limit #{limit},#{offset}
  237. </if>
  238. </select>
  239. <select id="getOneByDevId" resultType="VideoMonitorDTO">
  240. select devid as devId,channel,deviceType,gb_address as gbAddress,net_type as netType,type
  241. from video_monitor
  242. where devid = #{devId}
  243. </select>
  244. <select id="getVideoMonitorDetailsById" resultType="VideoMonitorDTO">
  245. select
  246. v.id,
  247. v.name,
  248. v.longitude,
  249. v.latitude,
  250. v.deviceType,
  251. v.net_type as netType,
  252. v.areaid as areaId,
  253. v.sectionid as sectionId,
  254. v.devid as devId,
  255. v.password,
  256. v.channel,
  257. v.type,
  258. v.hls,
  259. v.hlsHd,
  260. v.rtmp,
  261. v.rtmpHd,
  262. v.install_date as installDate,
  263. v.expiration_date as expirationDate,
  264. s.name as section
  265. <choose>
  266. <when test="version == 0">
  267. ,gl.chinese_name as area
  268. </when>
  269. <when test="version == 1">
  270. ,gl.english_name as area
  271. </when>
  272. <otherwise>
  273. ,gl.ru_name as area
  274. </otherwise>
  275. </choose>
  276. from video_monitor v
  277. left join section s on s.id = v.sectionid
  278. left join global_location gl on s.pid = gl.id
  279. where v.id = #{id}
  280. </select>
  281. <insert id="addVideoMonitorData" parameterType="VideoMonitorDTO" keyProperty="id" useGeneratedKeys="true">
  282. insert into video_monitor(`name`,
  283. sectionid,
  284. areaid,
  285. createtime,
  286. devid,
  287. `password`,
  288. <if test="channel != null and channel != ''">
  289. `channel`,
  290. </if>
  291. type,
  292. <if test="longitude != null and longitude != ''">
  293. longitude,
  294. </if>
  295. <if test="latitude != null and latitude != ''">
  296. latitude,
  297. </if>
  298. <if test="netType != null">
  299. net_type,
  300. </if>
  301. <if test="installDate != null and installDate != ''">
  302. install_date,
  303. </if>
  304. <if test="expirationDate != null and expirationDate != ''">
  305. expiration_date,
  306. </if>
  307. deviceType)
  308. values (#{name},
  309. #{sectionId},
  310. #{areaId},
  311. #{createTime},
  312. #{devId},
  313. #{password},
  314. <if test="channel != null and channel != ''">
  315. #{channel},
  316. </if>
  317. #{type},
  318. <if test="longitude != null and longitude != ''">
  319. #{longitude},
  320. </if>
  321. <if test="latitude != null and latitude != ''">
  322. #{latitude},
  323. </if>
  324. <if test="netType != null">
  325. #{netType},
  326. </if>
  327. <if test="installDate != null and installDate != ''">
  328. #{installDate},
  329. </if>
  330. <if test="expirationDate != null and expirationDate != ''">
  331. #{expirationDate},
  332. </if>
  333. #{deviceType}
  334. )
  335. </insert>
  336. <update id="updateVideoMonitorData" parameterType="VideoMonitorDTO">
  337. update
  338. video_monitor v
  339. set
  340. v.name = #{name},
  341. <if test="longitude != null and longitude != ''">
  342. v.longitude = #{longitude},
  343. </if>
  344. <if test="latitude != null and latitude != ''">
  345. v.latitude = #{latitude},
  346. </if>
  347. <if test="netType != null">
  348. v.net_type = #{netType},
  349. </if>
  350. v.deviceType = #{deviceType}
  351. where
  352. v.id = #{id}
  353. </update>
  354. <select id="checkVideoDevId" resultType="Integer">
  355. select
  356. count(*)
  357. from video_monitor v
  358. where 1=1
  359. <if test="devId != null and devId != ''">
  360. and v.devid = #{devId}
  361. </if>
  362. <if test="id != null and id != 0">
  363. and v.id != #{id}
  364. </if>
  365. </select>
  366. <!-- 智诺云信息概览车流量,人流量 -->
  367. <select id="getTotalCarAndPeople" resultType="VideoMonitorDTO">
  368. select
  369. sum(v.peopleCountTotal) as peopleCountTotal,
  370. sum(v.carCountTotal) as carCountTotal
  371. from video_monitor v
  372. where 1=1
  373. <if test="sectionList != null and !sectionList.isEmpty()">
  374. and v.sectionid in
  375. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  376. #{item}
  377. </foreach>
  378. </if>
  379. <if test="areaId != null and areaId != 0">
  380. and v.areaid = #{areaId}
  381. </if>
  382. <if test="sectionId != null and sectionId != 0">
  383. and v.sectionid = #{sectionId}
  384. </if>
  385. </select>
  386. <select id="getVideoMonitorByLampPoleId" resultType="VideoMonitorDTO">
  387. select
  388. v.id as videoId,v.is_auto as isAuto,v.rtmpHd,v.rtmp,v.hls,v.hlsHd,
  389. v.deviceType,v.net_type as netType,v.devid as devId,v.channel,v.manCount,
  390. v.womanCount,v.peopleCountTotal,v.day_personCountTotal as personCountToday,
  391. v.age1Count,v.age2Count,v.age3Count,v.age4Count,v.age5Count,v.age6Count,
  392. v.age7Count,v.carCountTotal,v.`day_ carCountTotal` as carCountToday,v.image
  393. from video_monitor v
  394. where v.lamp_pole_id = #{lampPoleId}
  395. </select>
  396. <update id="updateIsAutoStatus" parameterType="VideoMonitorDTO">
  397. update
  398. video_monitor v
  399. set
  400. v.is_auto = #{isAuto}
  401. where v.id = #{id}
  402. </update>
  403. <select id="getDataList" resultType="VideoMonitorDTO" parameterType="EmergencyDTO">
  404. select id,name
  405. from video_monitor
  406. where lamp_pole_id != 0 and lamp_pole_id is not null and sectionid = #{sectionId}
  407. </select>
  408. <select id="getOneMonitor" resultType="VideoMonitorDTO" parameterType="HashMap">
  409. select id
  410. from video_monitor
  411. where areaid = #{areaId} and sectionid = #{sectionId}
  412. <choose>
  413. <when test="name != null and number == null">
  414. and name = #{name}
  415. </when>
  416. <when test="name == null and number != null">
  417. and name = #{number}
  418. </when>
  419. <otherwise>
  420. and (name = #{name} or name = #{number})
  421. </otherwise>
  422. </choose>
  423. </select>
  424. </mapper>