<?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="org.springblade.jobs.corridormonitoring.mapper.CorridorMonitoringMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="corridorMonitoringResultMap" type="org.springblade.jobs.corridormonitoring.entity.CorridorMonitoring">
        <result column="id" property="id"/>
        <result column="create_user" property="createUser"/>
        <result column="create_dept" property="createDept"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="status" property="status"/>
        <result column="is_deleted" property="isDeleted"/>
        <result column="job_type" property="jobType"/>
        <result column="time" property="time"/>
        <result column="event_source" property="eventSource"/>
        <result column="capture_image" property="captureImage"/>
        <result column="handle_before" property="handleBefore"/>
        <result column="handle_after" property="handleAfter"/>
        <result column="handler" property="handler"/>
        <result column="handler_phone" property="handlerPhone"/>
        <result column="handler_status" property="handlerStatus"/>
        <result column="handle_result" property="handleResult"/>
    </resultMap>


    <select id="selectCorridorMonitoringPage" resultMap="corridorMonitoringResultMap">
        select * from yc_corridor_monitoring where is_deleted = 0
        <if test="corridorMonitoring != null">
            <if test="corridorMonitoring.eventSource != null">
            and event_source like '%${corridorMonitoring.eventSource}%'
            </if>
            <if test="corridorMonitoring.handlerStatus != null">
            and handler_status = ${corridorMonitoring.handlerStatus}
            </if>
        </if>
    </select>

    <select id="getUntreatedCount" resultType="java.lang.Integer">
        select COUNT(*) from yc_corridor_monitoring where is_deleted = 0 AND handle_status = 1
    </select>

</mapper>
