SceneProMapper.xml 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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_jp.mapper.ISceneProMapper">
  4. <select id="pageList" resultType="com.fdkankan.manage_jp.vo.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 webSite,thumb
  8. ,null as algorithmTime,c.child_name,s.camera_id,s.laser_title,co.company_name,null as location,s.scene_source,s.shoot_count
  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},'%') or s.laser_title 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 webSite,thumb
  18. ,algorithm_time,c.child_name,s.camera_id,s.laser_title,co.company_name,e.location,s.scene_source,e.shoot_count
  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},'%') or s.laser_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 u.company_id = co.id
  33. where s.rec_status = 'A'
  34. <if test="param.childName != null and param.childName !='' ">
  35. and c.child_name like concat ('%',#{param.childName},'%')
  36. </if>
  37. <if test="param.neStatus != null ">
  38. and s.pay_status !=#{param.neStatus}
  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.type !=null and param.type == 2">
  47. and s.scene_source = 4
  48. </if>
  49. <if test="param.type !=null and param.type == 4">
  50. and s.scene_source = 4 and is_obj = 1
  51. </if>
  52. <if test="param.type !=null and param.type == 5">
  53. and s.scene_source = 5
  54. </if>
  55. <if test="param.type !=null and param.type == 6">
  56. and s.scene_source = 5 and is_obj = 1
  57. </if>
  58. <if test="param.companyName !=null and param.companyName !='' ">
  59. and co.company_name like concat ('%',#{param.companyName},'%')
  60. </if>
  61. <if test="param.userId !=null and param.companyId !=null and param.cooperateSceneCodes !=null and param.cooperateSceneCodes.size >0">
  62. and ( s.user_id = #{param.userId} or co.id = #{param.companyId} or s.num in
  63. <foreach collection="param.cooperateSceneCodes" item="coNum" open="(" separator="," close=")">
  64. #{coNum}
  65. </foreach>
  66. )
  67. </if>
  68. <if test="param.userId !=null and param.companyId !=null and param.cooperateSceneCodes !=null and param.cooperateSceneCodes.size ==0 ">
  69. and (co.id = #{param.companyId} or s.user_id = #{param.userId} )
  70. </if>
  71. </sql>
  72. </mapper>