<?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.muyu.enterprise.mapper.FaultLogMapper">

    <insert id="insertBatchFaultLog">
        insert into faultlog (fault_code, vin, warning_time)
        values
        <foreach collection="logs" item="temp" separator=",">
            (#{temp.faultCode},#{temp.vin},#{temp.warningTime})
        </foreach>
    </insert>

    <update id="updateFaultLogByTime">
        update faultlog
        set normal_time = #{normalTime}
        where id = #{id}
    </update>

    <select id="selectFaultId" resultType="java.lang.Long">
        select max(id)
        from faultlog
        where fault_code = #{faultCode}
          and vin = #{vin}
    </select>


</mapper>
