123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256 |
- <?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="scene_code" property="sceneCode" jdbcType="VARCHAR" />
- <result column="scene_type" property="sceneType" jdbcType="TINYINT" />
- <result column="view_count" property="viewCount" jdbcType="INTEGER" />
- <result column="shoot_count" property="shootCount" jdbcType="INTEGER" />
- <result column="videos" property="videos" jdbcType="VARCHAR" />
- <result column="gps" property="gps" jdbcType="VARCHAR" />
- <result column="scene_scheme" property="sceneScheme" jdbcType="TINYINT" />
- <result column="rec_status" property="recStatus" jdbcType="VARCHAR" />
- <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">
- id, scene_name, scene_dec, web_site, thumb, user_id,
- camera_id, scene_logo, scene_code, scene_type, view_count,
- shoot_count, videos, gps, scene_scheme, rec_status, build_type,
- create_time, update_time, tb_status
- </sql>
- <resultMap id="SceneProExtResultMap" type="com.fdkankan.scene.entity.SceneProExt" >
- <result column="scene_pro_id" property="sceneProId" jdbcType="BIGINT" />
- <result column="scene_status" property="sceneStatus" jdbcType="INTEGER" />
- <result column="data_source" property="dataSource" jdbcType="VARCHAR" />
- <result column="pay_status" property="payStatus" jdbcType="TINYINT" />
- <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" />
- </resultMap>
- <sql id="SceneProExt_column" >
- scene_pro_id, scene_status, data_source, pay_status,
- phone_id, recommend, files_name, algorithm, ecs, space,
- firmware_version, compute_time, scene_source, vrnum, unicode
- </sql>
- <select id="findFolderIdScence">
- 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 scene_code like CONCAT(#{sceneCode}, '%')
- AND rec_status = 'A'
- ORDER BY id desc
- limit 1
- </select>
- <select id="findByNum" resultType="com.fdkankan.scene.entity.ScenePro">
- SELECT * FROM t_scene_pro WHERE scene_code = #{sceneCode} AND rec_status = 'A' 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.rec_status = #{recStatus}
- 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.rec_status = 'A'
- AND ext.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.rec_status = 'A'
- AND ext.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.scene_code 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.rec_status = 'A'
- AND ext.scene_status IN (1,-2)
- AND t.scene_type != 99
- <if test= 'sceneCodeList != null and sceneCodeList.size > 0'>
- and t.scene_code 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.rec_status = 'A'
- 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.rec_status = 'A'
- </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.rec_status = 'A'
- order by create_time desc
- LIMIT 1
- </select>
- <select id="findTempScenes" resultType="com.fdkankan.scene.entity.ScenePro">
- SELECT
- t.id, t.scene_code
- FROM t_scene_pro t
- LEFT JOIN t_scene_pro_ext ext ON t.id = ext.scene_pro_id
- WHERE t.rec_status = 'A'
- 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.rec_status = 'A' AND ext.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 ext.scene_status in (1, -2) AND t.scene_type != 99 AND t.rec_status = 'A'
- </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 ext.scene_status in (1, -2)
- AND t.scene_code IN
- <foreach collection="sceneCodeList" item="sceneCode" open="(" close=")" separator=",">
- #{sceneCode}
- </foreach>
- </if>
- ) a WHERE rec_status = 'A'
- <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.rec_status = 'A' 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.scene_code = #{sceneCode}
- limit 1
- </select>
- </mapper>
|