1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?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,u.nick_name,s.view_count,s.status,s.pay_status,'v3' as scene_version ,s.web_site as thumb
- ,null as algorithmTime
- 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,u.nick_name,e.view_count,s.scene_status as status,s.pay_status,'v4' as scene_version,e.web_site as thumb
- ,algorithm_time
- 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 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 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.userId != null ">
- and s.user_id = #{param.userId}
- </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.companyId !=null ">
- and co.id = #{param.companyId}
- </if>
- </sql>
- </mapper>
|