123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359 |
- <?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.scene.mapper.ISceneProMapper">
- <resultMap id="SceneProResultMap" type="com.fdkankan.scene.entity.ScenePro" >
- <id column="id" property="id" jdbcType="BIGINT" />
- <result column="scene_name" property="sceneName" jdbcType="BIGINT" />
- <result column="scene_dec" property="sceneDec" jdbcType="VARCHAR" />
- <result column="web_site" property="webSite" jdbcType="VARCHAR" />
- <result column="thumb" property="thumb" jdbcType="VARCHAR" />
- <result column="user_id" property="userId" jdbcType="BIGINT" />
- <result column="camera_id" property="cameraId" jdbcType="BIGINT" />
- <result column="scene_logo" property="sceneLogo" jdbcType="VARCHAR" />
- <result column="num" property="num" jdbcType="VARCHAR" />
- <result column="scene_type" property="sceneType" jdbcType="TINYINT" />
- <result column="scene_status" property="sceneStatus" jdbcType="INTEGER" />
- <result column="pay_status" property="payStatus" jdbcType="TINYINT" />
- <result column="videos" property="videos" jdbcType="VARCHAR" />
- <result column="gps" property="gps" jdbcType="VARCHAR" />
- <result column="scene_scheme" property="sceneScheme" jdbcType="TINYINT" />
- <result column="build_type" property="buildType" jdbcType="VARCHAR" />
- <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
- <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
- <result column="tb_status" property="tbStatus" jdbcType="TINYINT" />
- </resultMap>
- <sql id="ScenePro_column">
- t.id, t.scene_name, t.scene_dec, t.web_site, t.thumb, t.user_id,
- t.camera_id, t.scene_logo, t.num, t.scene_type, t.scene_status,
- t.pay_status, t.videos, t.gps, t.scene_scheme, t.tb_status, t.build_type,
- t.create_time, t.update_time, t.tb_status
- </sql>
- <resultMap id="SceneProExtResultMap" type="com.fdkankan.scene.entity.SceneProExt" >
- <result column="scene_pro_id" property="sceneProId" jdbcType="BIGINT" />
- <result column="data_source" property="dataSource" jdbcType="VARCHAR" />
- <result column="phone_id" property="phoneId" jdbcType="VARCHAR" />
- <result column="recommend" property="recommend" jdbcType="TINYINT" />
- <result column="files_name" property="filesName" jdbcType="VARCHAR" />
- <result column="algorithm" property="algorithm" jdbcType="VARCHAR" />
- <result column="ecs" property="ecs" jdbcType="VARCHAR" />
- <result column="space" property="space" jdbcType="BIGINT" />
- <result column="firmware_version" property="firmwareVersion" jdbcType="VARCHAR" />
- <result column="compute_time" property="computeTime" jdbcType="BIGINT" />
- <result column="scene_source" property="sceneSource" jdbcType="INTEGER" />
- <result column="vrnum" property="vrnum" jdbcType="VARCHAR" />
- <result column="unicode" property="unicode" jdbcType="VARCHAR" />
- <result column="view_count" property="viewCount" jdbcType="INTEGER" />
- <result column="shoot_count" property="shootCount" jdbcType="INTEGER" />
- </resultMap>
- <sql id="SceneProExt_column" >
- ext.scene_pro_id, ext.data_source, ext.view_count, ext.shoot_count,
- ext.phone_id, ext.recommend, ext.files_name, ext.algorithm, ext.ecs, ext.space,
- ext.firmware_version, ext.compute_time, ext.scene_source, ext.vrnum, ext.unicode
- </sql>
- <select id="findFolderIdScence" resultType="java.lang.Integer">
- SELECT count(id)
- FROM t_scene_pro
- WHERE id in (SELECT scene_id from t_folder_scene WHERE folder_id = #{folderId})
- and user_id = #{userId}
- </select>
- <select id="findLikeNum" resultType="com.fdkankan.scene.entity.ScenePro">
- SELECT * FROM t_scene_pro
- WHERE num like CONCAT(#{sceneCode}, '%')
- AND tb_status = 0
- ORDER BY id desc
- limit 1
- </select>
- <select id="findByNum" resultType="com.fdkankan.scene.entity.ScenePro">
- SELECT * FROM t_scene_pro WHERE num = #{sceneCode} AND tb_status = 0 LIMIT 1
- </select>
- <select id="getSceneStatusByUnicode" resultType="com.fdkankan.scene.entity.SceneProPO">
- select
- <include refid="ScenePro_column"/>,
- <include refid="SceneProExt_column"/>
- from t_scene_pro t
- left join t_scene_pro_ext ext on t.id = ext.scene_pro_id
- WHERE ext.data_source LIKE CONCAT('%',#{unicode},'%') AND t.tb_status = #{tbStatus}
- order by t.create_time desc
- LIMIT 1
- </select>
- <select id="findByUserIdAndCameraType" resultType="com.fdkankan.scene.entity.SceneProPO">
- SELECT
- <include refid="ScenePro_column"/>,
- <include refid="SceneProExt_column"/>
- FROM t_scene_pro t
- LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
- WHERE t.user_id = #{userId}
- AND ext.camera_type = #{cameraType}
- AND t.tb_status = 0
- AND t.scene_status IN (1,-2)
- AND t.scene_type != 99
- ORDER BY t.create_time DESC
- </select>
- <select id="findByUserId" resultType="com.fdkankan.scene.entity.SceneProPO">
- SELECT
- <include refid="ScenePro_column"/>,
- <include refid="SceneProExt_column"/>
- FROM t_scene_pro t
- LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
- WHERE t.user_id = #{userId}
- AND t.tb_status = 0
- AND t.scene_status in (1, -2)
- AND t.scene_type != 99
- AND ext.scene_source = 1
- <if test= 'excludeNums != null and excludeNums.size > 0'>
- and t.num not in
- <foreach item='num' collection='excludeNums' open='(' separator=',' close=')'>
- #{num}
- </foreach>
- </if>
- order by t.id desc
- </select>
- <select id="findBySceneNums" resultType="com.fdkankan.scene.entity.SceneProPO">
- SELECT
- <include refid="ScenePro_column"/>,
- <include refid="SceneProExt_column"/>
- FROM t_scene_pro t
- LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
- WHERE ext.camera_type = #{cameraType}
- AND t.tb_status = 0
- AND t.scene_status IN (1,-2)
- AND t.scene_type != 99
- <if test= 'sceneCodeList != null and sceneCodeList.size > 0'>
- and t.num in
- <foreach item='sceneCode' collection='sceneCodeList' open='(' separator=',' close=')'>
- #{sceneCode}
- </foreach>
- </if>
- ORDER BY t.create_time DESC
- </select>
- <select id="findLatestOneByUserId" resultType="com.fdkankan.scene.vo.SceneVO">
- SELECT
- <include refid="ScenePro_column"/>,
- <include refid="SceneProExt_column"/>
- FROM t_scene_pro t
- LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
- WHERE t.user_id = #{userId}
- AND t.tb_status = 0
- AND t.camera_id is not null
- ORDER BY t.create_time DESC
- LIMIT 1
- </select>
- <select id="findByCameraIdPro" resultType="com.fdkankan.scene.entity.SceneProPO">
- SELECT
- <include refid="ScenePro_column"/>,
- <include refid="SceneProExt_column"/>
- FROM t_scene_pro t
- LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
- WHERE t.camera_id = #{cameraId}
- AND t.tb_status = 0
- </select>
- <select id="findByFileId" resultType="com.fdkankan.scene.entity.SceneProPO">
- SELECT
- <include refid="ScenePro_column"/>,
- <include refid="SceneProExt_column"/>
- FROM t_scene_pro t
- LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
- WHERE ext.data_source LIKE CONCAT('%',#{fileId},'%')
- AND t.tb_status = 0
- order by t.create_time desc
- LIMIT 1
- </select>
- <select id="findTempScenes" resultType="com.fdkankan.scene.entity.ScenePro">
- SELECT
- t.id, t.num
- FROM t_scene_pro t
- LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
- WHERE t.tb_status = 0
- and ext.pay_status = -2
- and (DATEDIFF(t.update_time,NOW()) <![CDATA[ <= ]]> -365)
- </select>
- <select id="getAppAllSceneByPage" resultType="com.fdkankan.scene.vo.SceneVO">
- SELECT * FROM (
- <if test= 'userId != null'>
- SELECT
- <include refid="ScenePro_column"/>,
- <include refid="SceneProExt_column"/>
- FROM t_scene_pro t
- LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
- WHERE t.user_id = #{userId} AND ext.camera_type = #{cameraType}
- AND t.tb_status = 0 AND t.scene_status in (1, -2) AND t.scene_type != 99
- </if>
- <if test= 'userId != null and cameraId != null'>
- UNION
- SELECT
- <include refid="ScenePro_column"/>,
- <include refid="SceneProExt_column"/>
- FROM t_scene_pro t
- LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
- WHERE t.camera_id = #{cameraId}
- AND t.scene_status in (1, -2) AND t.scene_type != 99 AND t.tb_status = 0
- </if>
- <if test= 'sceneCodeList != null and sceneCodeList.size() > 0'>
- UNION
- SELECT
- <include refid="ScenePro_column"/>,
- <include refid="SceneProExt_column"/>
- FROM t_scene_pro t
- LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
- WHERE t.scene_status in (1, -2)
- AND t.num IN
- <foreach collection="sceneCodeList" item="sceneCode" open="(" close=")" separator=",">
- #{sceneCode}
- </foreach>
- </if>
- ) a WHERE tb_status = 0
- <if test= 'sceneType != null'>
- AND scene_type = #{sceneType}
- </if>
- <if test= 'sceneName != null'>
- AND scene_name like CONCAT('%', #{sceneName}, '%')
- </if>
- <if test="orderBy != null and orderBy != ''">
- ${orderBy}
- </if>
- </select>
- <select id="findLastSceneByCameraId" resultType="com.fdkankan.scene.entity.SceneProPO">
- select
- <include refid="ScenePro_column"/>,
- <include refid="SceneProExt_column"/>
- from t_scene_pro t
- LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
- where t.tb_status = 0 and t.camera_id = #{cameraId}
- order by t.create_time desc
- limit 1
- </select>
- <select id="findByNumWithOutCheckRecStatus" resultType="com.fdkankan.scene.entity.SceneProPO">
- select
- <include refid="ScenePro_column"/>,
- <include refid="SceneProExt_column"/>
- from t_scene_pro t
- LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
- where t.num = #{sceneCode}
- limit 1
- </select>
- <select id="selectCooperationSceneList" parameterType="com.fdkankan.scene.vo.SceneParamVO" resultType="com.fdkankan.scene.entity.SceneProPO">
- select
- <include refid="ScenePro_column"/>,
- <include refid="SceneProExt_column"/>
- from t_scene_pro t
- left join t_scene_pro_ext ext on t.id = ext.scene_pro_id
- where t.tb_status = 0
- and ext.scene_source != 11
- <if test="numList != null and numList.size() != 0">
- and t.num in
- <foreach collection="numList" item="num" open="(" close=")" separator=",">
- #{num}
- </foreach>
- </if>
- <if test="sceneSourceList != null and sceneSourceList.size() != 0">
- and ext.scene_source in
- <foreach collection="sceneSourceList" item="sceneSource" open="(" close=")" separator=",">
- #{sceneSource}
- </foreach>
- </if>
- <if test="sceneIdList != null and sceneIdList.size() != 0">
- and t.id in
- <foreach collection="sceneIdList" item="id" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </if>
- <if test="sceneType != null and sceneType !=''">
- and t.scene_type = #{sceneType}
- </if>
- <if test="startTime != null">
- and t.create_time >= #{startTime}
- </if>
- <if test="endTime != null">
- and t.create_time <![CDATA[ <= ]]> #{endTime}
- </if>
- order by t.id desc
- </select>
- <select id="selectSceneList" parameterType="com.fdkankan.scene.vo.SceneParamVO" resultType="com.fdkankan.scene.entity.SceneProPO">
- select
- <include refid="ScenePro_column"/>,
- <include refid="SceneProExt_column"/>
- from t_scene_pro t
- left join t_scene_pro_ext ext on t.id = ext.scene_pro_id
- where t.tb_status = 0
- and ext.scene_source != 11
- <if test="userId != null">
- and t.user_id = #{userId}
- </if>
- <if test="num != null">
- and t.num = #{num}
- </if>
- <if test="numList != null and numList.size() != 0">
- and t.num in
- <foreach collection="numList" item="num" open="(" close=")" separator=",">
- #{num}
- </foreach>
- </if>
- <if test="sceneSourceList != null and sceneSourceList.size() != 0">
- and ext.scene_source in
- <foreach collection="sceneSourceList" item="sceneSource" open="(" close=")" separator=",">
- #{sceneSource}
- </foreach>
- </if>
- <if test="sceneIdList != null and sceneIdList.size() != 0">
- and t.id in
- <foreach collection="sceneIdList" item="id" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </if>
- <if test="sceneType != null and sceneType !=''">
- and t.scene_type = #{sceneType}
- </if>
- <if test="sceneName != null and sceneName != ''">
- and t.scene_name like concat('%', scene_name, '%')
- </if>
- <if test="startTime != null">
- and t.create_time >= #{startTime}
- </if>
- <if test="endTime != null">
- and t.create_time <![CDATA[ <= ]]> #{endTime}
- </if>
- <if test="cameraIdList != null and cameraIdList.size() != 0">
- and t.camera_id in
- <foreach collection="cameraIdList" item="cameraId" open="(" close=")" separator=",">
- #{cameraId}
- </foreach>
- </if>
- order by t.id desc
- </select>
- <select id="findByCameraIds" resultType="com.fdkankan.scene.entity.SceneProPO">
- SELECT * FROM t_scene_pro WHERE camera_id in (${cameraIds}) AND rec_status = 'A'
- <if test= 'startTime != null'>
- AND create_time >= #{startTime}
- </if>
- <if test= 'endTime != null'>
- AND create_time <= #{endTime}
- </if>
- ORDER BY camera_id,create_time DESC
- </select>
- <select id="getNumAndNameByCameraId" resultType="com.fdkankan.scene.vo.SceneBySnCodeVo">
- SELECT num AS sceneNum,scene_name AS sceneName FROM t_scene_pro
- WHERE rec_status = 'A' AND camera_id = #{cameraId} AND user_id = #{userId} AND scene_source!=11
- </select>
- </mapper>
|