123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <?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.mapper.ISceneProMapper">
- <select id="getCountGroupByUserId" resultType="com.fdkankan.manage.vo.response.GroupByCount" >
- SELECT user_id as id, count(id) as count FROM t_scene_pro WHERE rec_status = 'A' and is_upgrade = 0
- and user_id in
- <foreach item="userId" collection="userIdList" open="(" separator="," close=")">
- #{userId}
- </foreach>
- <if test="isObj !=null and isObj == 0">
- and scene_source in (1,2,3,12,13,14)
- </if>
- <if test="isObj !=null and isObj == 1">
- and is_obj = 1
- and scene_source = 4
- </if>
- GROUP BY user_id
- </select>
- <select id="getCountGroupByCameraId" resultType="com.fdkankan.manage.vo.response.GroupByCount">
- SELECT camera_id as id,count(id) as count FROM t_scene_pro WHERE rec_status = 'A' and is_upgrade = 0 AND camera_id is not null
- and scene_source in (1,2,3,12,13,14)
- and camera_id in
- <foreach item="cameraId" collection="cameraIds" open="(" separator="," close=")">
- #{cameraId}
- </foreach>
- GROUP BY camera_id
- </select>
- <select id="pageList" resultType="com.fdkankan.manage.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 , s.thumb
- ,null as algorithmTime,data_source
- 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},'%')
- </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,e.thumb
- ,algorithm_time,data_source
- 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},'%')
- </if>
- ) as tb
- order by ${param.field} ,id ${param.order}
- </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 d.company_id = co.id
- where s.rec_status = 'A'
- <if test="param.snCode != null and param.snCode !='' ">
- and c.sn_code like concat ('%',#{param.snCode},'%')
- </if>
- <if test="param.userName != null and param.userName !='' ">
- and u.user_name like concat ('%',#{param.userName},'%')
- </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 == 5">
- and s.scene_source = 4 and is_obj = 1
- </if>
- <if test="param.type !=null and param.type == 7">
- and s.scene_source = 5 and is_obj = 1
- </if>
- <if test="param.companyId !=null ">
- and co.id = #{param.companyId}
- </if>
- <if test="param.num !=null and param.num !='' ">
- and s.num like concat ('%',#{param.num},'%')
- </if>
- <if test="param.startTime !=null and param.startTime !='' ">
- and s.create_time >= #{param.startTime}
- </if>
- <if test="param.endTime !=null and param.endTime !='' ">
- and s.create_time <= #{param.endTime}
- </if>
- </sql>
- <select id="getProSpaceGroupByCameraId" resultType="com.fdkankan.manage.vo.response.GroupByCount">
- SELECT camera_id as id,sum(space) as count FROM t_scene_pro
- WHERE rec_status = 'A' and is_upgrade = 0 GROUP BY camera_id
- </select>
- <select id="getPlusSpaceGroupByCameraId" resultType="com.fdkankan.manage.vo.response.GroupByCount">
- SELECT p.camera_id as id,sum(space) as count FROM t_scene_plus p left join t_scene_plus_ext e on p.id = e.plus_id
- WHERE p.rec_status = 'A' GROUP BY p.camera_id
- </select>
- <select id="getSpaceSumByCameraId" resultType="java.lang.Long">
- select sum(space) from t_scene_pro where rec_status= 'A' and status = -2 and is_upgrade = 0 and camera_id = #{cameraId}
- </select>
- </mapper>
|