SceneProMapper.xml 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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. <if test="isObj !=null and isObj == 0">
  11. and scene_source in (1,2,3,12,13,14)
  12. </if>
  13. <if test="isObj !=null and isObj == 1">
  14. and is_obj = 1
  15. and scene_source = 4
  16. </if>
  17. GROUP BY user_id
  18. </select>
  19. <select id="getCountGroupByCameraId" resultType="com.fdkankan.manage.vo.response.GroupByCount">
  20. 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
  21. and scene_source in (1,2,3,12,13,14)
  22. and camera_id in
  23. <foreach item="cameraId" collection="cameraIds" open="(" separator="," close=")">
  24. #{cameraId}
  25. </foreach>
  26. GROUP BY camera_id
  27. </select>
  28. <select id="selectMeshGroup" resultType="com.fdkankan.manage.vo.response.GroupByCount">
  29. SELECT ${groupKey} as id ,count(id) as count from (
  30. <include refid="selectMesh"></include>
  31. )as tb
  32. group by ${groupKey}
  33. </select>
  34. <select id="selectMesh" resultType="com.fdkankan.manage.vo.response.SceneVo">
  35. <include refid="selectMesh"></include>
  36. order by create_time desc,id asc
  37. </select>
  38. <select id="selectLaser" resultType="com.fdkankan.manage.vo.response.SceneVo">
  39. <include refid="selectLaser"></include>
  40. order by shoot_time desc,id asc
  41. </select>
  42. <select id="pageList2" resultType="com.fdkankan.manage.vo.response.SceneVo">
  43. <include refid="selectMesh"></include>
  44. UNION all
  45. <include refid="selectLaser"></include>
  46. ORDER BY create_time desc,id asc
  47. </select>
  48. <sql id="selectMesh">
  49. select s.id,'4dkankan' as sceneType,s.title as sceneName ,s.num,s.create_time,c.sn_code,e.space as sceneSize
  50. ,u.user_name,e.view_count,s.scene_status as status,s.pay_status,'v4' as scene_version,e.web_site , e.thumb
  51. ,e.algorithm_time,s.user_id,jy.platform_id,s.scene_source,s.three_cam_type,e.is_obj,jy.ry_nick_name as nickName,
  52. s.build_fail_reason,s.start_build_time,d.type
  53. from t_scene_plus s
  54. left join t_scene_plus_ext e on s.id = e.plus_id
  55. left join t_user u on s.user_id = u.id
  56. left join t_camera c on s.camera_id = c.id
  57. left join t_camera_detail d on s.camera_id = d.camera_id
  58. left join jy_user jy on u.id = jy.user_id
  59. WHERE s.rec_status = 'A'
  60. <if test="param.isObj != null and param.isObj==0">
  61. and s.scene_source in (4,5)
  62. </if>
  63. <if test="param.isObj != null and param.isObj==1">
  64. and ( s.scene_source in (4,5) and e.is_obj = 1 or s.scene_source not in (4,5) )
  65. </if>
  66. <if test="param.isObj == null ">
  67. and ( s.scene_source in (4,5) and e.is_obj = 1 or s.scene_source not in (4,5) )
  68. </if>
  69. <if test="param.sceneName != null and param.sceneName!='' ">
  70. and s.title like concat ('%',#{param.sceneName},'%')
  71. </if>
  72. <if test="param.snCode != null and param.snCode !='' ">
  73. and c.sn_code like concat ('%',#{param.snCode},'%')
  74. </if>
  75. <if test="param.num != null and param.num !='' ">
  76. and s.num like concat ('%',#{param.num},'%')
  77. </if>
  78. <if test="param.userName != null and param.userName !='' ">
  79. and u.user_name like concat ('%',#{param.userName},'%')
  80. </if>
  81. <if test="param.notUserId != null ">
  82. and u.id != #{param.notUserId}
  83. </if>
  84. <if test="param.sceneStatus != null ">
  85. and s.scene_status = #{param.sceneStatus}
  86. </if>
  87. <if test="param.type!= null">
  88. and d.type = #{param.type}
  89. </if>
  90. <if test="param.threeCamType !=null ">
  91. and s.three_cam_type = 'yzl'
  92. </if>
  93. <if test="param.notThreeCamType !=null ">
  94. and s.three_cam_type is null
  95. </if>
  96. <if test="param.sceneType == 0">
  97. <if test="param.userId!=null">
  98. and u.id = #{param.userId}
  99. </if>
  100. <if test="param.platformId!=null">
  101. and jy.platform_id = #{param.platformId}
  102. </if>
  103. </if>
  104. <if test="param.sceneType == 1">
  105. <if test="param.platform!= null">
  106. and jy.platform_id = #{param.platform}
  107. </if>
  108. and ( 1!=1
  109. <if test="param.otherPlatformIds != null and param.otherPlatformIds.size >0">
  110. or jy.platform_id in
  111. <foreach item="platformId" collection="param.otherPlatformIds" open="(" separator="," close=")">
  112. #{platformId}
  113. </foreach>
  114. </if>
  115. <if test="param.otherUserIds !=null and param.otherUserIds.size>0">
  116. or u.id in
  117. <foreach item="userId" collection="param.otherUserIds" open="(" separator="," close=")">
  118. #{userId}
  119. </foreach>
  120. </if>
  121. <if test="param.authNumList !=null and param.authNumList.size>0 ">
  122. or s.num in
  123. <foreach item="num" collection="param.authNumList" open="(" separator="," close=")">
  124. #{num}
  125. </foreach>
  126. </if>
  127. )
  128. </if>
  129. </sql>
  130. <sql id="selectLaser">
  131. SELECT s.id,'laser' as sceneType, s.title as sceneName,s.scene_code as num,s.shoot_time as createTime,s.sn_code,s.space as scennSize,s.user_name,s.view_count,s.status,
  132. s.pay_status,'v4' as scene_version,s.web_site,s.init_pic as thumb,s.algorithm_time,s.user_id,jy.platform_id,s.scene_source,
  133. null as asthree_cam_type ,null as is_obj,jy.ry_nick_name as nickName,null as buildFailReason,null as startBuildTime,null as type
  134. from fdkk_laser.t_scene s
  135. left join t_user u on s.user_id = u.id
  136. left join jy_user jy on u.id = jy.user_id
  137. WHERE s.deleted = 0 and s.status !=-1 and s.scene_source in (4,5)
  138. <if test="param.sceneName != null and param.sceneName!='' ">
  139. and s.title like concat ('%',#{param.sceneName},'%')
  140. </if>
  141. <if test="param.snCode != null and param.snCode !='' ">
  142. and s.sn_code like concat ('%',#{param.snCode},'%')
  143. </if>
  144. <if test="param.num != null and param.num !='' ">
  145. and s.scene_code like concat ('%',#{param.num},'%')
  146. </if>
  147. <if test="param.userName != null and param.userName !='' ">
  148. and s.user_name like concat ('%',#{param.userName},'%')
  149. </if>
  150. <if test="param.notUserId != null ">
  151. and u.id != #{param.notUserId}
  152. </if>
  153. <if test="param.sceneStatus != null ">
  154. and s.status = #{param.sceneStatus}
  155. </if>
  156. <if test="param.sceneSource != null and param.sceneSource.size >0">
  157. and s.scene_source in
  158. <foreach item="source" collection="param.sceneSource" open="(" separator="," close=")">
  159. #{source}
  160. </foreach>
  161. </if>
  162. <if test="param.sceneType == 0">
  163. <if test="param.userId!=null">
  164. and u.id = #{param.userId}
  165. </if>
  166. <if test="param.platformId!=null">
  167. and jy.platform_id = #{param.platformId}
  168. </if>
  169. </if>
  170. <if test="param.sceneType == 1">
  171. <if test="param.platform!= null">
  172. and jy.platform_id = #{param.platform}
  173. </if>
  174. and ( 1!=1
  175. <if test="param.otherPlatformIds != null and param.otherPlatformIds.size >0">
  176. or jy.platform_id in
  177. <foreach item="platformId" collection="param.otherPlatformIds" open="(" separator="," close=")">
  178. #{platformId}
  179. </foreach>
  180. </if>
  181. <if test="param.otherUserIds !=null and param.otherUserIds.size>0">
  182. or u.id in
  183. <foreach item="userId" collection="param.otherUserIds" open="(" separator="," close=")">
  184. #{userId}
  185. </foreach>
  186. </if>
  187. <if test="param.authNumList !=null and param.authNumList.size>0 ">
  188. or s.scene_code in
  189. <foreach item="num" collection="param.authNumList" open="(" separator="," close=")">
  190. #{num}
  191. </foreach>
  192. </if>
  193. )
  194. </if>
  195. </sql>
  196. </mapper>