From 030035886476e90ba648a572a5b8297c9003463e Mon Sep 17 00:00:00 2001 From: gongbiao Date: Fri, 5 Jul 2019 11:09:41 +0800 Subject: [PATCH] =?UTF-8?q?[=E8=B4=A6=E5=8D=95=E5=88=97=E8=A1=A8][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9][SQL=E8=B0=83=E6=95=B4]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/mapper/WxBillAllMapper.xml | 178 +++++++++--------- 1 file changed, 84 insertions(+), 94 deletions(-) diff --git a/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml b/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml index b5952dcfc..f85307324 100644 --- a/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml @@ -53,45 +53,37 @@ select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type,case when shop_info is null then '[]' else shop_info end shop_info,comments - from wx_bill_rent where is_preview = 0 - union + from wx_bill_rent where tenant_id=#{tenantId} and is_preview = 0 + union all select id,merchant_id,shop_id,tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' - endtime,rent_shop_type,shop_info,NULL comments from wx_bill_rent_deposit - union + endtime,rent_shop_type,shop_info,NULL comments from wx_bill_rent_deposit where tenant_id=#{tenantId} + union all select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type,case when shop_info is null then '[]' else shop_info end shop_info,comments - from wx_bill_property where is_preview = 0 - union + from wx_bill_property where tenant_id=#{tenantId} and is_preview = 0 + union all select id,merchant_id,shop_id,tenant_id,'物业押金' name,4 bill_type_value,'物业押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' - endtime,rent_shop_type,shop_info,NULL comments from wx_bill_property_deposit - union - select id,merchant_id,shop_id,tenant_id,'水费' name,5 bill_type_value,'水费' bill_type,0 as + endtime,rent_shop_type,shop_info,NULL comments from wx_bill_property_deposit where tenant_id=#{tenantId} + union all + select id,merchant_id,shop_id,tenant_id,case when type=1 then '水费' when type=2 then '电费' else '空调费' end name, + case when type=1 then 5 when type=2 then 6 else 9 end bill_type_value, + case when type=1 then '水费' when type=2 then '电费' else '空调费' end bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime, rent_shop_type,'[]' shop_info,NULL comments - from wx_bill_daily where type=1 - union - select id,merchant_id,shop_id,tenant_id,'电费' name,6 bill_type_value,'电费' bill_type,0 as - need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime, - rent_shop_type,'[]' shop_info,NULL comments - from wx_bill_daily where type=2 - union - select id,merchant_id,shop_id,tenant_id,'空调费' name,9 bill_type_value,'空调费' bill_type,0 as - need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime, - rent_shop_type,'[]' shop_info,NULL comments - from wx_bill_daily where type=3 - union + from wx_bill_daily where tenant_id=#{tenantId} + union all select id,merchant_id,shop_id,tenant_id,name,7 bill_type_value,'其他' bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime, rent_shop_type,'[]' shop_info,comments - from wx_bill_other - union + from wx_bill_other where tenant_id=#{tenantId} + union all select id,merchant_id,shop_id,tenant_id,comments as name,8 bill_type_value,'其他押金' bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime, rent_shop_type,'[]' shop_info,comments - from wx_bill_other_deposit + from wx_bill_other_deposit where tenant_id=#{tenantId} ) bill left join wx_merchant m on bill.merchant_id=m.id left join wx_shop s on bill.shop_id=s.id @@ -130,34 +122,34 @@ select count(bill.id) owncount,IFNULL(sum(bill.owe),0) owe from ( select id,merchant_id,shop_id,tenant_id,1 bill_type_value,'租金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_rent where is_preview = 0 - union + union all select id,merchant_id,shop_id,tenant_id,2 bill_type_value,'租赁押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_rent_deposit - union + union all select id,merchant_id,shop_id,tenant_id,3 bill_type_value,'物业费' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_property where is_preview = 0 - union + union all select id,merchant_id,shop_id,tenant_id,4 bill_type_value,'物业押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_property_deposit - union + union all select id,merchant_id,shop_id,tenant_id,5 bill_type_value,'水费' bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where type=1 - union + union all select id,merchant_id,shop_id,tenant_id,6 bill_type_value,'电费' bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where type=2 - union + union all select id,merchant_id,shop_id,tenant_id,9 bill_type_value,'空调费' bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where type=3 - union + union all select id,merchant_id,shop_id,tenant_id,7 bill_type_value,'其他' bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other - union + union all select id,merchant_id,shop_id,tenant_id,8 bill_type_value,'其他押金' bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other_deposit ) bill @@ -185,34 +177,34 @@ select count(bill.id) paycount,IFNULL(sum(bill.pay),0) pay from ( select id,merchant_id,shop_id,tenant_id,1 bill_type_value,'租金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_rent where is_preview = 0 - union + union all select id,merchant_id,shop_id,tenant_id,2 bill_type_value,'租赁押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_rent_deposit - union + union all select id,merchant_id,shop_id,tenant_id,3 bill_type_value,'物业费' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_property where is_preview = 0 - union + union all select id,merchant_id,shop_id,tenant_id,4 bill_type_value,'物业押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_property_deposit - union + union all select id,merchant_id,shop_id,tenant_id,5 bill_type_value,'水费' bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where type=1 - union + union all select id,merchant_id,shop_id,tenant_id,6 bill_type_value,'电费' bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where type=2 - union + union all select id,merchant_id,shop_id,tenant_id,9 bill_type_value,'空调费' bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where type=3 - union + union all select id,merchant_id,shop_id,tenant_id,7 bill_type_value,'其他' bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other - union + union all select id,merchant_id,shop_id,tenant_id,8 bill_type_value,'其他押金' bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other_deposit ) bill @@ -237,42 +229,40 @@ rentShopType from ( select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type - from wx_bill_rent where is_preview = 0 and rent_contract_id in (select id from wx_rent_contract where status in + from wx_bill_rent where is_preview = 0 and tenant_id=#{tenantId}and rent_contract_id in (select id from + wx_rent_contract where status in (2,3,4)) - union + union all select id,merchant_id,shop_id,tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type - from wx_bill_rent_deposit where rent_contract_id in (select id from wx_rent_contract where status in (2,3,4)) - union + from wx_bill_rent_deposit where tenant_id=#{tenantId} and rent_contract_id in (select id from wx_rent_contract + where status in (2,3,4)) + union all select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type - from wx_bill_property where is_preview = 0 and property_contract_id in (select id from wx_property_contract + from wx_bill_property where is_preview = 0 and tenant_id=#{tenantId} and property_contract_id in (select id from + wx_property_contract where status in(2,3,4)) - union + union all select id,merchant_id,shop_id,tenant_id,'物业押金' name,4 bill_type_value,'物业押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type - from wx_bill_property_deposit where property_contract_id in (select id from wx_property_contract where status in + from wx_bill_property_deposit where tenant_id=#{tenantId} and property_contract_id in (select id from + wx_property_contract where status in (2,3,4)) - union - select id,merchant_id,shop_id,tenant_id,'水费' name,5 bill_type_value,'水费' bill_type, 0 as - need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type - from wx_bill_daily where type=1 - union - select id,merchant_id,shop_id,tenant_id,'电费' name,6 bill_type_value,'电费' bill_type,0 as - need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type - from wx_bill_daily where type=2 - union - select id,merchant_id,shop_id,tenant_id,'空调费' name,9 bill_type_value,'空调费' bill_type,0 as - need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type - from wx_bill_daily where type=3 - union + union all + select id,merchant_id,shop_id,tenant_id,case when type=1 then '水费' when type=2 then '电费' else '空调费' end name, + case when type=1 then 5 when type=2 then 6 else 9 end bill_type_value, + case when type=1 then '水费' when type=2 then '电费' else '空调费' end bill_type, 0 as need_pay,receive_pay, + pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type + from wx_bill_daily where tenant_id=#{tenantId} + union all select id,merchant_id,shop_id,tenant_id,name,7 bill_type_vaue,'其他' bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type - from wx_bill_other - union + from wx_bill_other where tenant_id=#{tenantId} + union all select id,merchant_id,shop_id,tenant_id,comments as name,8 bill_type_value,'其他押金' bill_type,0 as need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type - from wx_bill_other_deposit + from wx_bill_other_deposit where tenant_id=#{tenantId} ) bill left join wx_merchant m on bill.merchant_id=m.id left join wx_shop s on bill.shop_id=s.id @@ -323,35 +313,35 @@ select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_rent where is_preview = 0 - union + union all select id,merchant_id,shop_id,tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金' bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_rent_deposit - union + union all select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费' bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_property where is_preview = 0 - union + union all select id,merchant_id,shop_id,tenant_id,'物业押金' name,4 bill_type_value,'物业押金' bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_property_deposit - union + union all select id,merchant_id,shop_id,tenant_id,'水费' name,5 bill_type_value,'水费' bill_type,0 as need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_daily where type=1 - union + union all select id,merchant_id,shop_id,tenant_id,'电费' name,6 bill_type_value,'电费' bill_type,0 as need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_daily where type=2 - union + union all select id,merchant_id,shop_id,tenant_id,'空调费' name,9 bill_type_value,'空调费' bill_type,0 as need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_daily where type=3 - union + union all select id,merchant_id,shop_id,tenant_id,name,7 bill_type_value,'其他' bill_type,0 as need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_other - union + union all select id,merchant_id,shop_id,tenant_id,name,8 bill_type_value,'其他押金' bill_type,0 as need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_other_deposit @@ -370,35 +360,35 @@ select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_rent where is_preview = 0 - union + union all select id,merchant_id,shop_id,tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金' bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_rent_deposit - union + union all select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费' bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_property where is_preview = 0 - union + union all select id,merchant_id,shop_id,tenant_id,'物业押金' name,4 bill_type_value,'物业押金' bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_property_deposit - union + union all select id,merchant_id,shop_id,tenant_id,'水费' name,5 bill_type_value,'水费' bill_type,0 as need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_daily where type=1 - union + union all select id,merchant_id,shop_id,tenant_id,'电费' name,6 bill_type_value,'电费' bill_type,0 as need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_daily where type=2 - union + union all select id,merchant_id,shop_id,tenant_id,'空调费' name,9 bill_type_value,'空调费' bill_type,0 as need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_daily where type=3 - union + union all select id,merchant_id,shop_id,tenant_id,name,7 bill_type_value,'其他' bill_type,0 as need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_other - union + union all select id,merchant_id,shop_id,tenant_id,name,8 bill_type_value,'其他押金' bill_type,0 as need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_other_deposit @@ -417,11 +407,11 @@ select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_rent where is_preview = 0 - union + union all select id,merchant_id,shop_id,tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金' bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_rent_deposit - union + union all select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费' bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_property where is_preview = 0 @@ -429,23 +419,23 @@ select id,merchant_id,shop_id,tenant_id,'物业押金' name,4 bill_type_value,'物业押金' bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_property_deposit - union + union all select id,merchant_id,shop_id,tenant_id,'水费' name,5 bill_type_value,'水费' bill_type,0 as need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_daily where type=1 - union + union all select id,merchant_id,shop_id,tenant_id,'电费' name,6 bill_type_value,'电费' bill_type,0 as need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_daily where type=2 - union + union all select id,merchant_id,shop_id,tenant_id,'空调费' name,9 bill_type_value,'空调费' bill_type,0 as need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_daily where type=3 - union + union all select id,merchant_id,shop_id,tenant_id,name,7 bill_type_value,'其他' bill_type,0 as need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_other - union + union all select id,merchant_id,shop_id,tenant_id,name,8 bill_type_value,'其他押金' bill_type,0 as need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_other_deposit @@ -468,35 +458,35 @@ select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_rent where is_preview = 0 - union + union all select id,merchant_id,shop_id,tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金' bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_rent_deposit - union + union all select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费' bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_property where is_preview = 0 - union + union all select id,merchant_id,shop_id,tenant_id,'物业押金' name,4 bill_type_value,'物业押金' bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_property_deposit - union + union all select id,merchant_id,shop_id,tenant_id,'水费' name,5 bill_type_value,'水费' bill_type,0 as need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_daily where type=1 - union + union all select id,merchant_id,shop_id,tenant_id,'电费' name,6 bill_type_value,'电费' bill_type,0 as need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_daily where type=2 - union + union all select id,merchant_id,shop_id,tenant_id,'空调费' name,9 bill_type_value,'空调费' bill_type,0 as need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_daily where type=3 - union + union all select id,merchant_id,shop_id,tenant_id,name,7 bill_type_value,'其他' bill_type,0 as need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_other - union + union all select id,merchant_id,shop_id,tenant_id,name,8 bill_type_value,'其他押金' bill_type,0 as need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type from wx_bill_other_deposit