<?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.sqx.modules.driver.dao.DriverDao">


    <select id="selectDriverList" resultType="com.sqx.modules.driver.entity.Driver">
        select d.*,u.nick_name as userName,u.phone
        from driver d
        left join tb_user u on u.user_id=d.user_id
        where 1=1
        <if test="driverName!=null and driverName!=''">
            and d.driver_name like concat('%',#{driverName},'%')
        </if>
        <if test="userName!=null and userName!=''">
            and u.nick_name like concat('%',#{userName},'%')
        </if>
        <if test="phone!=null and phone!=''">
            and u.phone like concat('%',#{phone},'%')
        </if>
        <if test="status!=null">
            and d.status=#{status}
        </if>
        order by d.create_time desc
    </select>


</mapper>