<?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.xxfc.platform.vehicle.mapper.VehicleWarningMsgMapper">
    <select id="getByPage" resultType="com.xxfc.platform.vehicle.pojo.VehicleWarningMsgQueryVo"
            parameterType="com.xxfc.platform.vehicle.pojo.QueryVehicleWarningMsgVo">
        select
        vwn.id, vwn.type, vwn.`status`, vwn.msg, vwn.rule_id, vwn.msg_key, vwn.vehicle_id, vwn.create_time, vwn.update_time, vwn.remark, v.code as vehicleCode, v.number_plate
        from vehicle_warning_msg vwn left join vehicle v on vwn.vehicle_id = v.id
        where
        vwn.`status` = 0
        <if test="vehicleCode != null">
            and v.code = #{vehicleCode}
        </if>
        <if test="numberPlate != null and numberPlate != '' ">
            and v.number_plate = #{numberPlate}
        </if>
        <if test="type != null">
            and type = #{type}
        </if>

    </select>

    <select id="getMsgByVehicle" parameterType="String" resultType="com.xxfc.platform.vehicle.entity.VehicleWarningMsg" >
        select id, type, status, msg, rule_id, msg_key, vehicle_id, create_time, update_time, remark from vehicle_warning_msg where vehicle_id = #{_parameter}
    </select>


</mapper>