ScenePlusMapper.xml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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.ucenter.mapper.IScenePlusMapper">
  4. <sql id="commonWhere">
  5. left join t_user u on p.user_id = u.id
  6. left join t_camera c on p.camera_id = c.id
  7. left join t_camera_detail d on c.id = d.camera_id
  8. where p.rec_status = 'A' AND p.scene_type != 99
  9. and p.num not in (select num from t_scene_not_display where rec_status= 'A')
  10. <if test="param.sceneType !=null and param.sceneType !=''">
  11. and p.scene_type = #{param.sceneType}
  12. </if>
  13. <if test= 'param.cameraType != null' >
  14. and d.type = #{param.cameraType}
  15. </if>
  16. <if test="param.copyNumSet !=null and param.copyNumSet.size >0">
  17. and p.num not in
  18. <foreach collection="param.copyNumSet" item="num" open="(" separator="," close=")">
  19. #{num}
  20. </foreach>
  21. </if>
  22. <if test="param.cameraId != null and param.userId !=null and param.cooperationNumList !=null and param.cooperationNumList.size >0">
  23. and ( p.camera_id = #{param.cameraId} or p.user_id = #{param.userId} or p.num in
  24. <foreach collection="param.cooperationNumList" item="coNum" open="(" separator="," close=")">
  25. #{coNum}
  26. </foreach>
  27. )
  28. </if>
  29. <if test="param.cameraId != null and param.userId !=null and param.cooperationNumList !=null and param.cooperationNumList.size ==0 ">
  30. and ( p.camera_id = #{param.cameraId} or p.user_id = #{param.userId} )
  31. </if>
  32. <if test="param.cameraId != null and param.userId ==null and param.cooperationNumList !=null and param.cooperationNumList.size ==0 ">
  33. and p.camera_id = #{param.cameraId}
  34. </if>
  35. <if test="param.cameraId != null and param.userId ==null and param.cooperationNumList !=null and param.cooperationNumList.size >0 ">
  36. and ( p.camera_id = #{param.cameraId} or p.num in
  37. <foreach collection="param.cooperationNumList" item="coNum" open="(" separator="," close=")">
  38. #{coNum}
  39. </foreach>
  40. )
  41. </if>
  42. <if test="param.cameraId == null and param.userId !=null and param.cooperationNumList !=null and param.cooperationNumList.size ==0 ">
  43. and p.user_id = #{param.userId}
  44. </if>
  45. <if test="param.cameraId == null and param.userId !=null and param.cooperationNumList !=null and param.cooperationNumList.size >0 ">
  46. and ( p.user_id = #{param.userId} or p.num in
  47. <foreach collection="param.cooperationNumList" item="coNum" open="(" separator="," close=")">
  48. #{coNum}
  49. </foreach>
  50. )
  51. </if>
  52. </sql>
  53. <select id="pageList" resultType="com.fdkankan.ucenter.vo.response.AppSceneVo">
  54. SELECT p.id ,null as name ,0 as isFolder,null as type,null as parentId ,p.create_time,num,scene_name,scene_dec,
  55. p.status,pay_status,thumb,web_site,0 as is_upgrade,view_count,
  56. p.camera_id,p.user_id ,p.data_source,p.scene_type,build_type,c.sn_code,c.child_name,4 as location
  57. FROM t_scene_pro p
  58. <include refid="commonWhere"></include>
  59. and is_upgrade = 0 AND ( p.status = 1 OR p.status = -2)
  60. <if test="param.sceneName !=null and param.sceneName !=''">
  61. and p.scene_name like CONCAT('%',#{param.sceneName},'%')
  62. </if>
  63. UNION
  64. SELECT p.id as id ,null as name ,0 as isFolder,null as type,null as parentId,p.create_time ,num,title as scene_name,description as scene_dec,
  65. scene_status as status,pay_status,thumb,web_site,1 as is_upgrade,view_count,
  66. p.camera_id,p.user_id,e.data_source,p.scene_type,build_type,c.sn_code,c.child_name,e.location
  67. FROM t_scene_plus p
  68. LEFT JOIN t_scene_plus_ext e on p.id = e.plus_id
  69. <include refid="commonWhere"></include>
  70. <if test="param.queryVrPano !=null and param.queryVrPano == false">
  71. and (e.location != 7 or e.location is null )
  72. </if>
  73. AND ( p.scene_status = 1 OR p.scene_status = -2)
  74. <if test="param.sceneName !=null and param.sceneName !=''">
  75. and p.title like CONCAT('%',#{param.sceneName},'%')
  76. </if>
  77. <if test="param.orderBy !=null and param.orderBy !=''">
  78. ORDER BY ${param.orderBy}
  79. </if>
  80. <if test="param.orderBy ==null or param.orderBy ==''">
  81. ORDER BY create_time desc
  82. </if>
  83. </select>
  84. <select id="getCountByUserId" resultType="java.lang.Long">
  85. select count(*) from t_scene_plus s left join t_camera_detail d on s.camera_id = d.camera_id
  86. where s.rec_status = 'A'
  87. and s.user_id = #{userId} and d.type = #{cameraType}
  88. </select>
  89. <select id="getSpaceSumByCameraId" resultType="java.lang.Long">
  90. select sum(space) from t_scene_plus p left join t_scene_plus_ext e on p.id = e.plus_id where p.rec_status = 'A' and p.scene_status = -2 and p.camera_id = #{cameraId}
  91. </select>
  92. <select id="getGroupBySceneSouceV4" resultType="com.fdkankan.ucenter.vo.response.SceneNumVo">
  93. SELECT scene_source as type,count(1) as sceneNum,s.is_obj from t_scene_pro s
  94. WHERE s.rec_status = 'A' and s.is_upgrade = 0
  95. GROUP BY scene_source,is_obj
  96. </select>
  97. <select id="getGroupBySceneSouceV3" resultType="com.fdkankan.ucenter.vo.response.SceneNumVo">
  98. SELECT scene_source as type,count(1) as sceneNum,e.is_obj from t_scene_plus s LEFT JOIN t_scene_plus_ext e on s.id = e.plus_id
  99. WHERE s.rec_status = 'A' and s.user_id = #{userId}
  100. GROUP BY scene_source,is_obj
  101. </select>
  102. <select id="getCountByUserIdAndSceneSource" resultType="com.fdkankan.ucenter.entity.ScenePlus">
  103. select s.* from t_scene_plus s LEFT JOIN t_scene_plus_ext e on s.id = e.plus_id
  104. WHERE s.rec_status = 'A' and s.user_id = #{userId}
  105. and s.scene_source in
  106. <foreach collection="sceneSourceList" item="sceneSource" open="(" separator="," close=")">
  107. #{sceneSource}
  108. </foreach>
  109. <if test="isObj != null and isObj==1 ">
  110. and e.is_obj = 1
  111. </if>
  112. </select>
  113. <select id="pageLaserScene" resultType="com.fdkankan.ucenter.vo.RelicsSceneInitQueueDTO">
  114. select * from t_scene_plus s LEFT JOIN t_scene_plus_ext e on s.id = e.plus_id
  115. WHERE s.rec_status = 'A' and s.user_id = #{param.userId}
  116. <if test="param.sceneSource !=null">
  117. and s.scene_source = #{param.sceneSource}
  118. </if>
  119. <if test="param.location !=null">
  120. and e.location = #{param.location}
  121. </if>
  122. <if test="param.title !=null and param.title !=''">
  123. and s.title like CONCAT('%',#{param.title},'%')
  124. </if>
  125. <if test="param.num !=null and param.num != ''">
  126. and s.num = #{param.num}
  127. </if>
  128. order by s.create_time desc
  129. </select>
  130. </mapper>