SceneProMapper.xml 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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.fdkankan.manage.mapper.ISceneProMapper">
  4. <select id="getCountGroupByUserId" resultType="com.fdkankan.manage.vo.response.GroupByCount" >
  5. SELECT user_id as id, count(id) as count FROM t_scene_pro WHERE rec_status = 'A' and is_upgrade = 0
  6. and user_id in
  7. <foreach item="userId" collection="userIdList" open="(" separator="," close=")">
  8. #{userId}
  9. </foreach>
  10. GROUP BY user_id
  11. </select>
  12. <select id="getCountGroupByCameraId" resultType="com.fdkankan.manage.vo.response.GroupByCount">
  13. SELECT camera_id as id,count(id) as count FROM t_scene_pro WHERE rec_status = 'A' and is_upgrade = 0 AND camera_id is not null
  14. and scene_source in (1,2,3,12,13,14)
  15. and camera_id in
  16. <foreach item="cameraId" collection="cameraIds" open="(" separator="," close=")">
  17. #{cameraId}
  18. </foreach>
  19. GROUP BY camera_id
  20. </select>
  21. <select id="pageList" resultType="com.fdkankan.manage.vo.response.SceneVo">
  22. SELECT * FROM(
  23. select s.scene_name ,s.num,s.create_time,s.space as sceneSize
  24. ,s.view_count,s.status,s.pay_status,'v3' as scene_version ,s.web_site , s.thumb
  25. ,null as algorithmTime,data_source,s.shoot_count,s.gps,s.user_id,s.camera_id,s.compute_time,null as location,null as mixture,s.laser_title,null as slamCount,
  26. null as meshComputeTime,s.scene_source,s.feedback_option_id,s.is_obj
  27. from t_scene_pro s
  28. <include refid="commonWhere"></include>
  29. <if test="param.isLaser ==0 and param.sceneName != null and param.sceneName!='' ">
  30. and s.scene_name like concat ('%',#{param.sceneName},'%')
  31. </if>
  32. <if test="param.isLaser ==1 and param.sceneName != null and param.sceneName!='' ">
  33. and s.laser_title like concat ('%',#{param.sceneName},'%')
  34. </if>
  35. <if test="param.shootCountMin != null ">
  36. and s.shoot_count &gt;= #{param.shootCountMin}
  37. </if>
  38. <if test="param.shootCountMax != null ">
  39. and s.shoot_count &lt;= #{param.shootCountMax}
  40. </if>
  41. <if test="param.locations !=null and param.locations.size >0">
  42. and s.rec_status = 'AAA'
  43. </if>
  44. and is_upgrade = 0
  45. UNION ALL
  46. select s.title as sceneName ,s.num,s.create_time,e.space as sceneSize
  47. ,e.view_count,s.scene_status as status,s.pay_status,'v4' as scene_version,e.web_site,e.thumb
  48. ,algorithm_time,data_source,e.shoot_count,e.gps,s.user_id,s.camera_id,e.compute_time,e.location,e.mixture,s.laser_title,e.slam_count,
  49. e.mesh_compute_time,s.scene_source,s.feedback_option_id,e.is_obj
  50. from t_scene_plus s
  51. left join t_scene_plus_ext e on s.id = e.plus_id
  52. <include refid="commonWhere"></include>
  53. <if test="param.isLaser ==0 and param.sceneName != null and param.sceneName!='' ">
  54. and s.title like concat ('%',#{param.sceneName},'%')
  55. </if>
  56. <if test="param.isLaser ==1 and param.sceneName != null and param.sceneName!='' ">
  57. and s.laser_title like concat ('%',#{param.sceneName},'%')
  58. </if>
  59. <if test="param.shootCountMin != null ">
  60. and e.shoot_count &gt;= #{param.shootCountMin}
  61. </if>
  62. <if test="param.shootCountMax != null ">
  63. and e.shoot_count &lt;= #{param.shootCountMax}
  64. </if>
  65. <if test="param.locations !=null and param.locations.size >0">
  66. and e.location in
  67. <foreach item="location" collection="param.locations" open="(" separator="," close=")">
  68. #{location}
  69. </foreach>
  70. </if>
  71. ) as tb
  72. order by ${param.field} ${param.order}
  73. </select>
  74. <sql id="commonWhere">
  75. where s.rec_status = #{param.recStatus}
  76. <if test="param.cameraIds !=null and param.cameraIds.size >0">
  77. and s.camera_id in
  78. <foreach item="cameraId" collection="param.cameraIds" open="(" separator="," close=")">
  79. #{cameraId}
  80. </foreach>
  81. </if>
  82. <if test="param.userIds !=null and param.userIds.size >0">
  83. and s.user_id in
  84. <foreach item="userId" collection="param.userIds" open="(" separator="," close=")">
  85. #{userId}
  86. </foreach>
  87. </if>
  88. <if test="param.numList !=null and param.numList.size >0">
  89. and s.num in
  90. <foreach item="num" collection="param.numList" open="(" separator="," close=")">
  91. #{num}
  92. </foreach>
  93. </if>
  94. <if test="param.type !=null and param.type == 0">
  95. and s.scene_source in (1,2,12,13,14)
  96. </if>
  97. <if test="param.type !=null and param.type == 1">
  98. and s.scene_source = 3
  99. </if>
  100. <if test="param.type !=null and param.type == 2">
  101. and s.scene_source = 4
  102. </if>
  103. <if test="param.type !=null and param.type == 5">
  104. and s.scene_source = 4 and is_obj = 1
  105. </if>
  106. <if test="param.type !=null and param.type == 6">
  107. and s.scene_source = 5
  108. </if>
  109. <if test="param.type !=null and param.type == 7">
  110. and s.scene_source = 5 and is_obj = 1
  111. </if>
  112. <if test="param.type !=null and param.type == 8">
  113. and s.scene_source = 7
  114. </if>
  115. <if test="param.type !=null and param.type == 57">
  116. and s.scene_source = 57
  117. </if>
  118. <if test="param.type !=null and param.type == 58">
  119. and s.scene_source = 57 and is_obj = 1
  120. </if>
  121. <if test="param.num !=null and param.num !='' ">
  122. and s.num like concat ('%',#{param.num},'%')
  123. </if>
  124. <if test="param.startTime !=null and param.startTime !='' ">
  125. and s.create_time &gt;= #{param.startTime}
  126. </if>
  127. <if test="param.endTime !=null and param.endTime !='' ">
  128. and s.create_time &lt;= #{param.endTime}
  129. </if>
  130. </sql>
  131. <select id="getProSpaceGroupByCameraId" resultType="com.fdkankan.manage.vo.response.GroupByCount">
  132. SELECT camera_id as id,sum(space) as count FROM t_scene_pro
  133. WHERE rec_status = 'A' and is_upgrade = 0 GROUP BY camera_id
  134. </select>
  135. <select id="getPlusSpaceGroupByCameraId" resultType="com.fdkankan.manage.vo.response.GroupByCount">
  136. SELECT p.camera_id as id,sum(space) as count FROM t_scene_plus p left join t_scene_plus_ext e on p.id = e.plus_id
  137. WHERE p.rec_status = 'A' GROUP BY p.camera_id
  138. </select>
  139. <select id="getSpaceSumByCameraId" resultType="java.lang.Long">
  140. select sum(space) from t_scene_pro where rec_status= 'A' and status = -2 and is_upgrade = 0 and camera_id = #{cameraId}
  141. </select>
  142. <select id="selectDelPro" resultType="com.fdkankan.manage.entity.ScenePro">
  143. select * from t_scene_pro WHERE rec_status = 'I'
  144. and num in
  145. <foreach item="num" collection="numList" open="(" separator="," close=")">
  146. #{num}
  147. </foreach>
  148. </select>
  149. <update id="reDelScenePro">
  150. update t_scene_pro set rec_status = 'A' WHERE rec_status = 'I'
  151. and num in
  152. <foreach item="num" collection="numList" open="(" separator="," close=")">
  153. #{num}
  154. </foreach>
  155. </update>
  156. <update id="reDelSceneProEdit">
  157. update t_scene_pro_edit set rec_status = 'A' WHERE rec_status = 'I'
  158. and pro_id in
  159. <foreach item="proId" collection="proIds" open="(" separator="," close=")">
  160. #{proId}
  161. </foreach>
  162. </update>
  163. </mapper>