299 lines
11 KiB
XML
299 lines
11 KiB
XML
|
<?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.zhwl.passflow.mapper.ZdyDevicePassflowCountLogMapper">
|
||
|
|
||
|
<resultMap type="ZdyDevicePassflowCountLog" id="ZdyDevicePassflowCountLogResult">
|
||
|
<result property="logId" column="log_id"/>
|
||
|
<result property="sn" column="sn"/>
|
||
|
<result property="type" column="type"/>
|
||
|
<result property="time" column="time"/>
|
||
|
<result property="dataTime" column="data_time"/>
|
||
|
<result property="createdTime" column="created_time"/>
|
||
|
<result property="passflowType" column="passflow_type"/>
|
||
|
<result property="longitude" column="longitude"/>
|
||
|
<result property="latitude" column="latitude"/>
|
||
|
<result property="name" column="name"/>
|
||
|
<result property="allIn" column="all_in"/>
|
||
|
<result property="allOut" column="all_out"/>
|
||
|
<result property="passflowIn" column="passflow_in"/>
|
||
|
<result property="passflowOut" column="passflow_out"/>
|
||
|
<result property="ip" column="ip"/>
|
||
|
<result property="op" column="op"/>
|
||
|
<result property="realNum" column="real_num"/>
|
||
|
<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="remark" column="remark"/>
|
||
|
<result property="sendInfo" column="send_info"/>
|
||
|
<result property="reqInfo" column="req_info"/>
|
||
|
<result property="deptId" column="dept_id"/>
|
||
|
<result property="passflowName" column="passflow_name"/>
|
||
|
<result property="scenicId" column="scenic_id"/>
|
||
|
<result property="scenicName" column="scenic_name"/>
|
||
|
</resultMap>
|
||
|
|
||
|
<sql id="selectZdyDevicePassflowCountLogVo">
|
||
|
select p.passflow_name,cl.log_id,
|
||
|
cl.sn,
|
||
|
cl.type, cl.time, cl.data_time,cl.created_time, cl.passflow_type, cl.longitude, cl.latitude, cl.name, cl.all_in, cl.all_out, cl.passflow_in, cl.passflow_out, cl.ip, cl.op, cl.real_num,cl.send_info,cl.req_info, cl.create_by, cl.create_time, cl.update_by, cl.update_time, cl.remark,cl.dept_id,
|
||
|
cl.scenic_id,
|
||
|
zs.scenic_name
|
||
|
from zdy_device_passflow_count_log cl
|
||
|
left join zdy_device_passflow p on cl.sn = p.sn
|
||
|
left join zdy_scenic zs on zs.id = cl.scenic_id
|
||
|
</sql>
|
||
|
|
||
|
<select id="selectZdyDevicePassflowCountLogList" parameterType="ZdyDevicePassflowCountLog"
|
||
|
resultMap="ZdyDevicePassflowCountLogResult">
|
||
|
<include refid="selectZdyDevicePassflowCountLogVo"/>
|
||
|
left join sys_dept d on cl.dept_id = d.dept_id
|
||
|
<where>
|
||
|
<if test="sn != null and sn != ''">
|
||
|
and cl.sn = #{sn}
|
||
|
</if>
|
||
|
<if test="params.beginDataTime != null and params.beginDataTime != '' and params.endDataTime != null and params.endDataTime != ''">
|
||
|
and cl.data_time between #{params.beginDataTime} and #{params.endDataTime}
|
||
|
</if>
|
||
|
<if test="passflowName != null and passflowName != ''">
|
||
|
and p.passflow_name like concat('%', #{passflowName}, '%')
|
||
|
</if>
|
||
|
<if test="passflowOut != null">
|
||
|
and cl.passflow_out > #{passflowOut}
|
||
|
</if>
|
||
|
${params.dataScope}
|
||
|
</where>
|
||
|
order by cl.create_time desc
|
||
|
</select>
|
||
|
|
||
|
<select id="selectZdyDevicePassflowCountLogByLogId" parameterType="Long"
|
||
|
resultMap="ZdyDevicePassflowCountLogResult">
|
||
|
<include refid="selectZdyDevicePassflowCountLogVo"/>
|
||
|
where cl.log_id = #{logId}
|
||
|
</select>
|
||
|
|
||
|
<insert id="insertZdyDevicePassflowCountLog" parameterType="ZdyDevicePassflowCountLog" useGeneratedKeys="true"
|
||
|
keyProperty="logId">
|
||
|
insert into zdy_device_passflow_count_log
|
||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
<if test="sn != null">sn,
|
||
|
</if>
|
||
|
<if test="type != null">type,
|
||
|
</if>
|
||
|
<if test="time != null">time,
|
||
|
</if>
|
||
|
<if test="dataTime != null">data_time,
|
||
|
</if>
|
||
|
<if test="createdTime != null">created_time,
|
||
|
</if>
|
||
|
<if test="passflowType != null">passflow_type,
|
||
|
</if>
|
||
|
<if test="longitude != null">longitude,
|
||
|
</if>
|
||
|
<if test="latitude != null">latitude,
|
||
|
</if>
|
||
|
<if test="name != null">name,
|
||
|
</if>
|
||
|
<if test="allIn != null">all_in,
|
||
|
</if>
|
||
|
<if test="allOut != null">all_out,
|
||
|
</if>
|
||
|
<if test="passflowIn != null">passflow_in,
|
||
|
</if>
|
||
|
<if test="passflowOut != null">passflow_out,
|
||
|
</if>
|
||
|
<if test="ip != null">ip,
|
||
|
</if>
|
||
|
<if test="op != null">op,
|
||
|
</if>
|
||
|
<if test="realNum != null">real_num,
|
||
|
</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="remark != null">remark,
|
||
|
</if>
|
||
|
<if test="sendInfo != null">send_info,
|
||
|
</if>
|
||
|
<if test="reqInfo != null">req_info,
|
||
|
</if>
|
||
|
<if test="deptId != null">dept_id,
|
||
|
</if>
|
||
|
<if test="scenicId != null">scenic_id,
|
||
|
</if>
|
||
|
</trim>
|
||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
|
<if test="sn != null">#{sn},
|
||
|
</if>
|
||
|
<if test="type != null">#{type},
|
||
|
</if>
|
||
|
<if test="time != null">#{time},
|
||
|
</if>
|
||
|
<if test="dataTime != null">#{dataTime},
|
||
|
</if>
|
||
|
<if test="createdTime != null">#{createdTime},
|
||
|
</if>
|
||
|
<if test="passflowType != null">#{passflowType},
|
||
|
</if>
|
||
|
<if test="longitude != null">#{longitude},
|
||
|
</if>
|
||
|
<if test="latitude != null">#{latitude},
|
||
|
</if>
|
||
|
<if test="name != null">#{name},
|
||
|
</if>
|
||
|
<if test="allIn != null">#{allIn},
|
||
|
</if>
|
||
|
<if test="allOut != null">#{allOut},
|
||
|
</if>
|
||
|
<if test="passflowIn != null">#{passflowIn},
|
||
|
</if>
|
||
|
<if test="passflowOut != null">#{passflowOut},
|
||
|
</if>
|
||
|
<if test="ip != null">#{ip},
|
||
|
</if>
|
||
|
<if test="op != null">#{op},
|
||
|
</if>
|
||
|
<if test="realNum != null">#{realNum},
|
||
|
</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="remark != null">#{remark},
|
||
|
</if>
|
||
|
<if test="sendInfo != null">#{sendInfo},
|
||
|
</if>
|
||
|
<if test="reqInfo != null">#{reqInfo},
|
||
|
</if>
|
||
|
<if test="deptId != null">#{deptId},
|
||
|
</if>
|
||
|
<if test="scenicId != null">#{scenicId},
|
||
|
</if>
|
||
|
</trim>
|
||
|
</insert>
|
||
|
|
||
|
<update id="updateZdyDevicePassflowCountLog" parameterType="ZdyDevicePassflowCountLog">
|
||
|
update zdy_device_passflow_count_log
|
||
|
<trim prefix="SET" suffixOverrides=",">
|
||
|
<if test="sn != null">sn =
|
||
|
#{sn},
|
||
|
</if>
|
||
|
<if test="type != null">type =
|
||
|
#{type},
|
||
|
</if>
|
||
|
<if test="time != null">time =
|
||
|
#{time},
|
||
|
</if>
|
||
|
<if test="dataTime != null">data_time =
|
||
|
#{dataTime},
|
||
|
</if>
|
||
|
<if test="createdTime != null">created_time =
|
||
|
#{createdTime},
|
||
|
</if>
|
||
|
<if test="passflowType != null">passflow_type =
|
||
|
#{passflowType},
|
||
|
</if>
|
||
|
<if test="longitude != null">longitude =
|
||
|
#{longitude},
|
||
|
</if>
|
||
|
<if test="latitude != null">latitude =
|
||
|
#{latitude},
|
||
|
</if>
|
||
|
<if test="name != null">name =
|
||
|
#{name},
|
||
|
</if>
|
||
|
<if test="allIn != null">all_in =
|
||
|
#{allIn},
|
||
|
</if>
|
||
|
<if test="allOut != null">all_out =
|
||
|
#{allOut},
|
||
|
</if>
|
||
|
<if test="passflowIn != null">passflow_in =
|
||
|
#{passflowIn},
|
||
|
</if>
|
||
|
<if test="passflowOut != null">passflow_out =
|
||
|
#{passflowOut},
|
||
|
</if>
|
||
|
<if test="ip != null">ip =
|
||
|
#{ip},
|
||
|
</if>
|
||
|
<if test="op != null">op =
|
||
|
#{op},
|
||
|
</if>
|
||
|
<if test="realNum != null">real_num =
|
||
|
#{realNum},
|
||
|
</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="remark != null">remark =
|
||
|
#{remark},
|
||
|
</if>
|
||
|
<if test="sendInfo != null">send_info =
|
||
|
#{sendInfo},
|
||
|
</if>
|
||
|
<if test="reqInfo != null">req_info =
|
||
|
#{reqInfo},
|
||
|
</if>
|
||
|
<if test="deptId != null">dept_id =
|
||
|
#{deptId},
|
||
|
</if>
|
||
|
<if test="scenicId != null">scenic_id =
|
||
|
#{scenicId},
|
||
|
</if>
|
||
|
</trim>
|
||
|
where log_id = #{logId}
|
||
|
</update>
|
||
|
|
||
|
<delete id="deleteZdyDevicePassflowCountLogByLogId" parameterType="Long">
|
||
|
delete
|
||
|
from zdy_device_passflow_count_log
|
||
|
where log_id = #{logId}
|
||
|
</delete>
|
||
|
|
||
|
<delete id="deleteZdyDevicePassflowCountLogByLogIds" parameterType="String">
|
||
|
delete from zdy_device_passflow_count_log where log_id in
|
||
|
<foreach item="logId" collection="array" open="(" separator="," close=")">
|
||
|
#{logId}
|
||
|
</foreach>
|
||
|
</delete>
|
||
|
|
||
|
<select id="statisticsPassflowCount" parameterType="DevicePassflowCountReq" resultType="StatisticsPassflowCountVO">
|
||
|
select ifnull(sum(cl.passflow_in),0) as passflowIn, ifnull(sum(cl.passflow_out),0) as passflowOut from zdy_device_passflow_count_log cl
|
||
|
left join zdy_device_passflow p on p.sn = cl.sn
|
||
|
left join sys_dept d on d.dept_id = cl.dept_id
|
||
|
<where>
|
||
|
<if test="sn != null and sn != ''">
|
||
|
and cl.sn = #{sn}
|
||
|
</if>
|
||
|
<if test="passflowLocation != null and passflowLocation != ''">
|
||
|
and p.passflow_location = #{passflowLocation}
|
||
|
</if>
|
||
|
<if test="params.beginDataTime != null and params.beginDataTime != '' and params.endDataTime != null and params.endDataTime != ''">
|
||
|
and cl.data_time between #{params.beginDataTime} and #{params.endDataTime}
|
||
|
</if>
|
||
|
${params.dataScope}
|
||
|
</where>
|
||
|
</select>
|
||
|
</mapper>
|