SceneProMapper.xml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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_jp.mapper.ISceneProMapper">
  4. <sql id="folderSelect">
  5. select f.id, f.name as sceneName,null as num ,f.create_time,null as sn_code,null as sceneSize
  6. ,null as user_name,null as view_count,null as status,null as pay_status,null as scene_version,null as webSite,null as thumb
  7. ,null as algorithmTime,null as child_name,null as camera_id,null as laser_title,co.company_name,null as location,null as scene_source,null as shoot_count,null as map_show
  8. ,1 as sort_order,1 as isFolder
  9. from t_manage_folder f
  10. left join t_company co on f.company_id = co.id
  11. where f.rec_status = 'A'
  12. <if test="param.type !=null ">
  13. and f.type = #{param.type}
  14. </if>
  15. <if test="param.folderId !=null ">
  16. and f.parent_id = #{param.folderId}
  17. </if>
  18. <if test="param.folderId == null">
  19. AND f.parent_id is null
  20. </if>
  21. <if test="param.companyId != null">
  22. AND f.company_id =#{param.companyId}
  23. </if>
  24. <if test="param.companyName !=null and param.companyName !='' ">
  25. and co.company_name like concat ('%',#{param.companyName},'%')
  26. </if>
  27. <if test="param.sceneName != null and param.sceneName!='' ">
  28. and f.name like concat ('%',#{param.sceneName},'%')
  29. </if>
  30. </sql>
  31. <select id="pageListFolder" resultType="com.fdkankan.manage_jp.vo.response.SceneVo">
  32. <include refid="folderSelect"></include>
  33. order by sort_order asc, create_time desc ,id desc
  34. </select>
  35. <select id="pageList" resultType="com.fdkankan.manage_jp.vo.response.SceneVo">
  36. SELECT * FROM(
  37. <if test="param.haveFolder != null and param.haveFolder ==1">
  38. <include refid="folderSelect"></include>
  39. UNION
  40. </if>
  41. <include refid="selectScene"></include>
  42. order by sort_order asc, create_time desc ,id desc
  43. </select>
  44. <sql id="selectScene">
  45. select s.id,s.scene_name ,s.num,s.create_time,c.sn_code,s.space as sceneSize
  46. ,u.user_name,s.view_count,s.status,s.pay_status,'v3' as scene_version ,s.web_site as webSite,thumb
  47. ,null as algorithmTime,c.child_name,s.camera_id,s.laser_title,co.company_name,null as location,s.scene_source,s.shoot_count,s.map_show
  48. ,2 as sort_order,0 as isFolder
  49. from t_scene_pro s
  50. <include refid="commonWhere"></include>
  51. <if test="param.isLaserScene ==0 and param.sceneName != null and param.sceneName!='' ">
  52. and s.scene_name like concat ('%',#{param.sceneName},'%')
  53. </if>
  54. <if test="param.isLaserScene ==1 and param.sceneName != null and param.sceneName!='' ">
  55. and s.laser_title like concat ('%',#{param.sceneName},'%')
  56. </if>
  57. <if test="param.status != null ">
  58. and s.status = #{param.status}
  59. </if>
  60. and is_upgrade = 0
  61. UNION
  62. select s.id, s.title as sceneName ,s.num,s.create_time,c.sn_code,e.space as sceneSize
  63. ,u.user_name,e.view_count,s.scene_status as status,s.pay_status,'v4' as scene_version,e.web_site as webSite,thumb
  64. ,algorithm_time,c.child_name,s.camera_id,s.laser_title,co.company_name,e.location,s.scene_source,e.shoot_count,s.map_show
  65. ,3 as sort_order,0 as isFolder
  66. from t_scene_plus s
  67. left join t_scene_plus_ext e on s.id = e.plus_id
  68. <include refid="commonWhere"></include>
  69. <if test="param.isLaserScene ==0 and param.sceneName != null and param.sceneName!='' ">
  70. and s.scene_name like concat ('%',#{param.sceneName},'%')
  71. </if>
  72. <if test="param.isLaserScene ==1 and param.sceneName != null and param.sceneName!='' ">
  73. and s.laser_title like concat ('%',#{param.sceneName},'%')
  74. </if>
  75. <if test="param.status != null ">
  76. and s.scene_status = #{param.status}
  77. </if>
  78. ) as tb
  79. </sql>
  80. <sql id="commonWhere">
  81. left join t_user u on s.user_id = u.id
  82. left join t_camera c on s.camera_id = c.id
  83. left join t_camera_detail d on c.id = d.camera_id
  84. left join t_company co on u.company_id = co.id
  85. where s.rec_status = 'A'
  86. <if test="param.num != null and param.num !='' ">
  87. and s.num like concat ('%',#{param.num},'%')
  88. </if>
  89. <if test="param.childName != null and param.childName !='' ">
  90. and c.child_name like concat ('%',#{param.childName},'%')
  91. </if>
  92. <if test="param.neStatus != null ">
  93. and s.pay_status !=#{param.neStatus}
  94. </if>
  95. <if test="param.isLaser !=null and param.isLaser == 1">
  96. and s.scene_source in (4,5,57)
  97. </if>
  98. <if test="param.isLaser !=null and param.isLaser == 0">
  99. and s.scene_source not in (4,5)
  100. </if>
  101. <if test="param.type !=null and param.type == 0">
  102. and s.scene_source in (1,2,12,13,14)
  103. </if>
  104. <if test="param.type !=null and param.type == 1">
  105. and s.scene_source = 3
  106. </if>
  107. <if test="param.type !=null and param.type == 2">
  108. and s.scene_source = 4
  109. </if>
  110. <if test="param.type !=null and param.type == 4">
  111. and s.scene_source = 4 and is_obj = 1
  112. </if>
  113. <if test="param.type !=null and param.type == 5">
  114. and s.scene_source = 5
  115. </if>
  116. <if test="param.type !=null and param.type == 6">
  117. and s.scene_source = 5 and is_obj = 1
  118. </if>
  119. <if test="param.type !=null and param.type == 57">
  120. and s.scene_source = 57
  121. </if>
  122. <if test="param.type !=null and param.type == 58">
  123. and s.scene_source = 57 and is_obj = 1
  124. </if>
  125. <if test="param.mapShow !=null ">
  126. and s.map_show = #{param.mapShow}
  127. </if>
  128. <if test="param.companyName !=null and param.companyName !='' ">
  129. and co.company_name like concat ('%',#{param.companyName},'%')
  130. </if>
  131. <if test="param.userId !=null and param.companyId !=null and param.cooperateSceneCodes !=null and param.cooperateSceneCodes.size >0">
  132. and ( s.user_id = #{param.userId} or co.id = #{param.companyId} or s.num in
  133. <foreach collection="param.cooperateSceneCodes" item="coNum" open="(" separator="," close=")">
  134. #{coNum}
  135. </foreach>
  136. )
  137. </if>
  138. <if test="param.userId !=null and param.companyId !=null and param.cooperateSceneCodes !=null and param.cooperateSceneCodes.size ==0 ">
  139. and (co.id = #{param.companyId} or s.user_id = #{param.userId} )
  140. </if>
  141. <if test="param.projectNums !=null and param.projectNums.size >0">
  142. and s.num in
  143. <foreach collection="param.projectNums" item="num" open="(" separator="," close=")">
  144. #{num}
  145. </foreach>
  146. </if>
  147. <if test="param.folderInNums !=null and param.folderInNums.size >0">
  148. and s.num in
  149. <foreach collection="param.folderInNums" item="num" open="(" separator="," close=")">
  150. #{num}
  151. </foreach>
  152. </if>
  153. <if test="param.folderNoInNums !=null and param.folderNoInNums.size >0">
  154. and s.num not in
  155. <foreach collection="param.folderNoInNums" item="num" open="(" separator="," close=")">
  156. #{num}
  157. </foreach>
  158. </if>
  159. </sql>
  160. </mapper>