SceneProMapper.xml 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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.agent.mapper.ISceneProMapper">
  4. <select id="pageList" resultType="com.fdkankan.agent.response.SceneVo">
  5. SELECT * FROM(
  6. select s.scene_name ,s.num,s.create_time,c.sn_code,s.space as sceneSize
  7. ,u.user_name,s.view_count,s.status,s.pay_status,'v3' as scene_version ,s.web_site as thumb
  8. ,null as algorithmTime
  9. from t_scene_pro s
  10. <include refid="commonWhere"></include>
  11. <if test="param.sceneName != null and param.sceneName!='' ">
  12. and s.scene_name like concat ('%',#{param.sceneName},'%')
  13. </if>
  14. and is_upgrade = 0
  15. UNION
  16. select s.title as sceneName ,s.num,s.create_time,c.sn_code,e.space as sceneSize
  17. ,u.user_name,e.view_count,s.scene_status as status,s.pay_status,'v4' as scene_version,e.web_site as thumb
  18. ,algorithm_time
  19. from t_scene_plus s
  20. left join t_scene_plus_ext e on s.id = e.plus_id
  21. <include refid="commonWhere"></include>
  22. <if test="param.sceneName != null and param.sceneName!='' ">
  23. and s.title like concat ('%',#{param.sceneName},'%')
  24. </if>
  25. ) as tb
  26. order by create_time desc
  27. </select>
  28. <sql id="commonWhere">
  29. left join t_user u on s.user_id = u.id
  30. left join t_camera c on s.camera_id = c.id
  31. left join t_camera_detail d on c.id = d.camera_id
  32. left join t_company co on d.company_id = co.id
  33. where s.rec_status = 'A' and d.agent_id = #{param.agentId}
  34. <if test="param.snCode != null and param.snCode !='' ">
  35. and c.sn_code like concat ('%',#{param.snCode},'%')
  36. </if>
  37. <if test="param.userName != null and param.userName !='' ">
  38. and u.user_name like concat ('%',#{param.userName},'%')
  39. </if>
  40. <if test="param.type !=null and param.type == 0">
  41. and s.scene_source in (1,2,12,13,14)
  42. </if>
  43. <if test="param.type !=null and param.type == 1">
  44. and s.scene_source = 3
  45. </if>
  46. <if test="param.companyId !=null ">
  47. and co.id = #{param.companyId}
  48. </if>
  49. <if test="param.agentId !=null ">
  50. and d.agent_id = #{param.agentId}
  51. </if>
  52. </sql>
  53. </mapper>