| | |
| | | <if test="phone != null and phone != ''"> |
| | | and o.phone LIKE CONCAT('%',#{phone},'%') |
| | | </if> |
| | | <if test="name != null and name != ''"> |
| | | and o.lastName LIKE CONCAT('%',#{name},'%') or o.firstName LIKE CONCAT('%',#{name},'%') |
| | | <if test="lastName != null and lastName != ''"> |
| | | and o.lastName LIKE CONCAT('%',#{lastName},'%') |
| | | </if> |
| | | <if test="firstName != null and firstName != ''"> |
| | | and o.firstName LIKE CONCAT('%',#{firstName},'%') |
| | | </if> |
| | | <if test="addType != null and addType != ''"> |
| | | and o.addType = #{addType} |
| | |
| | | IFNULL(topc1.num, 0) as privateCarTotalNum, |
| | | IFNULL(topc2.num, 0) as privateCarNotPayNum, |
| | | IFNULL(topc3.num, 0) as privateCarcancelNum, |
| | | IFNULL(topc4.taxiMoney, 0) + IFNULL(topc11.taxiMoney, 0) as privateCarTotalMoney, |
| | | IFNULL(topc5.taxiMoney, 0) as privateCarNotPayMoney, |
| | | IFNULL(topc4.taxiMoney, 0) + IFNULL(topc11.taxiMoney, 0) + IFNULL(topc13.taxiMoney, 0) as privateCarTotalMoney, |
| | | IFNULL(topc5.taxiMoney, 0) + IFNULL(topc13.taxiMoney, 0) as privateCarNotPayMoney, |
| | | </if> |
| | | <if test="4 == type"> |
| | | IFNULL(topc6.num, 0) as privateCarTotalNum, |
| | | IFNULL(topc7.num, 0) as privateCarNotPayNum, |
| | | IFNULL(topc8.num, 0) as privateCarcancelNum, |
| | | IFNULL(topc9.taxiMoney, 0) + IFNULL(topc12.taxiMoney, 0) as privateCarTotalMoney, |
| | | IFNULL(topc10.taxiMoney, 0) as privateCarNotPayMoney, |
| | | IFNULL(topc9.taxiMoney, 0) + IFNULL(topc12.taxiMoney, 0) + IFNULL(topc14.taxiMoney, 0) as privateCarTotalMoney, |
| | | IFNULL(topc10.taxiMoney, 0) + IFNULL(topc14.taxiMoney, 0) as privateCarNotPayMoney, |
| | | </if> |
| | | <if test="null == type"> |
| | | IFNULL(topc1.num, 0) + IFNULL(topc6.num, 0) as privateCarTotalNum, |
| | | IFNULL(topc2.num, 0) + IFNULL(topc7.num, 0) as privateCarNotPayNum, |
| | | IFNULL(topc3.num, 0) + IFNULL(topc8.num, 0) as privateCarcancelNum, |
| | | IFNULL(topc4.taxiMoney, 0) + IFNULL(topc9.taxiMoney, 0) + IFNULL(topc11.taxiMoney, 0) + IFNULL(topc12.taxiMoney, 0) as privateCarTotalMoney, |
| | | IFNULL(topc5.taxiMoney, 0) + IFNULL(topc10.taxiMoney, 0) as privateCarNotPayMoney, |
| | | IFNULL(topc4.taxiMoney, 0) + IFNULL(topc9.taxiMoney, 0) + IFNULL(topc11.taxiMoney, 0) + IFNULL(topc12.taxiMoney, 0) + IFNULL(topc13.taxiMoney, 0) + IFNULL(topc14.taxiMoney, 0) as privateCarTotalMoney, |
| | | IFNULL(topc5.taxiMoney, 0) + IFNULL(topc10.taxiMoney, 0) + IFNULL(topc13.taxiMoney, 0) + IFNULL(topc14.taxiMoney, 0) as privateCarNotPayMoney, |
| | | </if> |
| | | td.state as driverState, |
| | | td.phone as driverPhone |
| | |
| | | </if> |
| | | GROUP BY driverId |
| | | ) AS topc4 ON topc4.driverId = td.id |
| | | LEFT JOIN ( SELECT SUM(orderMoney) AS taxiMoney, driverId FROM t_order_private_car WHERE FIND_IN_SET(state, '7,12') |
| | | LEFT JOIN ( SELECT SUM(orderMoney) AS taxiMoney, driverId FROM t_order_private_car WHERE FIND_IN_SET(state, '7') |
| | | <if test="null != start and '' != start and null != end and '' != end"> |
| | | and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end} |
| | | </if> |
| | | GROUP BY driverId |
| | | ) AS topc5 ON topc5.driverId = td.id |
| | | LEFT JOIN ( SELECT SUM(money) AS taxiMoney, objectId as driverId FROM t_income WHERE type = 3 and userType = 2 and orderType = 1 |
| | | <if test="null != start and '' != start and null != end and '' != end"> |
| | | and DATE_FORMAT(insertTime, '%Y-%m-%d') between #{start} and #{end} |
| | | </if> |
| | | GROUP BY objectId |
| | | ) AS topc11 ON topc11.driverId = td.id |
| | | LEFT JOIN ( |
| | | SELECT SUM(a.money) AS taxiMoney, b.driverId FROM t_order_cancel a |
| | | left join t_order_private_car b on (a.orderId = b.id and a.orderType = 1) |
| | | where FIND_IN_SET(b.state, '10') |
| | | <if test="null != start and '' != start and null != end and '' != end"> |
| | | and DATE_FORMAT(b.travelTime, '%Y-%m-%d') between #{start} and #{end} |
| | | </if> |
| | | group by b.driverId |
| | | ) AS topc11 ON topc11.driverId = td.id |
| | | LEFT JOIN ( |
| | | SELECT SUM(a.money) AS taxiMoney, b.driverId FROM t_order_cancel a |
| | | left join t_order_private_car b on (a.orderId = b.id and a.orderType = 1) |
| | | where FIND_IN_SET(b.state, '12') |
| | | <if test="null != start and '' != start and null != end and '' != end"> |
| | | and DATE_FORMAT(b.travelTime, '%Y-%m-%d') between #{start} and #{end} |
| | | </if> |
| | | group by b.driverId |
| | | ) AS topc13 ON topc13.driverId = td.id |
| | | </if> |
| | | <if test="null == type or 4 == type"> |
| | | LEFT JOIN ( SELECT COUNT(id) AS num, driverId FROM t_order_logistics WHERE FIND_IN_SET(state, '7,8,9,10,12') |
| | |
| | | </if> |
| | | GROUP BY driverId |
| | | ) AS topc9 ON topc9.driverId = td.id |
| | | LEFT JOIN ( SELECT SUM(orderMoney) AS taxiMoney, driverId FROM t_order_logistics WHERE FIND_IN_SET(state, '7,12') |
| | | LEFT JOIN ( SELECT SUM(orderMoney) AS taxiMoney, driverId FROM t_order_logistics WHERE FIND_IN_SET(state, '7') |
| | | <if test="null != start and '' != start and null != end and '' != end"> |
| | | and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end} |
| | | </if> |
| | | GROUP BY driverId |
| | | ) AS topc10 ON topc10.driverId = td.id |
| | | LEFT JOIN ( SELECT SUM(money) AS taxiMoney, objectId as driverId FROM t_income WHERE type = 3 and userType = 2 and orderType = 4 |
| | | LEFT JOIN ( |
| | | SELECT SUM(a.money) AS taxiMoney, b.driverId FROM t_order_cancel a |
| | | left join t_order_logistics b on (a.orderId = b.id and a.orderType = 4) |
| | | where FIND_IN_SET(b.state, '10') |
| | | <if test="null != start and '' != start and null != end and '' != end"> |
| | | and DATE_FORMAT(insertTime, '%Y-%m-%d') between #{start} and #{end} |
| | | and DATE_FORMAT(b.travelTime, '%Y-%m-%d') between #{start} and #{end} |
| | | </if> |
| | | GROUP BY objectId |
| | | group by b.driverId |
| | | ) AS topc12 ON topc12.driverId = td.id |
| | | LEFT JOIN ( |
| | | SELECT SUM(a.money) AS taxiMoney, b.driverId FROM t_order_cancel a |
| | | left join t_order_logistics b on (a.orderId = b.id and a.orderType = 4) |
| | | where FIND_IN_SET(b.state, '12') |
| | | <if test="null != start and '' != start and null != end and '' != end"> |
| | | and DATE_FORMAT(b.travelTime, '%Y-%m-%d') between #{start} and #{end} |
| | | </if> |
| | | group by b.driverId |
| | | ) AS topc14 ON topc14.driverId = td.id |
| | | </if> |
| | | <where> |
| | | <if test="null!= companyId and '' != companyId"> |