123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <?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.ucenter.mapper.IScenePlusMapper">
- <sql id="commonWhere">
- left join t_user u on p.user_id = u.id
- left join t_camera c on p.camera_id = c.id
- left join t_camera_detail d on c.id = d.camera_id
- where p.rec_status = 'A' AND p.scene_type != 99
- <if test="param.sceneType !=null and param.sceneType !=''">
- and p.scene_type = #{param.sceneType}
- </if>
- <if test= 'param.cameraType != null' >
- and d.type = #{param.cameraType}
- </if>
- <if test="param.copyNumSet !=null and param.copyNumSet.size >0">
- and p.num not in
- <foreach collection="param.copyNumSet" item="num" open="(" separator="," close=")">
- #{num}
- </foreach>
- </if>
- <if test="param.cameraId != null and param.userId !=null and param.cooperationNumList !=null and param.cooperationNumList.size >0">
- and ( p.camera_id = #{param.cameraId} or p.user_id = #{param.userId} or p.num in
- <foreach collection="param.cooperationNumList" item="coNum" open="(" separator="," close=")">
- #{coNum}
- </foreach>
- )
- </if>
- <if test="param.cameraId != null and param.userId !=null and param.cooperationNumList !=null and param.cooperationNumList.size ==0 ">
- and ( p.camera_id = #{param.cameraId} or p.user_id = #{param.userId} )
- </if>
- <if test="param.cameraId != null and param.userId ==null and param.cooperationNumList !=null and param.cooperationNumList.size ==0 ">
- and p.camera_id = #{param.cameraId}
- </if>
- <if test="param.cameraId != null and param.userId ==null and param.cooperationNumList !=null and param.cooperationNumList.size >0 ">
- and ( p.camera_id = #{param.cameraId} or p.num in
- <foreach collection="param.cooperationNumList" item="coNum" open="(" separator="," close=")">
- #{coNum}
- </foreach>
- )
- </if>
- <if test="param.cameraId == null and param.userId !=null and param.cooperationNumList !=null and param.cooperationNumList.size ==0 ">
- and p.user_id = #{param.userId}
- </if>
- <if test="param.cameraId == null and param.userId !=null and param.cooperationNumList !=null and param.cooperationNumList.size >0 ">
- and ( p.user_id = #{param.userId} or p.num in
- <foreach collection="param.cooperationNumList" item="coNum" open="(" separator="," close=")">
- #{coNum}
- </foreach>
- )
- </if>
- </sql>
- <select id="pageList" resultType="com.fdkankan.ucenter.vo.response.AppSceneVo">
- SELECT p.id ,null as name ,0 as isFolder,null as type,null as parentId ,p.create_time,num,scene_name,scene_dec,
- p.status,pay_status,thumb,web_site,0 as is_upgrade,view_count,
- p.camera_id,p.user_id ,p.data_source,p.scene_type,build_type,c.sn_code,c.child_name,4 as location
- FROM t_scene_pro p
- <include refid="commonWhere"></include>
- and is_upgrade = 0 AND ( p.status = 1 OR p.status = -2)
- <if test="param.sceneName !=null and param.sceneName !=''">
- and p.scene_name like CONCAT('%',#{param.sceneName},'%')
- </if>
- UNION
- SELECT p.id as id ,null as name ,0 as isFolder,null as type,null as parentId,p.create_time ,num,title as scene_name,description as scene_dec,
- scene_status as status,pay_status,thumb,web_site,1 as is_upgrade,view_count,
- p.camera_id,p.user_id,e.data_source,p.scene_type,build_type,c.sn_code,c.child_name,e.location
- FROM t_scene_plus p
- LEFT JOIN t_scene_plus_ext e on p.id = e.plus_id
- <include refid="commonWhere"></include>
- <if test="param.queryVrPano !=null and param.queryVrPano == false">
- and (e.location != 7 or e.location is null )
- </if>
- AND ( p.scene_status = 1 OR p.scene_status = -2)
- <if test="param.sceneName !=null and param.sceneName !=''">
- and p.title like CONCAT('%',#{param.sceneName},'%')
- </if>
- <if test="param.orderBy !=null and param.orderBy !=''">
- ORDER BY ${param.orderBy}
- </if>
- <if test="param.orderBy ==null or param.orderBy ==''">
- ORDER BY create_time desc
- </if>
- </select>
- <select id="getCountByUserId" resultType="java.lang.Long">
- select count(*) from t_scene_plus s left join t_camera_detail d on s.camera_id = d.camera_id
- where s.rec_status = 'A'
- and s.user_id = #{userId} and d.type = #{cameraType}
- </select>
- <select id="getSpaceSumByCameraId" resultType="java.lang.Long">
- select sum(space) from t_scene_plus p left join t_scene_plus_ext e on p.id = e.plus_id where p.rec_status = 'A' and p.scene_status = -2 and p.camera_id = #{cameraId}
- </select>
- </mapper>
|