<?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.sckw.fleet.dao.KwfDriverCardMapper">

    <insert id="insert1" parameterType="com.sckw.fleet.model.KwfDriverCard">
        INSERT INTO kwf_driver_card
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="null != driverId and '' != driverId">
                driver_id,
            </if>
            <if test="null != idcard and '' != idcard">
                idcard,
            </if>
            <if test="null != expireTime and '' != expireTime">
                expire_time,
            </if>
            <if test="null != address and '' != address">
                address,
            </if>
            <if test="null != certificateMain and '' != certificateMain">
                certificate_main,
            </if>
            <if test="null != certificateRevolt and '' != certificateRevolt">
                certificate_revolt,
            </if>
            <if test="null != remark and '' != remark">
                remark,
            </if>
            <if test="null != status and '' != status">
                status,
            </if>
            <if test="null != createBy and '' != createBy">
                create_by,
            </if>
            <if test="null != createTime and '' != createTime">
                create_time,
            </if>
            <if test="null != updateBy and '' != updateBy">
                update_by,
            </if>
            <if test="null != updateTime and '' != updateTime">
                update_time,
            </if>
            <if test="null != delFlag and '' != delFlag">
                del_flag
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=BIGINT},
            </if>
            <if test="null != driverId and '' != driverId">
                #{driverId},
            </if>
            <if test="null != idcard and '' != idcard">
                #{idcard},
            </if>
            <if test="null != expireTime and '' != expireTime">
                #{expireTime},
            </if>
            <if test="null != address and '' != address">
                #{address},
            </if>
            <if test="null != certificateMain and '' != certificateMain">
                #{certificateMain},
            </if>
            <if test="null != certificateRevolt and '' != certificateRevolt">
                #{certificateRevolt},
            </if>
            <if test="null != remark and '' != remark">
                #{remark},
            </if>
            <if test="null != status and '' != status">
                #{status},
            </if>
            <if test="null != createBy and '' != createBy">
                #{createBy},
            </if>
            <if test="null != createTime and '' != createTime">
                #{createTime},
            </if>
            <if test="null != updateBy and '' != updateBy">
                #{updateBy},
            </if>
            <if test="null != updateTime and '' != updateTime">
                #{updateTime},
            </if>
            <if test="null != delFlag and '' != delFlag">
                #{delFlag}
            </if>
        </trim>
    </insert>

    <select id="findByDriverId" resultType="com.sckw.fleet.model.KwfDriverCard" parameterType="java.lang.Long" >
        SELECT
            id, driver_id driverId, idcard, expire_time expireTime, address, certificate_main certificateMain,
            certificate_revolt certificateRevolt, remark, status, create_by createBy, create_time createTime,
            update_by updateBy, update_time updateTime
        from kwf_driver_card
        where del_flag = 0 and driver_id = #{driverId, jdbcType=BIGINT}
    </select>

</mapper>
