SceneProMapper.xml 7.1 KB

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