SceneProMapper.xml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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.scene_source
  26. from t_scene_pro s
  27. <include refid="commonWhere"></include>
  28. <if test="param.sceneName != null and param.sceneName!='' ">
  29. and s.scene_name like concat ('%',#{param.sceneName},'%')
  30. </if>
  31. and is_upgrade = 0
  32. UNION ALL
  33. select s.title as sceneName ,s.num,s.create_time,e.space as sceneSize
  34. ,e.view_count,s.scene_status as status,s.pay_status,'v4' as scene_version,e.web_site,e.thumb
  35. ,algorithm_time,data_source,e.shoot_count,e.gps,s.user_id,s.camera_id,s.scene_source
  36. from t_scene_plus s
  37. left join t_scene_plus_ext e on s.id = e.plus_id
  38. <include refid="commonWhere"></include>
  39. <if test="param.sceneName != null and param.sceneName!='' ">
  40. and s.title like concat ('%',#{param.sceneName},'%')
  41. </if>
  42. ) as tb
  43. order by ${param.field} ${param.order}
  44. </select>
  45. <sql id="commonWhere">
  46. where s.rec_status = 'A'
  47. <if test="param.cameraIds !=null and param.cameraIds.size >0">
  48. and s.camera_id in
  49. <foreach item="cameraId" collection="param.cameraIds" open="(" separator="," close=")">
  50. #{cameraId}
  51. </foreach>
  52. </if>
  53. <if test="param.userIds !=null and param.userIds.size >0">
  54. and s.user_id in
  55. <foreach item="userId" collection="param.userIds" open="(" separator="," close=")">
  56. #{userId}
  57. </foreach>
  58. </if>
  59. <if test="param.numList !=null and param.numList.size >0">
  60. and s.num in
  61. <foreach item="num" collection="param.numList" open="(" separator="," close=")">
  62. #{num}
  63. </foreach>
  64. </if>
  65. <if test="param.type !=null and param.type == 0">
  66. and s.scene_source in (1,2,12,13,14)
  67. </if>
  68. <if test="param.type !=null and param.type == 1">
  69. and s.scene_source = 3
  70. </if>
  71. <if test="param.type !=null and param.type == 2">
  72. and s.scene_source = 4
  73. </if>
  74. <if test="param.type !=null and param.type == 5">
  75. and s.scene_source = 4 and is_obj = 1
  76. </if>
  77. <if test="param.type !=null and param.type == 6">
  78. and s.scene_source = 5
  79. </if>
  80. <if test="param.type !=null and param.type == 7">
  81. and s.scene_source = 5 and is_obj = 1
  82. </if>
  83. <if test="param.type !=null and param.type == 36">
  84. and s.scene_source = 36
  85. </if>
  86. <if test="param.num !=null and param.num !='' ">
  87. and s.num like concat ('%',#{param.num},'%')
  88. </if>
  89. <if test="param.startTime !=null and param.startTime !='' ">
  90. and s.create_time &gt;= #{param.startTime}
  91. </if>
  92. <if test="param.endTime !=null and param.endTime !='' ">
  93. and s.create_time &lt;= #{param.endTime}
  94. </if>
  95. </sql>
  96. <select id="getProSpaceGroupByCameraId" resultType="com.fdkankan.manage.vo.response.GroupByCount">
  97. SELECT camera_id as id,sum(space) as count FROM t_scene_pro
  98. WHERE rec_status = 'A' and is_upgrade = 0 GROUP BY camera_id
  99. </select>
  100. <select id="getPlusSpaceGroupByCameraId" resultType="com.fdkankan.manage.vo.response.GroupByCount">
  101. 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
  102. WHERE p.rec_status = 'A' GROUP BY p.camera_id
  103. </select>
  104. <select id="getSpaceSumByCameraId" resultType="java.lang.Long">
  105. select sum(space) from t_scene_pro where rec_status= 'A' and status = -2 and is_upgrade = 0 and camera_id = #{cameraId}
  106. </select>
  107. </mapper>