select `date`,(`total_amount`+`deposit_amount`+`no_deductible_amount`) as `totalAmount`,`total_quantity` as `totalQuantity`,(`rent_vehicle_amount`+`deposit_amount`+`no_deductible_amount`) as `rentVehicleAmount`,`rent_vehicle_quantity` as `rentVehicleQuantity`,
select
`company_id` as `companyId`,`pay_way` as `payWay`,`company_name` as `companyName` from `order_received_statistics` where `has_pay`=1
`company_id` as `companyId`,`date`,
and `date` between #{startDate} and #{endDate}
sum((`total_amount`+`deposit_amount`+`no_deductible_amount`)) as `totalAmount`,
sum(`total_quantity`) as `totalQuantity`,
sum((`rent_vehicle_amount`+`deposit_amount`+`no_deductible_amount`)) as `rentVehicleAmount`,
sum(`rent_vehicle_quantity`) as `rentVehicleQuantity`,
`pay_way` as `payWay`,
`company_name` as `companyName` from `order_received_statistics` where `has_pay`=1 and `pay_way`=1
and `date` between #{startDate} and #{endDate} group by `company_id`,`date`
union all
select
`company_id` as `companyId`,`date`,
sum((`total_amount`+`deposit_amount`+`no_deductible_amount`)) as `totalAmount`,
sum(`total_quantity`) as `totalQuantity`,
sum((`rent_vehicle_amount`+`deposit_amount`+`no_deductible_amount`)) as `rentVehicleAmount`,
sum(`rent_vehicle_quantity`) as `rentVehicleQuantity`,
`pay_way` as `payWay`,
`company_name` as `companyName` from `order_received_statistics` where `has_pay`=1 and `pay_way`=2
and `date` between #{startDate} and #{endDate} group by `company_id`,`date`
select `id` as `compnayId`,`name` as `companyName`,`zone_id` as `areaId`,`area`.name as `areaName` from `branch_company` as `bc` inner join `area` on bc.zone_id=area.id