select bo.*,omd.memberLevel,IFNULL(IFNULL(orvd.start_company_id,otd.start_company_id),`parent_user_company_id`) AS `companyId`,orvd.deposit,orvd.cost_detail_extend AS `costDetailExtend` from (select `id`,`type`,`status`,`order_amount` AS `orderAmount`, `real_amount`AS
select bo.*,omd.memberLevel,IFNULL(IFNULL(orvd.start_company_id,otd.start_company_id),bo.`parent_user_company_id`) AS `companyId`,orvd.deposit,orvd.cost_detail_extend AS `costDetailExtend` from (select `id`,`type`,`status`,`order_amount` AS `orderAmount`, `real_amount`AS
`realAmount`,`order_origin` AS `orderOrigin`, `has_pay` AS `hasPay`,
`realAmount`,`order_origin` AS `orderOrigin`, `has_pay` AS `hasPay`,
`pay_way` AS `payWay`
`pay_way` AS `payWay`,`parent_user_company_id`
from `base_order` where (`crt_time` between #{startDate} and #{endDate} or `pay_time` between #{startDate} and #{endDate} ) and `type` IN <foreachcollection="types"
from `base_order` where (`crt_time` between #{startDate} and #{endDate} or `pay_time` between #{startDate} and #{endDate} ) and `type` IN <foreachcollection="types"
IFNULL(brvd.start_company_id,IFNULL(otd.start_company_id,bo.parent_user_company_id)) AS `companyId`,
brvd.cost_detail_extend AS `costDetailExtend`,
brvd.cost_detail_extend AS `costDetailExtend`,
brvd.damage_safe AS `damageSafe`,
brvd.damage_safe AS `damageSafe`,
omd.member_level AS `memberLevel`
omd.member_level AS `memberLevel`
...
@@ -71,7 +71,8 @@
...
@@ -71,7 +71,8 @@
`order_account` AS `oa`
`order_account` AS `oa`
LEFT JOIN `base_order` AS `bo` ON bo.id = oa.order_id
LEFT JOIN `base_order` AS `bo` ON bo.id = oa.order_id
LEFT JOIN `order_rent_vehicle_detail` AS `brvd` ON brvd.order_id=oa.order_id
LEFT JOIN `order_rent_vehicle_detail` AS `brvd` ON brvd.order_id=oa.order_id
LEFT JOIN `order_tour_detail` AS `otd` ON otd.order_id=oa.order_id
LEFT JOIN `order_member_detail` AS `omd` ON omd.order_id=oa.order_id
LEFT JOIN `order_member_detail` AS `omd` ON omd.order_id=oa.order_id
WHERE bo.type=#{orderType} AND `oa`.account_status=1 AND oa.`crt_time` BETWEEN #{startTime} AND #{endTime}
WHERE bo.type=#{orderType} AND (`oa`.account_status=1 or(bo.pay_way=0 AND bo.has_pay=1 AND oa.account_status=0)) AND oa.`crt_time` BETWEEN #{startTime} AND #{endTime}