<?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.driver.mapper.KwBusinessDriverMapper">
    <select id="getDriverDetailById" resultType="com.sckw.driver.entity.res.KwBusinessDriverDetailRes">
        select * from kw_business_driver
        <where>
            del_flag = 0
            <if test="id != null">
                and id = #{id}
            </if>
        </where>
    </select>


    <sql id="Base_Column_List">
                id,
                company_id,
                company_name,
                name,
                phone,
                idcard,
                type,
                license_type,
                license_num,
                create_by,
                update_by,
                create_time,
                update_time
    </sql>

    <select id="selectPageList" resultType="com.sckw.driver.entity.res.KwBusinessDriverPageListRes">
        SELECT <include refid="Base_Column_List" />
        FROM kw_business_driver
        <where>
            del_flag = 0
            <if test="null != param.companyName and '' != param.companyName">
                and company_name = #{companyName},
            </if>
            <if test="null != param.name and '' != param.name">
                and `name` like concat('%', #{param.name,jdbcType=VARCHAR}, '%')
            </if>
            <if test="null != param.phone and '' != param.phone">
                and phone = #{param.phone}
            </if>
            <if test="null != param.idcard and '' !=  param.idcard">
                and idcard = #{param.idcard}
            </if>
            <if test="null != param.type ">
                and type = #{param.type}
            </if>
            <if test="null != param.licenseType ">
                and license_type = #{param.licenseType},
            </if>
            <if test="null != param.licenseNum and '' != param.licenseNum">
                and license_num = #{param.licenseNum},
            </if>
        </where>
    </select>
</mapper>