| | |
| | | <result column="addType" property="addType" /> |
| | | <result column="laveBusinessMoney" property="laveBusinessMoney"/> |
| | | <result column="businessMoney" property="businessMoney"/> |
| | | <result column="mchtNo" property="mchtNo"/> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | |
| | | LEFT JOIN (select * from t_company where type = 3 and flag != 3) as cc2 on cc2.id = dd.franchiseeId |
| | | LEFT JOIN ( |
| | | SELECT |
| | | GROUP_CONCAT(case when type = 1 then '快车' |
| | | GROUP_CONCAT(case when type = 1 then '专车' |
| | | when type = 2 then '出租车' |
| | | when type = 3 then '跨城出行' |
| | | when type = 4 then '小件物流-同城' |
| | |
| | | LEFT JOIN (select * from t_company where flag != 3) as cc on cc.id = dd.companyId |
| | | LEFT JOIN ( |
| | | SELECT |
| | | GROUP_CONCAT(case when type = 1 then '快车' |
| | | GROUP_CONCAT(case when type = 1 then '专车' |
| | | when type = 2 then '出租车' |
| | | when type = 3 then '跨城出行' |
| | | when type = 4 then '小件物流-同城' |
| | |
| | | LEFT JOIN (select * from t_car where state = 1) as ci on ci.id = dd.carId |
| | | LEFT JOIN ( |
| | | SELECT |
| | | GROUP_CONCAT(case when type = 1 then '快车' |
| | | GROUP_CONCAT(case when type = 1 then '专车' |
| | | when type = 2 then '出租车' |
| | | when type = 3 then '跨城出行' |
| | | when type = 4 then '小件物流-同城' |
| | |
| | | LEFT JOIN (select * from t_car_brand where state = 1) as cb on cb.id = ci.carBrandId |
| | | LEFT JOIN ( |
| | | SELECT |
| | | GROUP_CONCAT(case when type = 1 then '快车' |
| | | GROUP_CONCAT(case when type = 1 then '专车' |
| | | when type = 2 then '出租车' |
| | | when type = 3 then '跨城出行' |
| | | when type = 4 then '小件物流-同城' |
| | |
| | | LEFT JOIN (select * from t_car where state = 1) as ci on ci.id = dd.carId |
| | | LEFT JOIN ( |
| | | SELECT |
| | | GROUP_CONCAT(case when type = 1 then '快车' |
| | | GROUP_CONCAT(case when type = 1 then '专车' |
| | | when type = 2 then '出租车' |
| | | when type = 3 then '跨城出行' |
| | | when type = 4 then '小件物流-同城' |
| | |
| | | order by o.id desc |
| | | </select> |
| | | |
| | | <select id="orderRevenueDetailsList" resultType="map"> |
| | | select |
| | | a.id, |
| | | b.insertTime, |
| | | a.`name`, |
| | | b.orderNum, |
| | | b.orderType, |
| | | c.money |
| | | from t_driver a |
| | | left join ( |
| | | select id, orderNum, driverId, 1 as orderType, DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i:%s') as insertTime from t_order_private_car where state in (8, 9) and isDelete = 1 and pid is not null |
| | | union all |
| | | select id, orderNum, driverId, 2 as orderType, DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i:%s') as insertTime from t_order_taxi where state in (8, 9) and isDelete = 1 |
| | | union all |
| | | select id, orderNum, driverId, 3 as orderType, DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i:%s') as insertTime from t_order_cross_city where state in (8, 9) and isDelete = 1 |
| | | union all |
| | | select id, orderNum, driverId, type as orderType, DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i:%s') as insertTime from t_order_logistics where state in (6, 9) and isDelete = 1 |
| | | union all |
| | | select id, orderNum, driverId, 7 as orderType, DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i:%s') as insertTime from t_order_call where state in (8, 9) and isDelete = 1 |
| | | ) b on (a.id = b.driverId) |
| | | left join (select * from t_income where userType = 2 and type = 2) c on (b.id = c.incomeId and b.orderType = c.orderType) |
| | | where a.flag != 3 and a.authState = 2 and c.money > 0 |
| | | <if test="null != companyId"> |
| | | and a.companyId = #{companyId} |
| | | </if> |
| | | <if test="null != driverName and '' != driverName"> |
| | | and a.`name` like CONCAT('%', #{driverName}, '%') |
| | | </if> |
| | | <if test="null != driverPhone and '' != driverPhone"> |
| | | and a.phone like CONCAT('%', #{driverPhone}, '%') |
| | | </if> |
| | | <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> |
| | | and b.insertTime between #{startTime} and #{endTime} |
| | | </if> |
| | | order by b.insertTime desc |
| | | </select> |
| | | |
| | | <select id="orderRevenueDetailsListSum" resultType="double"> |
| | | select |
| | | sum(c.money) as money |
| | | from t_driver a |
| | | left join ( |
| | | select id, orderNum, driverId, 1 as orderType, DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i:%s') as insertTime from t_order_private_car where state in (8, 9) and isDelete = 1 and pid is not null |
| | | union all |
| | | select id, orderNum, driverId, 2 as orderType, DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i:%s') as insertTime from t_order_taxi where state in (8, 9) and isDelete = 1 |
| | | union all |
| | | select id, orderNum, driverId, 3 as orderType, DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i:%s') as insertTime from t_order_cross_city where state in (8, 9) and isDelete = 1 |
| | | union all |
| | | select id, orderNum, driverId, type as orderType, DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i:%s') as insertTime from t_order_logistics where state in (6, 9) and isDelete = 1 |
| | | union all |
| | | select id, orderNum, driverId, 7 as orderType, DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i:%s') as insertTime from t_order_call where state in (8, 9) and isDelete = 1 |
| | | ) b on (a.id = b.driverId) |
| | | left join (select * from t_income where userType = 2 and type = 2) c on (b.id = c.incomeId and b.orderType = c.orderType) |
| | | where a.flag != 3 and a.authState = 2 and c.money > 0 |
| | | <if test="null != companyId"> |
| | | and a.companyId = #{companyId} |
| | | </if> |
| | | <if test="null != driverName and '' != driverName"> |
| | | and a.`name` like CONCAT('%', #{driverName}, '%') |
| | | </if> |
| | | <if test="null != driverPhone and '' != driverPhone"> |
| | | and a.phone like CONCAT('%', #{driverPhone}, '%') |
| | | </if> |
| | | <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> |
| | | and b.insertTime between #{startTime} and #{endTime} |
| | | </if> |
| | | order by b.insertTime desc |
| | | </select> |
| | | |
| | | |
| | | |
| | | |
| | | <select id="exportOrderRevenueDetails" resultType="map"> |
| | | select |
| | | a.id, |
| | | b.insertTime, |
| | | a.`name`, |
| | | b.orderNum, |
| | | b.orderType, |
| | | c.money |
| | | from t_driver a |
| | | left join ( |
| | | select id, orderNum, driverId, 1 as orderType, DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i:%s') as insertTime from t_order_private_car where state in (8, 9) and isDelete = 1 and pid is not null |
| | | union all |
| | | select id, orderNum, driverId, 2 as orderType, DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i:%s') as insertTime from t_order_taxi where state in (8, 9) and isDelete = 1 |
| | | union all |
| | | select id, orderNum, driverId, 3 as orderType, DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i:%s') as insertTime from t_order_cross_city where state in (8, 9) and isDelete = 1 |
| | | union all |
| | | select id, orderNum, driverId, type as orderType, DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i:%s') as insertTime from t_order_logistics where state in (6, 9) and isDelete = 1 |
| | | union all |
| | | select id, orderNum, driverId, 7 as orderType, DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i:%s') as insertTime from t_order_call where state in (8, 9) and isDelete = 1 |
| | | ) b on (a.id = b.driverId) |
| | | left join (select * from t_income where userType = 2 and type = 2) c on (b.id = c.incomeId and b.orderType = c.orderType) |
| | | where a.flag != 3 and a.authState = 2 and c.money > 0 |
| | | <if test="null != companyId"> |
| | | and a.companyId = #{companyId} |
| | | </if> |
| | | <if test="null != driverName and '' != driverName"> |
| | | and a.`name` like CONCAT('%', #{driverName}, '%') |
| | | </if> |
| | | <if test="null != driverPhone and '' != driverPhone"> |
| | | and a.phone like CONCAT('%', #{driverPhone}, '%') |
| | | </if> |
| | | <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> |
| | | and b.insertTime between #{startTime} and #{endTime} |
| | | </if> |
| | | order by b.insertTime desc |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="otherSpendingDetailList" resultType="map"> |
| | | select |
| | | da.travelTime, |
| | | b.name, |
| | | b.phone, |
| | | da.type, |
| | | da.thankYouFee, |
| | | (da.holidayFee + da.amount) as amount |
| | | from ( |
| | | select travelTime, type, driverId, sum(thankYouFee) as thankYouFee, sum(holidayFee) as holidayFee, sum(amount) as amount from ( |
| | | select DATE_FORMAT(a.travelTime, '%Y-%m-%d') as travelTime, 1 as type, driverId, ifnull(thankYouFee, 0) as thankYouFee, ifnull(holidayFee, 0) as holidayFee, (select ifnull(sum(amount), 0) from t_order_additional_fee where orderType = 1 and orderId = a.id) as amount |
| | | from t_order_private_car a |
| | | |
| | | union all |
| | | |
| | | select DATE_FORMAT(a.travelTime, '%Y-%m-%d') as travelTime, 2 as type, driverId, ifnull(thankYouFee, 0) as thankYouFee, ifnull(holidayFee, 0) as holidayFee, (select ifnull(sum(amount), 0) from t_order_additional_fee where orderType = 2 and orderId = a.id) as amount |
| | | from t_order_taxi a |
| | | |
| | | union all |
| | | |
| | | select DATE_FORMAT(a.travelTime, '%Y-%m-%d') as travelTime, 3 as type, driverId, ifnull(thankYouFee, 0) as thankYouFee, ifnull(holidayFee, 0) as holidayFee, (select ifnull(sum(amount), 0) from t_order_additional_fee where orderType = 3 and orderId = a.id) as amount |
| | | from t_order_cross_city a |
| | | |
| | | union all |
| | | |
| | | select DATE_FORMAT(a.travelTime, '%Y-%m-%d') as travelTime, type as type, driverId, ifnull(thankYouFee, 0) as thankYouFee, ifnull(holidayFee, 0) as holidayFee, (select ifnull(sum(amount), 0) from t_order_additional_fee where orderType = type and orderId = a.id) as amount |
| | | from t_order_logistics a |
| | | |
| | | union all |
| | | |
| | | select DATE_FORMAT(a.travelTime, '%Y-%m-%d') as travelTime, 7 as type, driverId, ifnull(thankYouFee, 0) as thankYouFee, ifnull(holidayFee, 0) as holidayFee, (select ifnull(sum(amount), 0) from t_order_additional_fee where orderType = 7 and orderId = a.id) as amount |
| | | from t_order_call a |
| | | ) as aa group by aa.travelTime, aa.type, aa.driverId |
| | | ) as da |
| | | left join t_driver b on (da.driverId = b.id) |
| | | where (da.thankYouFee > 0 or da.amount > 0) |
| | | <if test="null != driverName and '' != driverName"> |
| | | and b.name like CONCAT('%', #{driverName}, '%') |
| | | </if> |
| | | <if test="null != driverPhone and '' != driverPhone"> |
| | | and b.phone like CONCAT('%', #{driverPhone}, '%') |
| | | </if> |
| | | <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> |
| | | and da.travelTime between #{startTime} and #{endTime} |
| | | </if> |
| | | order by da.travelTime desc |
| | | <if test="null != offset and null != limit"> |
| | | limit #{offset}, #{limit} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="otherSpendingDetailListCount" resultType="int"> |
| | | select count(1) from ( |
| | | select travelTime, type, driverId, sum(thankYouFee) as thankYouFee, sum(amount) as amount from ( |
| | | select DATE_FORMAT(a.travelTime, '%Y-%m-%d') as travelTime, 1 as type, driverId, ifnull(thankYouFee, 0) as thankYouFee, (select ifnull(sum(amount), 0) from t_order_additional_fee where orderType = 1 and orderId = a.id) as amount |
| | | from t_order_private_car a |
| | | |
| | | union all |
| | | |
| | | select DATE_FORMAT(a.travelTime, '%Y-%m-%d') as travelTime, 2 as type, driverId, ifnull(thankYouFee, 0) as thankYouFee, (select ifnull(sum(amount), 0) from t_order_additional_fee where orderType = 2 and orderId = a.id) as amount |
| | | from t_order_taxi a |
| | | |
| | | union all |
| | | |
| | | select DATE_FORMAT(a.travelTime, '%Y-%m-%d') as travelTime, 3 as type, driverId, ifnull(thankYouFee, 0) as thankYouFee, (select ifnull(sum(amount), 0) from t_order_additional_fee where orderType = 3 and orderId = a.id) as amount |
| | | from t_order_cross_city a |
| | | |
| | | union all |
| | | |
| | | select DATE_FORMAT(a.travelTime, '%Y-%m-%d') as travelTime, type as type, driverId, ifnull(thankYouFee, 0) as thankYouFee, (select ifnull(sum(amount), 0) from t_order_additional_fee where orderType = type and orderId = a.id) as amount |
| | | from t_order_logistics a |
| | | |
| | | union all |
| | | |
| | | select DATE_FORMAT(a.travelTime, '%Y-%m-%d') as travelTime, 7 as type, driverId, ifnull(thankYouFee, 0) as thankYouFee, (select ifnull(sum(amount), 0) from t_order_additional_fee where orderType = 7 and orderId = a.id) as amount |
| | | from t_order_call a |
| | | ) as aa group by aa.travelTime, aa.type, aa.driverId |
| | | ) as da |
| | | left join t_driver b on (da.driverId = b.id) |
| | | where (da.thankYouFee > 0 or da.amount > 0) |
| | | <if test="null != driverName and '' != driverName"> |
| | | and b.name like CONCAT('%', #{driverName}, '%') |
| | | </if> |
| | | <if test="null != driverPhone and '' != driverPhone"> |
| | | and b.phone like CONCAT('%', #{driverPhone}, '%') |
| | | </if> |
| | | <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> |
| | | and da.travelTime between #{startTime} and #{endTime} |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <select id="otherSpendingDetailListSum" resultType="map"> |
| | | select ifnull(sum(thankYouFee), 0) as thankYouFee, (ifnull(sum(holidayFee), 0) + ifnull(sum(amount), 0)) as amount from ( |
| | | select travelTime, type, driverId, sum(thankYouFee) as thankYouFee, sum(holidayFee) as holidayFee, sum(amount) as amount from ( |
| | | select DATE_FORMAT(a.travelTime, '%Y-%m-%d') as travelTime, 1 as type, driverId, ifnull(thankYouFee, 0) as thankYouFee, ifnull(holidayFee, 0) as holidayFee, (select ifnull(sum(amount), 0) from t_order_additional_fee where orderType = 1 and orderId = a.id) as amount |
| | | from t_order_private_car a |
| | | |
| | | union all |
| | | |
| | | select DATE_FORMAT(a.travelTime, '%Y-%m-%d') as travelTime, 2 as type, driverId, ifnull(thankYouFee, 0) as thankYouFee, ifnull(holidayFee, 0) as holidayFee, (select ifnull(sum(amount), 0) from t_order_additional_fee where orderType = 2 and orderId = a.id) as amount |
| | | from t_order_taxi a |
| | | |
| | | union all |
| | | |
| | | select DATE_FORMAT(a.travelTime, '%Y-%m-%d') as travelTime, 3 as type, driverId, ifnull(thankYouFee, 0) as thankYouFee, ifnull(holidayFee, 0) as holidayFee, (select ifnull(sum(amount), 0) from t_order_additional_fee where orderType = 3 and orderId = a.id) as amount |
| | | from t_order_cross_city a |
| | | |
| | | union all |
| | | |
| | | select DATE_FORMAT(a.travelTime, '%Y-%m-%d') as travelTime, type as type, driverId, ifnull(thankYouFee, 0) as thankYouFee, ifnull(holidayFee, 0) as holidayFee, (select ifnull(sum(amount), 0) from t_order_additional_fee where orderType = type and orderId = a.id) as amount |
| | | from t_order_logistics a |
| | | |
| | | union all |
| | | |
| | | select DATE_FORMAT(a.travelTime, '%Y-%m-%d') as travelTime, 7 as type, driverId, ifnull(thankYouFee, 0) as thankYouFee, ifnull(holidayFee, 0) as holidayFee, (select ifnull(sum(amount), 0) from t_order_additional_fee where orderType = 7 and orderId = a.id) as amount |
| | | from t_order_call a |
| | | ) as aa group by aa.travelTime, aa.type, aa.driverId |
| | | ) as da |
| | | left join t_driver b on (da.driverId = b.id) |
| | | where (da.thankYouFee > 0 or da.amount > 0) |
| | | <if test="null != driverName and '' != driverName"> |
| | | and b.name like CONCAT('%', #{driverName}, '%') |
| | | </if> |
| | | <if test="null != driverPhone and '' != driverPhone"> |
| | | and b.phone like CONCAT('%', #{driverPhone}, '%') |
| | | </if> |
| | | <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> |
| | | and da.travelTime between #{startTime} and #{endTime} |
| | | </if> |
| | | </select> |
| | | </mapper> |