SceneProMapper.xml 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 and user_id in
  6. <foreach item="userId" collection="userIdList" open="(" separator="," close=")">
  7. #{userId}
  8. </foreach>
  9. GROUP BY user_id
  10. </select>
  11. <select id="getCountGroupByCameraId" resultType="com.fdkankan.manage.vo.response.GroupByCount">
  12. 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
  13. and camera_id in
  14. <foreach item="cameraId" collection="cameraIds" open="(" separator="," close=")">
  15. #{cameraId}
  16. </foreach>
  17. GROUP BY camera_id
  18. </select>
  19. <select id="pageList" resultType="com.fdkankan.manage.vo.response.SceneVo">
  20. SELECT * FROM(
  21. select s.scene_name ,s.num,s.create_time,c.sn_code,s.space as sceneSize
  22. ,u.user_name,s.view_count,s.status,s.pay_status,'v3' as scene_version ,s.web_site as thumb
  23. ,null as algorithmTime
  24. from t_scene_pro s
  25. <include refid="commonWhere"></include>
  26. <if test="param.sceneName != null and param.sceneName!='' ">
  27. and s.scene_name like concat ('%',#{param.sceneName},'%')
  28. </if>
  29. and is_upgrade = 0
  30. UNION
  31. select s.title as sceneName ,s.num,s.create_time,c.sn_code,e.space as sceneSize
  32. ,u.user_name,e.view_count,s.scene_status as status,s.pay_status,'v4' as scene_version,e.web_site as thumb
  33. ,algorithm_time
  34. from t_scene_plus s
  35. left join t_scene_plus_ext e on s.id = e.plus_id
  36. <include refid="commonWhere"></include>
  37. <if test="param.sceneName != null and param.sceneName!='' ">
  38. and s.title like concat ('%',#{param.sceneName},'%')
  39. </if>
  40. ) as tb
  41. order by create_time desc
  42. </select>
  43. <sql id="commonWhere">
  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 c.id = d.camera_id
  47. left join t_company co on d.company_id = co.id
  48. where s.rec_status = 'A'
  49. <if test="param.snCode != null and param.snCode !='' ">
  50. and c.sn_code like concat ('%',#{param.snCode},'%')
  51. </if>
  52. <if test="param.userName != null and param.userName !='' ">
  53. and u.user_name like concat ('%',#{param.userName},'%')
  54. </if>
  55. <if test="param.type !=null and param.type == 0">
  56. and s.scene_source in (1,2,12,13,14)
  57. </if>
  58. <if test="param.type !=null and param.type == 1">
  59. and s.scene_source = 3
  60. </if>
  61. <if test="param.companyId !=null ">
  62. and co.id = #{param.companyId}
  63. </if>
  64. </sql>
  65. </mapper>