| @@ -353,4 +353,49 @@ | |||||
| where m.status=1 | where m.status=1 | ||||
| </select> | </select> | ||||
| <select id="getWaitPayBillForEmail" resultType="hashmap"> | |||||
| select bill.tenant_id tenantId,bill.merchant_id merchantId,bill.receive_date receiveDate, | |||||
| bill.need_pay needPay,m.link_phone linkPhone,app.appname,m.email,bill.bill_type billType,ws.manager,ws.manager_phone managerPhone from ( | |||||
| select bill.bill_type,bill.tenant_id,bill.merchant_id,bill.receive_date,ifnull(sum(need_pay),0) need_pay from ( | |||||
| 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 | |||||
| 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 | |||||
| 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 | |||||
| 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 | |||||
| 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 | |||||
| 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 | |||||
| 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 | |||||
| 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 | |||||
| ) bill | |||||
| group by bill.tenant_id,bill.merchant_id,bill.receive_date,bill.bill_type | |||||
| ) bill | |||||
| left join wx_merchant m on bill.merchant_id=m.id | |||||
| left join (select tenant_id,`name` appname from wx_appinfo app where type=1) app on bill.tenant_id=app.tenant_id | |||||
| left join wx_merchant_shop wms on wms.merchant_id = m.id | |||||
| left join wx_shop ws on wms.shop_id = ws.id | |||||
| where m.status=1 | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||