视频sql

This commit is contained in:
guanpeng 2025-02-08 15:20:24 +08:00
parent 467d70e0c7
commit ff58dd8b36
1 changed files with 149 additions and 0 deletions

View File

@ -0,0 +1,149 @@
<?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.dkl.large.mapper.DklVideoDataMapper">
<resultMap type="DklVideoData" id="DklVideoDataResult">
<result property="id" column="id" />
<result property="videoId" column="video_id" />
<result property="acquisitionTime" column="acquisition_time" />
<result property="numberPeople" column="number_people" />
<result property="isAbnormal" column="is_abnormal" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="delFlag" column="del_flag" />
<result property="originalData" column="original_data" />
<result property="deptId" column="dept_id" />
</resultMap>
<sql id="selectDklVideoDataVo">
select dv.id, dv.video_id, dvi.name AS videoName,dv.acquisition_time, dv.number_people, dv.is_abnormal, dv.create_by, dv.create_time, dv.update_by, dv.update_time, dv.del_flag,dv.original_data, dv.dept_id from dkl_video_data dv
left join sys_dept d on dv.dept_id = d.dept_id
left join dkl_video dvi on dvi.id = dv.video_id
</sql>
<select id="selectDklVideoDataList" parameterType="DklVideoData" resultMap="DklVideoDataResult">
<include refid="selectDklVideoDataVo"/>
<where>
<if test="videoId != null and videoId != ''"> and dv.video_id = #{videoId}</if>
<if test="acquisitionTime != null and acquisitionTime != ''"> and dv.acquisition_time = #{acquisitionTime}</if>
<if test="numberPeople != null and numberPeople != ''"> and dv.number_people = #{numberPeople}</if>
<if test="isAbnormal != null and isAbnormal != ''"> and dv.is_abnormal = #{isAbnormal}</if>
<if test="originalData != null and originalData != ''"> and dv.original_data = #{originalData}</if>
<if test="deptId != null "> and dv.dept_id = #{deptId}</if>
<if test="delFlag != null and delFlag != ''"> and dv.del_flag = #{delFlag}</if>
</where>
<!-- 数据范围过滤 -->
${params.dataScope}
order by dv.create_time desc
</select>
<select id="selectDklVideoDataById" parameterType="int" resultMap="DklVideoDataResult">
<include refid="selectDklVideoDataVo"/>
where dv.id = #{id}
</select>
<insert id="insertDklVideoData" parameterType="DklVideoData">
insert into dkl_video_data
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="videoId != null">video_id,</if>
<if test="acquisitionTime != null">acquisition_time,</if>
<if test="numberPeople != null">number_people,</if>
<if test="isAbnormal != null">is_abnormal,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="delFlag != null">del_flag,</if>
<if test="originalData != null">original_data,</if>
<if test="deptId != null">dept_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="videoId != null">#{videoId},</if>
<if test="acquisitionTime != null">#{acquisitionTime},</if>
<if test="numberPeople != null">#{numberPeople},</if>
<if test="isAbnormal != null">#{isAbnormal},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="originalData != null">#{originalData},</if>
<if test="deptId != null">#{deptId},</if>
</trim>
</insert>
<update id="updateDklVideoData" parameterType="DklVideoData">
update dkl_video_data
<trim prefix="SET" suffixOverrides=",">
<if test="videoId != null">video_id = #{videoId},</if>
<if test="acquisitionTime != null">acquisition_time = #{acquisitionTime},</if>
<if test="numberPeople != null">number_people = #{numberPeople},</if>
<if test="isAbnormal != null">is_abnormal = #{isAbnormal},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="originalData != null">original_data = #{originalData},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
</trim>
where id = #{id}
</update>
<update id="deleteDklVideoDataById" parameterType="int">
update dkl_video_data set del_flag = 2 where id = #{id}
</update>
<update id="deleteDklVideoDataByIds" parameterType="int">
update dkl_video_data set del_flag = 2 where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<select id="getDklVideoDataCount" parameterType="string">
SELECT COUNT(*) FROM dkl_video_data WHERE del_flag = '0'
</select>
<select id="getDklVideoDataPeopleCount" parameterType="string">
SELECT sum(number_people) FROM dkl_video_data WHERE del_flag = '0'
</select>
<select id="peopleDataStatisticsByActivity" resultType="DklMonitoringCameraDataVo">
SELECT SUM
( number_people ) as numberPeople,
to_char( acquisition_time, 'YYYY-MM-DD' ) as acquisitionTime
FROM
dkl_video_data
WHERE
del_flag = '0'
<if test="startTime!=null">
AND acquisition_time BETWEEN #{startTime}
AND #{endTime}
</if>
GROUP BY
acquisitionTime
ORDER BY acquisitionTime DESC
</select>
<select id="itemsDataStatisticsByActivity" resultType="DklMonitoringCameraDataVo">
SELECT COUNT(*) as numberItems,
to_char( acquisition_time, 'YYYY-MM-DD' ) AS acquisitionTime
FROM
dkl_video_data
WHERE
del_flag = '0'
<if test="startTime!=null">
AND acquisition_time BETWEEN #{startTime}
AND #{endTime}
</if>
GROUP BY
acquisitionTime
ORDER BY acquisitionTime DESC
</select>
</mapper>