<?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="cn.com.oa.mapper.CarInoutRecordMapper">

    <resultMap id="BaseResultMap" type="cn.com.oa.model.CarInoutRecord">
            <id property="id" column="id" jdbcType="BIGINT"/>
            <result property="deviceIp" column="device_ip" jdbcType="VARCHAR"/>
            <result property="serialNo" column="serial_no" jdbcType="VARCHAR"/>
            <result property="licensePlate" column="license_plate" jdbcType="VARCHAR"/>
            <result property="plateConfidence" column="plate_confidence" jdbcType="INTEGER"/>
            <result property="realPlate" column="real_plate" jdbcType="TINYINT"/>
            <result property="plateColorType" column="plate_color_type" jdbcType="INTEGER"/>
            <result property="triggerType" column="trigger_type" jdbcType="INTEGER"/>
            <result property="direction" column="direction" jdbcType="INTEGER"/>
            <result property="vehicleId" column="vehicle_id" jdbcType="BIGINT"/>
            <result property="whitelistType" column="whitelist_type" jdbcType="INTEGER"/>
            <result property="timeStamp" column="time_stamp" jdbcType="TIMESTAMP"/>
            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
    </resultMap>

    <sql id="Base_Column_List">
        select id,device_ip,serial_no,
        license_plate,plate_confidence,real_plate,
        plate_color_type,trigger_type,direction,
        vehicle_id,whitelist_type,time_stamp,
        create_time from car_inout_record
    </sql>
    <select id="getCarInRecordsByDateGroupByWhiteList" parameterType="CarInoutRecord" resultType="cn.com.oa.model.CarInoutRecord">
        <include refid="Base_Column_List"/>
        WHERE direction = #{direction}
        AND whitelist_type = #{whitelistType}
        AND DATE(time_stamp) = DATE(#{timeStamp})
        ORDER BY license_plate
    </select>

</mapper>
