| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- <?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">
- <sql id="folderSelect">
- select f.id, f.name as sceneName,null as num ,f.create_time,null as sn_code,null as sceneSize
- ,null as user_name,null as view_count,null as status,null as pay_status,null as scene_version,null as webSite,null as thumb
- ,null as algorithmTime,null as child_name,null as camera_id,null as laser_title,co.company_name,null as location,null as scene_source,null as shoot_count,null as map_show
- ,1 as sort_order,1 as isFolder
- from t_manage_folder f
- left join t_company co on f.company_id = co.id
- where f.rec_status = 'A'
- <if test="param.type !=null ">
- and f.type = #{param.type}
- </if>
- <if test="param.folderId !=null ">
- and f.parent_id = #{param.folderId}
- </if>
- <if test="param.folderId == null">
- AND f.parent_id is null
- </if>
- <if test="param.companyId != null">
- AND f.company_id =#{param.companyId}
- </if>
- <if test="param.companyName !=null and param.companyName !='' ">
- and co.company_name like concat ('%',#{param.companyName},'%')
- </if>
- <if test="param.sceneName != null and param.sceneName!='' ">
- and f.name like concat ('%',#{param.sceneName},'%')
- </if>
- </sql>
- <select id="pageListFolder" resultType="com.fdkankan.manage_jp.vo.response.SceneVo">
- <include refid="folderSelect"></include>
- order by sort_order asc, create_time desc ,id desc
- </select>
- <select id="pageList" resultType="com.fdkankan.manage_jp.vo.response.SceneVo">
- SELECT * FROM(
- <if test="param.haveFolder != null and param.haveFolder ==1">
- <include refid="folderSelect"></include>
- UNION
- </if>
- <include refid="selectScene"></include>
- order by sort_order asc, create_time desc ,id desc
- </select>
- <sql id="selectScene">
- select s.id,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,s.map_show
- ,2 as sort_order,0 as isFolder
- from t_scene_pro s
- <include refid="commonWhere"></include>
- <if test="param.isLaserScene ==0 and param.sceneName != null and param.sceneName!='' ">
- and s.scene_name like concat ('%',#{param.sceneName},'%')
- </if>
- <if test="param.isLaserScene ==1 and param.sceneName != null and param.sceneName!='' ">
- and s.laser_title like concat ('%',#{param.sceneName},'%')
- </if>
- <if test="param.status != null ">
- and s.status = #{param.status}
- </if>
- and is_upgrade = 0
- UNION
- select s.id, 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,s.map_show
- ,3 as sort_order,0 as isFolder
- 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.isLaserScene ==0 and param.sceneName != null and param.sceneName!='' ">
- and s.scene_name like concat ('%',#{param.sceneName},'%')
- </if>
- <if test="param.isLaserScene ==1 and param.sceneName != null and param.sceneName!='' ">
- and s.laser_title like concat ('%',#{param.sceneName},'%')
- </if>
- <if test="param.status != null ">
- and s.scene_status = #{param.status}
- </if>
- ) as tb
- </sql>
- <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.num != null and param.num !='' ">
- and s.num like concat ('%',#{param.num},'%')
- </if>
- <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.isLaser !=null and param.isLaser == 1">
- and s.scene_source in (4,5,57)
- </if>
- <if test="param.isLaser !=null and param.isLaser == 0">
- and s.scene_source not in (4,5)
- </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.type !=null and param.type == 57">
- and s.scene_source = 57
- </if>
- <if test="param.type !=null and param.type == 58">
- and s.scene_source = 57 and is_obj = 1
- </if>
- <if test="param.mapShow !=null ">
- and s.map_show = #{param.mapShow}
- </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>
- <if test="param.folderInNums !=null and param.folderInNums.size >0">
- and s.num in
- <foreach collection="param.folderInNums" item="num" open="(" separator="," close=")">
- #{num}
- </foreach>
- </if>
- <if test="param.folderNoInNums !=null and param.folderNoInNums.size >0">
- and s.num not in
- <foreach collection="param.folderNoInNums" item="num" open="(" separator="," close=")">
- #{num}
- </foreach>
- </if>
- </sql>
- </mapper>
|