<?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.njzscloud.supervisory.biz.mapper.BizDriverMapper">

    <!-- 分页查询司机信息，包含清运公司名称 -->
    <select id="selectPageWithCompanyName" resultType="com.njzscloud.supervisory.biz.pojo.entity.BizDriverEntity">
        SELECT 
            d.id,
            d.user_id,
            d.company_id,
            d.driver_name,
            d.phone,
            d.driving_licence,
            d.licence_start_time,
            d.licence_end_time,
            d.audit_status,
            d.audit_memo,
            d.creator_id,
            d.modifier_id,
            d.create_time,
            d.modify_time,
            d.deleted,
        d.busy,
            d.driving_licence_no,
            c.company_name
        FROM biz_driver d
        LEFT JOIN biz_company c ON d.company_id = c.id
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            ${ew.customSqlSegment}
        </if>
        ORDER BY d.modify_time DESC
    </select>

</mapper>
