zhibing.pu
2024-08-01 656ac293601d6da08d25e892a79604fe3edcd086
DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/DriverMapper.xml
@@ -309,4 +309,40 @@
            date_format(insertTime, '%Y-%m-%d')
        ) = YEARWEEK(now())
    </select>
    <select id="queryIdleDriver_" resultType="Driver">
        select * from (
        select
        *
        from t_driver
        where flag != 3 and state = 2 and authState = 2
        <if test="null != companyId">
            <choose>
                <when test="companyId != 1">
                    and companyId = #{companyId} or franchiseeId = #{companyId}
                </when>
                <otherwise>
                    and companyId is null or companyId = 0 or companyId = 1 or franchiseeId is null or franchiseeId = 0
                </otherwise>
            </choose>
        </if>
        and id in
        (
        select driverId from t_driver_work where startTime &lt; now() and state = 1 and `type` like CONCAT('%', #{type}, '%')
        )
        and id in (select driverId from t_driver_orders where `type` = #{type})
        and carId in (select carId from t_car_service where `type` = #{type}
        <if test="null != serverCarModelId">
            and serverCarModelId = #{serverCarModelId}
        </if>
        )
        ) as aa <!--where aa.id not in (
        select driverId from t_order_private_car where isDelete = 1 and driverPay = 1 and state in (7, 8, 9)
        union all
        select driverId from t_order_logistics where isDelete = 1 and driverPay = 1 and state != 10
        )-->
    </select>
</mapper>