<?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.template.mapper.SmartCarAccessMapper">

    <select id="getPage" resultType="com.template.model.vo.SmartCarAccessVo">
        SELECT
        sca.id as id,
        sca.type as type,
        sca.car_no as carNo,
        sca.data_time as dataTime,
        sca.image as image
        FROM
        `smart_car_access` sca
        WHERE sca.deleted=0
        <if test="keyWord != null and keyWord != ''">
            and sca.car_no like '%' #{keyWord} '%'
        </if>
        <if test="type != null and type != ''">
            and sca.type = #{type}
        </if>
        <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
            and sca.data_time &gt;= #{startTime} and sca.data_time &lt;= #{endTime}
        </if>
        ORDER BY sca.data_time DESC

    </select>
</mapper>
