guyue
2025-08-16 4f75e746dc006f487a1a7de8e14c497148911b0e
DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/DriverMapper.xml
@@ -753,4 +753,51 @@
        from t_driver where flag != 3 and authState = 2 and taxiAptitudeCard = #{taxiAptitudeCard}
    </select>
    <select id="queryDriversByIds" resultType="map">
        select
            a.id as id,
            a.headImgUrl as avatar,
            a.sex as sex,
            a.`name` as `name`,
            a.phone as phone,
            a.balance as balance,
            a.laveActivityMoney as laveActivityMoney,
            a.activityMoney as activityMoney,
            a.businessMoney as businessMoney,
            a.laveBusinessMoney as laveBusinessMoney,
            a.taxiAptitudeCard as taxiAptitudeCard,
            DATE_FORMAT(a.networkCarlssueDate, '%Y-%m-%d') as networkCarlssueDate,
            a.driverContactAddress_ as driverContactAddress_,
            a.idCard as idCard,
            a.appletsOpenId as appletsOpenId,
            a.idCardImgUrl1 as idCardImgUrl1,
            a.idCardImgUrl2 as idCardImgUrl2,
            DATE_FORMAT(a.getDriverLicenseDate, '%Y-%m-%d') as getDriverLicenseDate,
            (select GROUP_CONCAT(type Separator ',') from t_driver_service where driverId = a.id) as `type`,
            a.placeOfPractice as placeOfPractice,
            a.driveCardImgUrl as driveCardImgUrl,
            a.networkCarlssueImg as networkCarlssueImg,
            a.placeOfEmployment as placeOfEmployment,
            (select `name` from t_company where 1 = 1 and if(a.companyId is null or a.companyId = 0, id = 1, if(a.franchiseeId is null or a.franchiseeId = 0, id = a.companyId, id = a.franchiseeId))) as company,
            b.carLicensePlate as licensePlate,
            b.carColor as carColor,
            CONCAT(d.`name`, c.`name`) as brand,
            (
                    (select count(id) from t_order_private_car where driverId = a.id and state in (7, 8, 9)) +
                    (select count(id) from t_order_taxi where driverId = a.id and state in (7, 8, 9)) +
                    (select count(id) from t_order_cross_city where driverId = a.id and state in (6, 8, 9)) +
                    (select count(id) from t_order_logistics where driverId = a.id and state in (6, 9))
                ) as orderNum,
            ((select sum(fraction) from t_order_evaluate where driverId = a.id) / (select count(fraction) from t_order_evaluate where driverId = a.id)) as score
        from t_driver a
                 left join t_car b on (a.carId = b.id)
                 left join t_car_model c on (b.carModelId = c.id)
                 left join t_car_brand d on (c.brandId = d.id)
        where a.id in
        <foreach collection="driverIds" item="id" open="(" close=")" separator=",">
            #{id}
        </foreach>
    </select>
</mapper>