CommonGBChannelMapper.java 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  1. package com.genersoft.iot.vmp.gb28181.dao;
  2. import com.genersoft.iot.vmp.gb28181.bean.*;
  3. import com.genersoft.iot.vmp.gb28181.dao.provider.ChannelProvider;
  4. import org.apache.ibatis.annotations.*;
  5. import org.springframework.stereotype.Repository;
  6. import java.util.Collection;
  7. import java.util.List;
  8. @Mapper
  9. @Repository
  10. public interface CommonGBChannelMapper {
  11. @SelectProvider(type = ChannelProvider.class, method = "queryByDeviceId")
  12. CommonGBChannel queryByDeviceId(@Param("gbDeviceId") String gbDeviceId);
  13. @Insert(" <script>" +
  14. "INSERT INTO wvp_device_channel (" +
  15. "gb_device_id," +
  16. " <if test='streamProxyId != null' > stream_proxy_id,</if>" +
  17. " <if test='streamPushId != null' > stream_push_id,</if>" +
  18. "create_time," +
  19. "update_time," +
  20. "gb_name," +
  21. "gb_manufacturer," +
  22. "gb_model," +
  23. "gb_owner," +
  24. "gb_civil_code," +
  25. "gb_block," +
  26. "gb_address," +
  27. "gb_parental," +
  28. "gb_parent_id ," +
  29. "gb_safety_way," +
  30. "gb_register_way," +
  31. "gb_cert_num," +
  32. "gb_certifiable," +
  33. "gb_err_code," +
  34. "gb_end_time," +
  35. "gb_secrecy," +
  36. "gb_ip_address," +
  37. "gb_port," +
  38. "gb_password," +
  39. "gb_status," +
  40. "gb_longitude," +
  41. "gb_latitude," +
  42. "gb_ptz_type," +
  43. "gb_position_type," +
  44. "gb_room_type," +
  45. "gb_use_type," +
  46. "gb_supply_light_type," +
  47. "gb_direction_type," +
  48. "gb_resolution," +
  49. "gb_business_group_id," +
  50. "gb_download_speed," +
  51. "gb_svc_space_support_mod," +
  52. "gb_svc_time_support_mode ) " +
  53. "VALUES (" +
  54. "#{gbDeviceId}, " +
  55. " <if test='streamProxyId != null' > #{streamProxyId},</if>" +
  56. " <if test='streamPushId != null' > #{streamPushId},</if>" +
  57. "#{createTime}, " +
  58. "#{updateTime}, " +
  59. "#{gbName}, " +
  60. "#{gbManufacturer}, " +
  61. "#{gbModel}, " +
  62. "#{gbOwner}, " +
  63. "#{gbCivilCode}, " +
  64. "#{gbBlock}, " +
  65. "#{gbAddress}, " +
  66. "#{gbParental}, " +
  67. "#{gbParentId}, " +
  68. "#{gbSafetyWay}, " +
  69. "#{gbRegisterWay}, " +
  70. "#{gbCertNum}, " +
  71. "#{gbCertifiable}, " +
  72. "#{gbErrCode}, " +
  73. "#{gbEndTime}, " +
  74. "#{gbSecrecy},"+
  75. "#{gbIpAddress},"+
  76. "#{gbPort},"+
  77. "#{gbPassword},"+
  78. "#{gbStatus},"+
  79. "#{gbLongitude},"+
  80. "#{gbLatitude},"+
  81. "#{gbPtzType},"+
  82. "#{gbPositionType},"+
  83. "#{gbRoomType},"+
  84. "#{gbUseType},"+
  85. "#{gbSupplyLightType},"+
  86. "#{gbDirectionType},"+
  87. "#{gbResolution},"+
  88. "#{gbBusinessGroupId},"+
  89. "#{gbDownloadSpeed},"+
  90. "#{gbSvcSpaceSupportMod},"+
  91. "#{gbSvcTimeSupportMode}"+
  92. ")" +
  93. " </script>")
  94. @Options(useGeneratedKeys = true, keyProperty = "gbId", keyColumn = "id")
  95. int insert(CommonGBChannel commonGBChannel);
  96. @SelectProvider(type = ChannelProvider.class, method = "queryById")
  97. CommonGBChannel queryById(@Param("gbId") int gbId);
  98. @Delete(value = {"delete from wvp_device_channel where id = #{gbId} "})
  99. void delete(int gbId);
  100. @Update(value = {" <script>" +
  101. "UPDATE wvp_device_channel " +
  102. "SET update_time=#{updateTime}" +
  103. ", gb_device_id = #{gbDeviceId}" +
  104. ", gb_name = #{gbName}" +
  105. ", gb_manufacturer = #{gbManufacturer}" +
  106. ", gb_model = #{gbModel}" +
  107. ", gb_owner = #{gbOwner}" +
  108. ", gb_civil_code = #{gbCivilCode}" +
  109. ", gb_block = #{gbBlock}" +
  110. ", gb_address = #{gbAddress}" +
  111. ", gb_parental = #{gbParental}" +
  112. ", gb_safety_way = #{gbSafetyWay}" +
  113. ", gb_register_way = #{gbRegisterWay}" +
  114. ", gb_cert_num = #{gbCertNum}" +
  115. ", gb_certifiable = #{gbCertifiable}" +
  116. ", gb_err_code = #{gbErrCode}" +
  117. ", gb_end_time = #{gbEndTime}" +
  118. ", gb_ip_address = #{gbIpAddress}" +
  119. ", gb_port = #{gbPort}" +
  120. ", gb_password = #{gbPassword}" +
  121. ", gb_status = #{gbStatus}" +
  122. ", gb_longitude = #{gbLongitude}" +
  123. ", gb_latitude = #{gbLatitude}" +
  124. ", gb_ptz_type = #{gbPtzType}" +
  125. ", gb_position_type = #{gbPositionType}" +
  126. ", gb_room_type = #{gbRoomType}" +
  127. ", gb_use_type = #{gbUseType}" +
  128. ", gb_supply_light_type = #{gbSupplyLightType}" +
  129. ", gb_direction_type = #{gbDirectionType}" +
  130. ", gb_resolution = #{gbResolution}" +
  131. ", gb_business_group_id = #{gbBusinessGroupId}" +
  132. ", gb_download_speed = #{gbDownloadSpeed}" +
  133. ", gb_svc_space_support_mod = #{gbSvcSpaceSupportMod}" +
  134. ", gb_svc_time_support_mode = #{gbSvcTimeSupportMode}" +
  135. " WHERE id = #{gbId}"+
  136. " </script>"})
  137. int update(CommonGBChannel commonGBChannel);
  138. @Update(value = {" <script>" +
  139. " UPDATE wvp_device_channel " +
  140. " SET gb_status = #{status}" +
  141. " WHERE id = #{gbId}"+
  142. " </script>"})
  143. int updateStatusById(@Param("gbId") int gbId, @Param("status") int status);
  144. @Update("<script> " +
  145. "<foreach collection='commonGBChannels' index='index' item='item' separator=';'> " +
  146. "UPDATE wvp_device_channel SET gb_status = #{gbStatus} WHERE id = #{item.gbId}" +
  147. "</foreach> " +
  148. "</script>")
  149. int updateStatusForListById(List<CommonGBChannel> commonGBChannels, @Param("status") int status);
  150. @SelectProvider(type = ChannelProvider.class, method = "queryInListByStatus")
  151. List<CommonGBChannel> queryInListByStatus(List<CommonGBChannel> commonGBChannelList, @Param("status") int status);
  152. @Insert(" <script>" +
  153. "INSERT INTO wvp_device_channel (" +
  154. "gb_device_id," +
  155. "stream_proxy_id, " +
  156. "stream_push_id," +
  157. "create_time," +
  158. "update_time," +
  159. "gb_name," +
  160. "gb_manufacturer," +
  161. "gb_model," +
  162. "gb_owner," +
  163. "gb_civil_code," +
  164. "gb_block," +
  165. "gb_address," +
  166. "gb_parental," +
  167. "gb_parent_id ," +
  168. "gb_safety_way," +
  169. "gb_register_way," +
  170. "gb_cert_num," +
  171. "gb_certifiable," +
  172. "gb_err_code," +
  173. "gb_end_time," +
  174. "gb_secrecy," +
  175. "gb_ip_address," +
  176. "gb_port," +
  177. "gb_password," +
  178. "gb_status," +
  179. "gb_longitude," +
  180. "gb_latitude," +
  181. "gb_ptz_type," +
  182. "gb_position_type," +
  183. "gb_room_type," +
  184. "gb_use_type," +
  185. "gb_supply_light_type," +
  186. "gb_direction_type," +
  187. "gb_resolution," +
  188. "gb_business_group_id," +
  189. "gb_download_speed," +
  190. "gb_svc_space_support_mod," +
  191. "gb_svc_time_support_mode ) " +
  192. "VALUES" +
  193. "<foreach collection='commonGBChannels' index='index' item='item' separator=','> " +
  194. "(#{item.gbDeviceId}, #{item.streamProxyId}, #{item.streamPushId},#{item.createTime},#{item.updateTime}," +
  195. "#{item.gbName},#{item.gbManufacturer}, #{item.gbModel}," +
  196. "#{item.gbOwner},#{item.gbCivilCode},#{item.gbBlock}, #{item.gbAddress}, #{item.gbParental}, #{item.gbParentId},#{item.gbSafetyWay}, " +
  197. "#{item.gbRegisterWay},#{item.gbCertNum},#{item.gbCertifiable},#{item.gbErrCode},#{item.gbEndTime}, #{item.gbSecrecy},#{item.gbIpAddress}," +
  198. "#{item.gbPort},#{item.gbPassword},#{item.gbStatus},#{item.gbLongitude}, #{item.gbLatitude},#{item.gbPtzType},#{item.gbPositionType},#{item.gbRoomType}," +
  199. "#{item.gbUseType},#{item.gbSupplyLightType},#{item.gbDirectionType},#{item.gbResolution},#{item.gbBusinessGroupId},#{item.gbDownloadSpeed}," +
  200. "#{item.gbSvcSpaceSupportMod},#{item.gbSvcTimeSupportMode})" +
  201. "</foreach> " +
  202. " </script>")
  203. int batchAdd(List<CommonGBChannel> commonGBChannels);
  204. @Update("<script> " +
  205. "<foreach collection='commonGBChannels' index='index' item='item' separator=';'> " +
  206. "UPDATE wvp_device_channel SET gb_status = #{item.gbStatus} WHERE id = #{item.gbId}" +
  207. "</foreach> " +
  208. "</script>")
  209. int updateStatus(List<CommonGBChannel> commonGBChannels);
  210. @Select(value = {"select\n" +
  211. " wdc.id as gb_id,\n" +
  212. " wdc.device_db_id,\n" +
  213. " wdc.create_time,\n" +
  214. " wdc.update_time,\n" +
  215. " wdc.sub_count,\n" +
  216. " wdc.stream_id,\n" +
  217. " wdc.has_audio,\n" +
  218. " wdc.gps_time,\n" +
  219. " wdc.stream_identification,\n" +
  220. " coalesce(wpgc.device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +
  221. " coalesce(wpgc.name, wdc.gb_name, wdc.name) as gb_name,\n" +
  222. " coalesce(wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,\n" +
  223. " coalesce(wdc.gb_model, wdc.model) as gb_model,\n" +
  224. " coalesce(wdc.gb_owner, wdc.owner) as gb_owner,\n" +
  225. " coalesce(wdc.gb_civil_code, wdc.civil_code) as gb_civil_code,\n" +
  226. " coalesce(wdc.gb_block, wdc.block) as gb_block,\n" +
  227. " coalesce(wdc.gb_address, wdc.address) as gb_address,\n" +
  228. " coalesce(wpgc.parental, wdc.gb_parental, wdc.parental) as gb_parental,\n" +
  229. " coalesce(wpgc.parent_id, wdc.gb_parent_id, wdc.parent_id) as gb_parent_id,\n" +
  230. " coalesce(wdc.gb_safety_way, wdc.safety_way) as gb_safety_way,\n" +
  231. " coalesce(wdc.gb_register_way, wdc.register_way) as gb_register_way,\n" +
  232. " coalesce(wdc.gb_cert_num, wdc.cert_num) as gb_cert_num,\n" +
  233. " coalesce(wdc.gb_certifiable, wdc.certifiable) as gb_certifiable,\n" +
  234. " coalesce(wdc.gb_err_code, wdc.err_code) as gb_err_code,\n" +
  235. " coalesce(wdc.gb_end_time, wdc.end_time) as gb_end_time,\n" +
  236. " coalesce(wdc.gb_secrecy, wdc.secrecy) as gb_secrecy,\n" +
  237. " coalesce(wdc.gb_ip_address, wdc.ip_address) as gb_ip_address,\n" +
  238. " coalesce(wdc.gb_port, wdc.port) as gb_port,\n" +
  239. " coalesce(wdc.gb_password, wdc.password) as gb_password,\n" +
  240. " coalesce(wdc.gb_status, wdc.status) as gb_status,\n" +
  241. " coalesce(wdc.gb_longitude, wdc.longitude) as gb_longitude,\n" +
  242. " coalesce(wdc.gb_latitude, wdc.latitude) as gb_latitude,\n" +
  243. " coalesce(wdc.gb_ptz_type, wdc.ptz_type) as gb_ptz_type,\n" +
  244. " coalesce(wdc.gb_position_type, wdc.position_type) as gb_position_type,\n" +
  245. " coalesce(wdc.gb_room_type, wdc.room_type) as gb_room_type,\n" +
  246. " coalesce(wdc.gb_use_type, wdc.use_type) as gb_use_type,\n" +
  247. " coalesce(wdc.gb_supply_light_type, wdc.supply_light_type) as gb_supply_light_type,\n" +
  248. " coalesce(wdc.gb_direction_type, wdc.direction_type) as gb_direction_type,\n" +
  249. " coalesce(wdc.gb_resolution, wdc.resolution) as gb_resolution,\n" +
  250. " coalesce(wpgc.business_group_id, wdc.gb_business_group_id, wdc.business_group_id) as gb_business_group_id,\n" +
  251. " coalesce(wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,\n" +
  252. " coalesce(wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
  253. " coalesce(wdc.gb_svc_time_support_mode,wdc.svc_time_support_mode) as gb_svc_time_support_mode\n" +
  254. "from wvp_device_channel wdc left join wvp_platform_gb_channel wpgc on wdc.id = wpgc.device_channel_id\n" +
  255. "where wpgc.platform_id = #{platformId}"})
  256. List<CommonGBChannel> queryByPlatformId(@Param("platformId") Integer platformId);
  257. @Update(value = {" <script>" +
  258. " UPDATE wvp_device_channel " +
  259. " SET update_time=#{updateTime}, gb_device_id = null, gb_name = null, gb_manufacturer = null," +
  260. " gb_model = null, gb_owner = null, gb_block = null, gb_address = null," +
  261. " gb_parental = null, gb_parent_id = null, gb_safety_way = null, gb_register_way = null, gb_cert_num = null," +
  262. " gb_certifiable = null, gb_err_code = null, gb_end_time = null, gb_secrecy = null, gb_ip_address = null, " +
  263. " gb_port = null, gb_password = null, gb_status = null, gb_longitude = null, gb_latitude = null, " +
  264. " gb_ptz_type = null, gb_position_type = null, gb_room_type = null, gb_use_type = null, gb_supply_light_type = null, " +
  265. " gb_direction_type = null, gb_resolution = null, gb_business_group_id = null, gb_download_speed = null, gb_svc_space_support_mod = null, " +
  266. " gb_direction_type = null, gb_resolution = null, gb_business_group_id = null, gb_download_speed = null, gb_svc_space_support_mod = null, " +
  267. " gb_svc_time_support_mode = null" +
  268. " WHERE id = #{id} and device_db_id = #{gbDeviceDbId}"+
  269. " </script>"})
  270. void reset(@Param("id") int id, @Param("gbDeviceDbId") int gbDeviceDbId, @Param("updateTime") String updateTime);
  271. @SelectProvider(type = ChannelProvider.class, method = "queryByIds")
  272. List<CommonGBChannel> queryByIds(Collection<Integer> ids);
  273. @Delete(value = {" <script>" +
  274. " delete from wvp_device_channel" +
  275. " where 1 = 1 and id in " +
  276. " <foreach collection='channelListInDb' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
  277. "</script>"})
  278. void batchDelete(List<CommonGBChannel> channelListInDb);
  279. @SelectProvider(type = ChannelProvider.class, method = "queryByStreamPushId")
  280. CommonGBChannel queryByStreamPushId(@Param("streamPushId") Integer streamPushId);
  281. @SelectProvider(type = ChannelProvider.class, method = "queryByStreamProxyId")
  282. CommonGBChannel queryByStreamProxyId(@Param("streamProxyId") Integer streamProxyId);
  283. @SelectProvider(type = ChannelProvider.class, method = "queryList")
  284. List<CommonGBChannel> queryList(@Param("query") String query, @Param("online") Boolean online,
  285. @Param("hasCivilCode") Boolean hasCivilCode,
  286. @Param("hasGroup") Boolean hasGroup);
  287. @Select("<script>" +
  288. " select " +
  289. " coalesce(gb_device_id, device_id) as id," +
  290. " coalesce(gb_name, name) as label, " +
  291. " id as db_id, " +
  292. " 1 as type, " +
  293. " true as is_leaf " +
  294. " from wvp_device_channel " +
  295. " where coalesce(gb_civil_code, civil_code) = #{parent} " +
  296. " <if test='query != null'> AND (coalesce(gb_device_id, device_id) LIKE concat('%',#{query},'%') " +
  297. " OR coalesce(gb_name, name) LIKE concat('%',#{query},'%'))</if> " +
  298. " </script>")
  299. List<RegionTree> queryForRegionTreeByCivilCode(@Param("query") String query, @Param("parent") String parent);
  300. @Update(value = {" <script>" +
  301. " UPDATE wvp_device_channel " +
  302. " SET gb_civil_code = null, civil_code = null" +
  303. " WHERE gb_civil_code in "+
  304. " <foreach collection='allChildren' item='item' open='(' separator=',' close=')' > #{item.deviceId}</foreach>" +
  305. " </script>"})
  306. int removeCivilCode(List<Region> allChildren);
  307. @Update(value = {" <script>" +
  308. " UPDATE wvp_device_channel " +
  309. " SET gb_civil_code = #{civilCode}" +
  310. " WHERE id in "+
  311. " <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
  312. " </script>"})
  313. int updateRegion(@Param("civilCode") String civilCode, @Param("channelList") List<CommonGBChannel> channelList);
  314. @SelectProvider(type = ChannelProvider.class, method = "queryByIdsOrCivilCode")
  315. List<CommonGBChannel> queryByIdsOrCivilCode(@Param("civilCode") String civilCode, @Param("ids") List<Integer> ids);
  316. @Update(value = {" <script>" +
  317. " UPDATE wvp_device_channel " +
  318. " SET gb_civil_code = null, civil_code = null" +
  319. " WHERE id in "+
  320. " <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
  321. " </script>"})
  322. int removeCivilCodeByChannels(List<CommonGBChannel> channelList);
  323. @SelectProvider(type = ChannelProvider.class, method = "queryByCivilCode")
  324. List<CommonGBChannel> queryByCivilCode(@Param("civilCode") String civilCode);
  325. @SelectProvider(type = ChannelProvider.class, method = "queryByGbDeviceIds")
  326. List<CommonGBChannel> queryByGbDeviceIds(List<Integer> deviceIds);
  327. @SelectProvider(type = ChannelProvider.class, method = "queryByGroupList")
  328. List<CommonGBChannel> queryByGroupList(List<Group> groupList);
  329. @Update(value = {" <script>" +
  330. " UPDATE wvp_device_channel " +
  331. " SET gb_parent_id = null, gb_business_group_id = null, parent_id = null, business_group_id = null" +
  332. " WHERE id in "+
  333. " <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
  334. " </script>"})
  335. int removeParentIdByChannels(List<CommonGBChannel> channelList);
  336. @SelectProvider(type = ChannelProvider.class, method = "queryByBusinessGroup")
  337. List<CommonGBChannel> queryByBusinessGroup(@Param("businessGroup") String businessGroup);
  338. @SelectProvider(type = ChannelProvider.class, method = "queryByParentId")
  339. List<CommonGBChannel> queryByParentId(@Param("parentId") String parentId);
  340. @Update(value = {" <script>" +
  341. " UPDATE wvp_device_channel " +
  342. " SET gb_business_group_id = #{businessGroup}" +
  343. " WHERE id in "+
  344. " <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
  345. " </script>"})
  346. int updateBusinessGroupByChannelList(@Param("businessGroup") String businessGroup, List<CommonGBChannel> channelList);
  347. @Update(value = {" <script>" +
  348. " UPDATE wvp_device_channel " +
  349. " SET gb_parent_id = #{parentId}" +
  350. " WHERE id in "+
  351. " <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
  352. " </script>"})
  353. int updateParentIdByChannelList(@Param("parentId") String parentId, List<CommonGBChannel> channelList);
  354. @Select("<script>" +
  355. " select " +
  356. " coalesce(gb_device_id, device_id) as id," +
  357. " coalesce(gb_name, name) as label, " +
  358. " coalesce(gb_parent_id, parent_id) as parent_device_id, " +
  359. " coalesce(gb_business_group_id, business_group_id) as business_group, " +
  360. " id as db_id, " +
  361. " 1 as type, " +
  362. " true as is_leaf " +
  363. " from wvp_device_channel " +
  364. " where coalesce(gb_parent_id, parent_id) = #{parent} " +
  365. " <if test='query != null'> AND (coalesce(gb_device_id, device_id) LIKE concat('%',#{query},'%') " +
  366. " OR coalesce(gb_name, name) LIKE concat('%',#{query},'%'))</if> " +
  367. " </script>")
  368. List<GroupTree> queryForGroupTreeByParentId(@Param("query") String query, @Param("parent") String parent);
  369. @Update(value = {" <script>" +
  370. " UPDATE wvp_device_channel " +
  371. " SET gb_parent_id = #{parentId}, gb_business_group_id = #{businessGroup}" +
  372. " WHERE id in "+
  373. " <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
  374. " </script>"})
  375. int updateGroup(@Param("parentId") String parentId, @Param("businessGroup") String businessGroup,
  376. List<CommonGBChannel> channelList);
  377. @Update({"<script>" +
  378. "<foreach collection='commonGBChannels' item='item' separator=';'>" +
  379. " UPDATE" +
  380. " wvp_device_channel" +
  381. " SET update_time=#{item.updateTime}" +
  382. ", gb_device_id=#{item.gbDeviceId}" +
  383. ", gb_name=#{item.gbName}" +
  384. ", gb_manufacturer=#{item.gbManufacturer}" +
  385. ", gb_model=#{item.gbModel}" +
  386. ", gb_owner=#{item.gbOwner}" +
  387. ", gb_civil_code=#{item.gbCivilCode}" +
  388. ", gb_block=#{item.gbBlock}" +
  389. ", gb_address=#{item.gbAddress}" +
  390. ", gb_parental=#{item.gbParental}" +
  391. ", gb_safety_way=#{item.gbSafetyWay}" +
  392. ", gb_register_way=#{item.gbRegisterWay}" +
  393. ", gb_cert_num=#{item.gbCertNum}" +
  394. ", gb_certifiable=#{item.gbCertifiable}" +
  395. ", gb_err_code=#{item.gbErrCode}" +
  396. ", gb_end_time=#{item.gbEndTime}" +
  397. ", gb_ip_address=#{item.gbIpAddress}" +
  398. ", gb_port=#{item.gbPort}" +
  399. ", gb_password=#{item.gbPassword}" +
  400. ", gb_status=#{item.gbStatus}" +
  401. ", gb_longitude=#{item.gbLongitude}" +
  402. ", gb_latitude=#{item.gbLatitude}" +
  403. ", gb_ptz_type=#{item.gbPtzType}" +
  404. ", gb_position_type=#{item.gbPositionType}" +
  405. ", gb_room_type=#{item.gbRoomType}" +
  406. ", gb_use_type=#{item.gbUseType}" +
  407. ", gb_supply_light_type=#{item.gbSupplyLightType}" +
  408. ", gb_direction_type=#{item.gbDirectionType}" +
  409. ", gb_resolution=#{item.gbResolution}" +
  410. ", gb_business_group_id=#{item.gbBusinessGroupId}" +
  411. ", gb_download_speed=#{item.gbDownloadSpeed}" +
  412. ", gb_svc_space_support_mod=#{item.gbSvcSpaceSupportMod}" +
  413. ", gb_svc_time_support_mode=#{item.gbSvcTimeSupportMode}" +
  414. " WHERE id=#{item.id}" +
  415. "</foreach>" +
  416. "</script>"})
  417. int batchUpdate(List<CommonGBChannel> commonGBChannels);
  418. @Select("select\n" +
  419. " wdc.id as gb_id,\n" +
  420. " wdc.device_db_id as gb_device_db_id,\n" +
  421. " wdc.stream_push_id,\n" +
  422. " wdc.stream_proxy_id,\n" +
  423. " wdc.create_time,\n" +
  424. " wdc.update_time,\n" +
  425. " coalesce(wpgc.device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +
  426. " coalesce(wpgc.name, wdc.gb_name, wdc.name) as gb_name,\n" +
  427. " coalesce(wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,\n" +
  428. " coalesce(wdc.gb_model, wdc.model) as gb_model,\n" +
  429. " coalesce(wdc.gb_owner, wdc.owner) as gb_owner,\n" +
  430. " coalesce(wpgc.civil_code, wdc.gb_civil_code, wdc.civil_code),\n" +
  431. " coalesce(wdc.gb_block, wdc.block) as gb_block,\n" +
  432. " coalesce(wdc.gb_address, wdc.address) as gb_address,\n" +
  433. " coalesce(wdc.gb_parental, wdc.parental) as gb_parental,\n" +
  434. " coalesce(wpgc.parent_id, wdc.gb_parent_id, wdc.parent_id) as gb_parent_id,\n" +
  435. " coalesce(wdc.gb_safety_way, wdc.safety_way) as gb_safety_way,\n" +
  436. " coalesce(wdc.gb_register_way, wdc.register_way) as gb_register_way,\n" +
  437. " coalesce(wdc.gb_cert_num, wdc.cert_num) as gb_cert_num,\n" +
  438. " coalesce(wdc.gb_certifiable, wdc.certifiable) as gb_certifiable,\n" +
  439. " coalesce(wdc.gb_err_code, wdc.err_code) as gb_err_code,\n" +
  440. " coalesce(wdc.gb_end_time, wdc.end_time) as gb_end_time,\n" +
  441. " coalesce(wdc.gb_secrecy, wdc.secrecy) as gb_secrecy,\n" +
  442. " coalesce(wdc.gb_ip_address, wdc.ip_address) as gb_ip_address,\n" +
  443. " coalesce(wdc.gb_port, wdc.port) as gb_port,\n" +
  444. " coalesce(wdc.gb_password, wdc.password) as gb_password,\n" +
  445. " coalesce(wdc.gb_status, wdc.status) as gb_status,\n" +
  446. " coalesce(wdc.gb_longitude, wdc.longitude) as gb_longitude,\n" +
  447. " coalesce(wdc.gb_latitude, wdc.latitude) as gb_latitude,\n" +
  448. " coalesce(wdc.gb_ptz_type, wdc.ptz_type) as gb_ptz_type,\n" +
  449. " coalesce(wdc.gb_position_type, wdc.position_type) as gb_position_type,\n" +
  450. " coalesce(wdc.gb_room_type, wdc.room_type) as gb_room_type,\n" +
  451. " coalesce(wdc.gb_use_type, wdc.use_type) as gb_use_type,\n" +
  452. " coalesce(wdc.gb_supply_light_type, wdc.supply_light_type) as gb_supply_light_type,\n" +
  453. " coalesce(wdc.gb_direction_type, wdc.direction_type) as gb_direction_type,\n" +
  454. " coalesce(wdc.gb_resolution, wdc.resolution) as gb_resolution,\n" +
  455. " coalesce(wpgc.business_group_id, wdc.gb_business_group_id, wdc.business_group_id) as gb_business_group_id,\n" +
  456. " coalesce(wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,\n" +
  457. " coalesce(wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
  458. " coalesce(wdc.gb_svc_time_support_mode, wdc.svc_time_support_mode) as gb_svc_time_support_mode\n" +
  459. " from wvp_device_channel wdc" +
  460. " left jon wvp_platform_gb_channel wpgc on wdc.id = wpgc.device_channel_id" +
  461. " where wpgc.platform_id = #{platformId}"
  462. )
  463. List<CommonGBChannel> queryWithPlatform(@Param("platformId") Integer platformId);
  464. @Select("select\n" +
  465. " wdc.id as gb_id,\n" +
  466. " wdc.device_db_id as gb_device_db_id,\n" +
  467. " wdc.stream_push_id,\n" +
  468. " wdc.stream_proxy_id,\n" +
  469. " wdc.create_time,\n" +
  470. " wdc.update_time,\n" +
  471. " coalesce(wpgc.device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +
  472. " coalesce(wpgc.name, wdc.gb_name, wdc.name) as gb_name,\n" +
  473. " coalesce(wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,\n" +
  474. " coalesce(wdc.gb_model, wdc.model) as gb_model,\n" +
  475. " coalesce(wdc.gb_owner, wdc.owner) as gb_owner,\n" +
  476. " coalesce(wpgc.civil_code, wdc.gb_civil_code, wdc.civil_code),\n" +
  477. " coalesce(wdc.gb_block, wdc.block) as gb_block,\n" +
  478. " coalesce(wdc.gb_address, wdc.address) as gb_address,\n" +
  479. " coalesce(wdc.gb_parental, wdc.parental) as gb_parental,\n" +
  480. " coalesce(wpgc.parent_id, wdc.gb_parent_id, wdc.parent_id) as gb_parent_id,\n" +
  481. " coalesce(wdc.gb_safety_way, wdc.safety_way) as gb_safety_way,\n" +
  482. " coalesce(wdc.gb_register_way, wdc.register_way) as gb_register_way,\n" +
  483. " coalesce(wdc.gb_cert_num, wdc.cert_num) as gb_cert_num,\n" +
  484. " coalesce(wdc.gb_certifiable, wdc.certifiable) as gb_certifiable,\n" +
  485. " coalesce(wdc.gb_err_code, wdc.err_code) as gb_err_code,\n" +
  486. " coalesce(wdc.gb_end_time, wdc.end_time) as gb_end_time,\n" +
  487. " coalesce(wdc.gb_secrecy, wdc.secrecy) as gb_secrecy,\n" +
  488. " coalesce(wdc.gb_ip_address, wdc.ip_address) as gb_ip_address,\n" +
  489. " coalesce(wdc.gb_port, wdc.port) as gb_port,\n" +
  490. " coalesce(wdc.gb_password, wdc.password) as gb_password,\n" +
  491. " coalesce(wdc.gb_status, wdc.status) as gb_status,\n" +
  492. " coalesce(wdc.gb_longitude, wdc.longitude) as gb_longitude,\n" +
  493. " coalesce(wdc.gb_latitude, wdc.latitude) as gb_latitude,\n" +
  494. " coalesce(wdc.gb_ptz_type, wdc.ptz_type) as gb_ptz_type,\n" +
  495. " coalesce(wdc.gb_position_type, wdc.position_type) as gb_position_type,\n" +
  496. " coalesce(wdc.gb_room_type, wdc.room_type) as gb_room_type,\n" +
  497. " coalesce(wdc.gb_use_type, wdc.use_type) as gb_use_type,\n" +
  498. " coalesce(wdc.gb_supply_light_type, wdc.supply_light_type) as gb_supply_light_type,\n" +
  499. " coalesce(wdc.gb_direction_type, wdc.direction_type) as gb_direction_type,\n" +
  500. " coalesce(wdc.gb_resolution, wdc.resolution) as gb_resolution,\n" +
  501. " coalesce(wpgc.business_group_id, wdc.gb_business_group_id, wdc.business_group_id) as gb_business_group_id,\n" +
  502. " coalesce(wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,\n" +
  503. " coalesce(wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
  504. " coalesce(wdc.gb_svc_time_support_mode, wdc.svc_time_support_mode) as gb_svc_time_support_mode\n" +
  505. " from wvp_device_channel wdc" +
  506. " left jon wvp_platform_gb_channel wpgc on wdc.id = wpgc.device_channel_id" +
  507. " where wpgc.platform_id = #{platformId} and coalesce(wpgc.device_id, wdc.gb_device_id, wdc.device_id) = #{channelDeviceId}"
  508. )
  509. CommonGBChannel queryOneWithPlatform(@Param("platformId") Integer platformId, @Param("channelDeviceId") String channelDeviceId);
  510. }