ScenePlusMapper.xml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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.fusion.mapper.IScenePlusMapper">
  4. <select id="groupByCameraId" resultType="com.fdkankan.fusion.response.DataGroupVo">
  5. select camera_id as groupKey ,count(1) as dataCount from t_scene_plus where rec_status = 'A' and scene_source !=6
  6. and camera_id in
  7. <foreach item="cameraId" collection="cameraIds" open="(" separator="," close=")">
  8. #{cameraId}
  9. </foreach>
  10. <if test="startTime !=null and startTime !='' ">
  11. and create_time &gt;= #{startTime}
  12. </if>
  13. <if test="endTime !=null and endTime !='' ">
  14. and create_time &lt;= #{endTime}
  15. </if>
  16. group by camera_id
  17. </select>
  18. <select id="groupByType" resultType="com.fdkankan.fusion.response.DataGroupVo">
  19. select scene_source as groupKey ,count(1) as dataCount from t_scene_plus where rec_status = 'A' and scene_source !=6
  20. and camera_id in
  21. <foreach item="cameraId" collection="cameraIds" open="(" separator="," close=")">
  22. #{cameraId}
  23. </foreach>
  24. <if test="startTime !=null and startTime !='' ">
  25. and create_time &gt;= #{startTime}
  26. </if>
  27. <if test="endTime !=null and endTime !='' ">
  28. and create_time &lt;= #{endTime}
  29. </if>
  30. group by scene_source
  31. </select>
  32. <select id="sceneList" resultType="com.fdkankan.fusion.response.SceneVo">
  33. <include refid="commonSelect"></include>
  34. </select>
  35. <select id="sceneListPage" resultType="com.fdkankan.fusion.response.SceneVo">
  36. <include refid="commonSelect"></include>
  37. </select>
  38. <sql id="commonSelect">
  39. select s.id,s.title as title,s.title as name ,s.title as sceneName, s.num,s.create_time,c.sn_code,e.space as sceneSize
  40. ,u.user_name,e.view_count,s.scene_status as status,s.pay_status,'v4' as scene_version,e.web_site , e.thumb
  41. ,e.algorithm_time,s.user_id,s.scene_source,e.is_obj,d.type as cameraType,e.rtk_location,e.orientation,e.location,laser_title
  42. from t_scene_plus s
  43. left join t_scene_plus_ext e on s.id = e.plus_id
  44. left join t_user u on s.user_id = u.id
  45. left join t_camera c on s.camera_id = c.id
  46. left join t_camera_detail d on s.camera_id = d.camera_id
  47. WHERE s.rec_status = 'A' and s.camera_id is not null
  48. and s.scene_source !=6
  49. <if test="param.isObj != null and param.isObj==0">
  50. and s.scene_source in (4,5,7)
  51. </if>
  52. <if test="param.isObj != null and param.isObj==1">
  53. and ( s.scene_source in (4,5) and e.is_obj = 1 or s.scene_source not in (4,5,7) )
  54. </if>
  55. <if test="param.isObj ==1 and param.sceneName != null and param.sceneName!='' ">
  56. and s.title like concat ('%',#{param.sceneName},'%')
  57. </if>
  58. <if test="param.isObj ==0 and param.sceneName != null and param.sceneName!='' ">
  59. and s.laser_title like concat ('%',#{param.sceneName},'%')
  60. </if>
  61. <if test="param.snCode != null and param.snCode !='' ">
  62. and c.sn_code like concat ('%',#{param.snCode},'%')
  63. </if>
  64. <if test="param.num != null and param.num !='' ">
  65. and s.num like concat ('%',#{param.num},'%')
  66. </if>
  67. <if test="param.status != null ">
  68. and s.scene_status = #{param.status}
  69. </if>
  70. <if test="param.sceneStatus != null ">
  71. and s.scene_status = #{param.sceneStatus}
  72. </if>
  73. <if test="param.cameraType!= null">
  74. and d.type = #{param.cameraType}
  75. </if>
  76. <if test="param.snCodes!= null and param.snCodes.size >0">
  77. and c.sn_code in
  78. <foreach item="snCode" collection="param.snCodes" open="(" separator="," close=")">
  79. #{snCode}
  80. </foreach>
  81. </if>
  82. <if test="param.numList!= null and param.numList.size >0">
  83. and s.num in
  84. <foreach item="num" collection="param.numList" open="(" separator="," close=")">
  85. #{num}
  86. </foreach>
  87. </if>
  88. ORDER BY create_time desc,id asc
  89. </sql>
  90. </mapper>