SceneProMapper.xml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. <if test="isObj !=null and isObj == 0">
  11. and scene_source in (1,2,3,12,13,14)
  12. </if>
  13. <if test="isObj !=null and isObj == 1">
  14. and is_obj = 1
  15. and scene_source = 4
  16. </if>
  17. GROUP BY user_id
  18. </select>
  19. <select id="getCountGroupByCameraId" resultType="com.fdkankan.manage.vo.response.GroupByCount">
  20. 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
  21. and scene_source in (1,2,3,12,13,14)
  22. and camera_id in
  23. <foreach item="cameraId" collection="cameraIds" open="(" separator="," close=")">
  24. #{cameraId}
  25. </foreach>
  26. GROUP BY camera_id
  27. </select>
  28. <select id="pageList" resultType="com.fdkankan.manage.vo.response.SceneVo">
  29. select s.title as sceneName ,s.num,s.create_time,c.sn_code,e.space as sceneSize
  30. ,u.user_name,e.view_count,s.scene_status as status,s.pay_status,'v4' as scene_version,e.web_site , e.thumb
  31. ,e.algorithm_time,s.user_id,jy.platform_id,s.scene_source,s.three_cam_type
  32. from t_scene_plus s
  33. left join t_scene_plus_ext e on s.id = e.plus_id
  34. left join t_user u on s.user_id = u.id
  35. left join t_camera c on s.camera_id = c.id
  36. left join jy_user jy on u.id = jy.user_id
  37. LEFT JOIN fdkk_laser.t_scene ls on s.num = ls.scene_code
  38. where
  39. <include refid="commonWhere"></include>
  40. <if test="param.sceneType == 0">
  41. <if test="param.userId!=null">
  42. and u.id = #{param.userId}
  43. </if>
  44. <if test="param.platformId!=null">
  45. and jy.platform_id = #{param.platformId}
  46. </if>
  47. </if>
  48. <if test="param.sceneType == 1">
  49. and ( 1!=1
  50. <if test="param.otherPlatformIds != null and param.otherPlatformIds.size >0">
  51. or jy.platform_id in
  52. <foreach item="platformId" collection="param.otherPlatformIds" open="(" separator="," close=")">
  53. #{platformId}
  54. </foreach>
  55. </if>
  56. <if test="param.otherUserIds !=null and param.otherUserIds.size>0">
  57. or u.id in
  58. <foreach item="userId" collection="param.otherUserIds" open="(" separator="," close=")">
  59. #{userId}
  60. </foreach>
  61. </if>
  62. <if test="param.authNumList !=null and param.authNumList.size>0 ">
  63. or s.num in
  64. <foreach item="num" collection="param.authNumList" open="(" separator="," close=")">
  65. #{num}
  66. </foreach>
  67. </if>
  68. )
  69. </if>
  70. order by create_time desc
  71. </select>
  72. <sql id="commonWhere">
  73. s.rec_status = 'A'
  74. <if test="param.sceneName != null and param.sceneName!='' ">
  75. and ( s.title like concat ('%',#{param.sceneName},'%')
  76. or ls.title like concat ('%',#{param.sceneName},'%')
  77. )
  78. </if>
  79. <if test="param.type != null and (param.type == 5 or param.type ==7)">
  80. and e.is_obj = 1
  81. </if>
  82. <if test="param.isObj != null and param.isObj == 0">
  83. and s.scene_source in (4,5)
  84. </if>
  85. <if test="param.isObj != null and param.isObj == 1">
  86. and ( e.is_obj = 1 or
  87. s.scene_source not in (4,5)
  88. )
  89. </if>
  90. <if test="param.snCode != null and param.snCode !='' ">
  91. and c.sn_code like concat ('%',#{param.snCode},'%')
  92. </if>
  93. <if test="param.num != null and param.num !='' ">
  94. and s.num like concat ('%',#{param.num},'%')
  95. </if>
  96. <if test="param.userName != null and param.userName !='' ">
  97. and u.user_name like concat ('%',#{param.userName},'%')
  98. </if>
  99. <if test="param.type !=null and param.type == 0 ">
  100. and s.scene_source in (1,2,12,13,14)
  101. and s.three_cam_type is null
  102. </if>
  103. <if test="param.type !=null and param.type == 8 ">
  104. and s.scene_source = 1
  105. and s.three_cam_type = 'yzl'
  106. </if>
  107. <if test="param.type !=null and param.type == 1">
  108. and s.scene_source = 3
  109. </if>
  110. <if test="param.type != null and (param.type == 2 or param.type ==5)">
  111. and s.scene_source = 4
  112. </if>
  113. <if test="param.type != null and (param.type == 6 or param.type ==7)">
  114. and s.scene_source = 5
  115. </if>
  116. </sql>
  117. </mapper>