12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.fdkankan.manage_jp.mapper.ISceneProMapper">
- <select id="pageList" resultType="com.fdkankan.manage_jp.vo.response.SceneVo">
- SELECT * FROM(
- select s.scene_name ,s.num,s.create_time,c.sn_code,s.space as sceneSize
- ,u.user_name,s.view_count,s.status,s.pay_status,'v3' as scene_version ,s.web_site as webSite,thumb
- ,null as algorithmTime,c.child_name,s.camera_id,s.laser_title,co.company_name,null as location,s.scene_source,s.shoot_count
- from t_scene_pro s
- <include refid="commonWhere"></include>
- <if test="param.sceneName != null and param.sceneName!='' ">
- and (s.scene_name like concat ('%',#{param.sceneName},'%') or s.laser_title like concat ('%',#{param.sceneName},'%') )
- </if>
- and is_upgrade = 0
- UNION
- select s.title as sceneName ,s.num,s.create_time,c.sn_code,e.space as sceneSize
- ,u.user_name,e.view_count,s.scene_status as status,s.pay_status,'v4' as scene_version,e.web_site as webSite,thumb
- ,algorithm_time,c.child_name,s.camera_id,s.laser_title,co.company_name,e.location,s.scene_source,e.shoot_count
- from t_scene_plus s
- left join t_scene_plus_ext e on s.id = e.plus_id
- <include refid="commonWhere"></include>
- <if test="param.sceneName != null and param.sceneName!='' ">
- and (s.title like concat ('%',#{param.sceneName},'%') or s.laser_title like concat ('%',#{param.sceneName},'%') )
- </if>
- ) as tb
- order by create_time desc
- </select>
- <sql id="commonWhere">
- left join t_user u on s.user_id = u.id
- left join t_camera c on s.camera_id = c.id
- left join t_camera_detail d on c.id = d.camera_id
- left join t_company co on u.company_id = co.id
- where s.rec_status = 'A'
- <if test="param.childName != null and param.childName !='' ">
- and c.child_name like concat ('%',#{param.childName},'%')
- </if>
- <if test="param.neStatus != null ">
- and s.pay_status !=#{param.neStatus}
- </if>
- <if test="param.type !=null and param.type == 0">
- and s.scene_source in (1,2,12,13,14)
- </if>
- <if test="param.type !=null and param.type == 1">
- and s.scene_source = 3
- </if>
- <if test="param.type !=null and param.type == 2">
- and s.scene_source = 4
- </if>
- <if test="param.type !=null and param.type == 4">
- and s.scene_source = 4 and is_obj = 1
- </if>
- <if test="param.type !=null and param.type == 5">
- and s.scene_source = 5
- </if>
- <if test="param.type !=null and param.type == 6">
- and s.scene_source = 5 and is_obj = 1
- </if>
- <if test="param.companyName !=null and param.companyName !='' ">
- and co.company_name like concat ('%',#{param.companyName},'%')
- </if>
- <if test="param.userId !=null and param.companyId !=null and param.cooperateSceneCodes !=null and param.cooperateSceneCodes.size >0">
- and ( s.user_id = #{param.userId} or co.id = #{param.companyId} or s.num in
- <foreach collection="param.cooperateSceneCodes" item="coNum" open="(" separator="," close=")">
- #{coNum}
- </foreach>
- )
- </if>
- <if test="param.userId !=null and param.companyId !=null and param.cooperateSceneCodes !=null and param.cooperateSceneCodes.size ==0 ">
- and (co.id = #{param.companyId} or s.user_id = #{param.userId} )
- </if>
- <if test="param.projectNums !=null and param.projectNums.size >0">
- and s.num in
- <foreach collection="param.projectNums" item="num" open="(" separator="," close=")">
- #{num}
- </foreach>
- )
- </if>
- </sql>
- </mapper>
|