ScenePlusMapper.xml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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'
  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'
  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="selectMesh" resultType="com.fdkankan.fusion.response.SceneVo">
  33. <include refid="selectMesh"></include>
  34. order by create_time desc
  35. </select>
  36. <select id="selectLaser" resultType="com.fdkankan.fusion.response.SceneVo">
  37. <include refid="selectLaser"></include>
  38. order by shoot_time desc
  39. </select>
  40. <select id="pageList2" resultType="com.fdkankan.fusion.response.SceneVo">
  41. <include refid="selectMesh"></include>
  42. UNION all
  43. <include refid="selectLaser"></include>
  44. ORDER BY create_time desc
  45. </select>
  46. <sql id="selectMesh">
  47. select s.id,'4dkankan' as sceneType,s.title as sceneName ,s.num,s.create_time,c.sn_code,e.space as sceneSize
  48. ,u.user_name,e.view_count,s.scene_status as status,s.pay_status,'v4' as scene_version,e.web_site , e.thumb
  49. ,e.algorithm_time,s.user_id,s.scene_source,e.is_obj
  50. from t_scene_plus s
  51. left join t_scene_plus_ext e on s.id = e.plus_id
  52. left join t_user u on s.user_id = u.id
  53. left join t_camera c on s.camera_id = c.id
  54. WHERE s.rec_status = 'A' and
  55. ( s.scene_source in (4,5) and e.is_obj = 1 or s.scene_source not in (4,5,57) )
  56. <if test="param.sceneName != null and param.sceneName!='' ">
  57. and s.title like concat ('%',#{param.sceneName},'%')
  58. </if>
  59. <if test="param.snCode != null and param.snCode !='' ">
  60. and c.sn_code like concat ('%',#{param.snCode},'%')
  61. </if>
  62. <if test="param.num != null and param.num !='' ">
  63. and s.num like concat ('%',#{param.num},'%')
  64. </if>
  65. <if test="param.sceneSource != null and param.sceneSource.size >0">
  66. and s.scene_source in
  67. <foreach item="source" collection="param.sceneSource" open="(" separator="," close=")">
  68. #{source}
  69. </foreach>
  70. </if>
  71. <if test="param.userId!=null">
  72. and u.id = #{param.userId}
  73. </if>
  74. <if test="param.numList != null and param.numList.size >0">
  75. and s.num in
  76. <foreach item="num" collection="param.numList" open="(" separator="," close=")">
  77. #{num}
  78. </foreach>
  79. </if>
  80. </sql>
  81. <sql id="selectLaser">
  82. SELECT s.id,'laser' as sceneType, s.title as sceneName,s.scene_code as num,s.shoot_time as createTime,s.sn_code,s.space as scennSize,s.user_name,s.view_count,s.status,
  83. s.pay_status,'v4' as scene_version,s.web_site,s.init_pic as thumb,s.algorithm_time,s.user_id,s.scene_source ,null as is_obj
  84. from fdkk_laser.t_scene s
  85. left join t_user u on s.user_id = u.id
  86. WHERE s.deleted = 0 and s.status !=-1 and s.scene_source in (4,5)
  87. <if test="param.sceneName != null and param.sceneName!='' ">
  88. and s.title like concat ('%',#{param.sceneName},'%')
  89. </if>
  90. <if test="param.snCode != null and param.snCode !='' ">
  91. and s.sn_code like concat ('%',#{param.snCode},'%')
  92. </if>
  93. <if test="param.num != null and param.num !='' ">
  94. and s.scene_code like concat ('%',#{param.num},'%')
  95. </if>
  96. <if test="param.sceneSource != null and param.sceneSource.size >0">
  97. and s.scene_source in
  98. <foreach item="source" collection="param.sceneSource" open="(" separator="," close=")">
  99. #{source}
  100. </foreach>
  101. </if>
  102. <if test="param.numList != null and param.numList.size >0">
  103. and s.scene_code in
  104. <foreach item="num" collection="param.numList" open="(" separator="," close=")">
  105. #{num}
  106. </foreach>
  107. </if>
  108. <if test="param.userId!=null">
  109. and u.id = #{param.userId}
  110. </if>
  111. </sql>
  112. </mapper>