SceneProMapper.xml 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 * FROM(
  30. select s.scene_name ,s.num,s.create_time,c.sn_code,s.space as sceneSize
  31. ,u.user_name,u.nick_name,s.view_count,s.status,s.pay_status,'v3' as scene_version ,s.web_site as thumb
  32. ,null as algorithmTime
  33. from t_scene_pro s
  34. <include refid="commonWhere"></include>
  35. <if test="param.sceneName != null and param.sceneName!='' ">
  36. and s.scene_name like concat ('%',#{param.sceneName},'%')
  37. </if>
  38. and is_upgrade = 0
  39. UNION
  40. select s.title as sceneName ,s.num,s.create_time,c.sn_code,e.space as sceneSize
  41. ,u.user_name,u.nick_name,e.view_count,s.scene_status as status,s.pay_status,'v4' as scene_version,e.web_site as thumb
  42. ,algorithm_time
  43. from t_scene_plus s
  44. left join t_scene_plus_ext e on s.id = e.plus_id
  45. <include refid="commonWhere"></include>
  46. <if test="param.sceneName != null and param.sceneName!='' ">
  47. and s.title like concat ('%',#{param.sceneName},'%')
  48. </if>
  49. ) as tb
  50. order by create_time desc
  51. </select>
  52. <sql id="commonWhere">
  53. left join t_user u on s.user_id = u.id
  54. left join t_camera c on s.camera_id = c.id
  55. left join t_camera_detail d on c.id = d.camera_id
  56. left join t_company co on d.company_id = co.id
  57. where s.rec_status = 'A'
  58. <if test="param.snCode != null and param.snCode !='' ">
  59. and c.sn_code like concat ('%',#{param.snCode},'%')
  60. </if>
  61. <if test="param.userName != null and param.userName !='' ">
  62. and u.user_name like concat ('%',#{param.userName},'%')
  63. </if>
  64. <if test="param.userId != null ">
  65. and s.user_id = #{param.userId}
  66. </if>
  67. <if test="param.type !=null and param.type == 0">
  68. and s.scene_source in (1,2,12,13,14)
  69. </if>
  70. <if test="param.type !=null and param.type == 1">
  71. and s.scene_source = 3
  72. </if>
  73. <if test="param.companyId !=null ">
  74. and co.id = #{param.companyId}
  75. </if>
  76. </sql>
  77. </mapper>