| @@ -6,7 +6,7 @@ | |||||
| <resultMap id="allVoResultMap" type="com.iformall.domain.vo.WxBillAllVo"> | <resultMap id="allVoResultMap" type="com.iformall.domain.vo.WxBillAllVo"> | ||||
| <id column="id" jdbcType="BIGINT" property="id" /> | <id column="id" jdbcType="BIGINT" property="id" /> | ||||
| <result column="tenantId" jdbcType="VARCHAR" property="tenantId" /> | <result column="tenantId" jdbcType="VARCHAR" property="tenantId" /> | ||||
| <result column="subTenantId" jdbcType="VARCHAR" property="subTenantId" /> | |||||
| <result column="subTenantId" jdbcType="VARCHAR" property="subTenantId" /> | |||||
| <result column="merchantId" jdbcType="INTEGER" property="merchantId" /> | <result column="merchantId" jdbcType="INTEGER" property="merchantId" /> | ||||
| <result column="shopId" jdbcType="INTEGER" property="shopId" /> | <result column="shopId" jdbcType="INTEGER" property="shopId" /> | ||||
| @@ -49,6 +49,7 @@ | |||||
| <select id="list" parameterType="com.iformall.domain.vo.WxBillAll" resultMap="allVoResultMap"> | <select id="list" parameterType="com.iformall.domain.vo.WxBillAll" resultMap="allVoResultMap"> | ||||
| select | select | ||||
| bill.id,bill.tenant_id tenantId,bill.sub_tenant_id subTenantId,bill.merchant_id merchantId,bill.shop_id shopId, | bill.id,bill.tenant_id tenantId,bill.sub_tenant_id subTenantId,bill.merchant_id merchantId,bill.shop_id shopId, | ||||
| bill.bill_type_value billTypeValue,bill.bill_type billType,bill.need_pay needPay, | bill.bill_type_value billTypeValue,bill.bill_type billType,bill.need_pay needPay, | ||||
| @@ -63,9 +64,9 @@ | |||||
| endtime,rent_shop_type,case when shop_info is null then '[]' else shop_info end shop_info,comments,'' | endtime,rent_shop_type,case when shop_info is null then '[]' else shop_info end shop_info,comments,'' | ||||
| price_detail,updatetime,freeze,ifnull(late_pay_price,0) late_pay_price,service_charge_pay | price_detail,updatetime,freeze,ifnull(late_pay_price,0) late_pay_price,service_charge_pay | ||||
| from wx_bill_rent | from wx_bill_rent | ||||
| where tenant_id=#{tenantId} | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| and is_preview = 0 | |||||
| where tenant_id=#{tenantId} | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| and is_preview = 0 | |||||
| union all | union all | ||||
| select id,merchant_id,shop_id,tenant_id,sub_tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金' | select id,merchant_id,shop_id,tenant_id,sub_tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金' | ||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime, | bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime, | ||||
| @@ -73,15 +74,16 @@ | |||||
| late_pay_price,0 service_charge_pay | late_pay_price,0 service_charge_pay | ||||
| from wx_bill_rent_deposit | from wx_bill_rent_deposit | ||||
| where tenant_id=#{tenantId} | where tenant_id=#{tenantId} | ||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| union all | union all | ||||
| select id,merchant_id,shop_id,tenant_id,sub_tenant_id,'物业费' name,3 bill_type_value,'物业费' | select id,merchant_id,shop_id,tenant_id,sub_tenant_id,'物业费' name,3 bill_type_value,'物业费' | ||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime, | 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,'' | endtime,rent_shop_type,case when shop_info is null then '[]' else shop_info end shop_info,comments,'' | ||||
| price_detail,updatetime,freeze,ifnull(late_pay_price,0) late_pay_price,service_charge_pay | price_detail,updatetime,freeze,ifnull(late_pay_price,0) late_pay_price,service_charge_pay | ||||
| from wx_bill_property where tenant_id=#{tenantId} | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| and is_preview = 0 | |||||
| from wx_bill_property | |||||
| where tenant_id=#{tenantId} | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| and is_preview = 0 | |||||
| union all | union all | ||||
| select id,merchant_id,shop_id,tenant_id,sub_tenant_id,'物业押金' name,4 bill_type_value,'物业押金' | select id,merchant_id,shop_id,tenant_id,sub_tenant_id,'物业押金' name,4 bill_type_value,'物业押金' | ||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime, | bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime, | ||||
| @@ -89,24 +91,22 @@ | |||||
| late_pay_price,0 service_charge_pay | late_pay_price,0 service_charge_pay | ||||
| from wx_bill_property_deposit | from wx_bill_property_deposit | ||||
| where tenant_id=#{tenantId} | where tenant_id=#{tenantId} | ||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| union all | union all | ||||
| select id,merchant_id,shop_id,tenant_id,sub_tenant_id, | |||||
| case when type=1 then '水费' when type=2 then '电费' else '空调费' end name, | |||||
| select id,merchant_id,shop_id,tenant_id,sub_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 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 | 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, | need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime, | ||||
| rent_shop_type,'[]' shop_info, NULL comments,price_detail,updatetime,freeze,0 late_pay_price,service_charge_pay | rent_shop_type,'[]' shop_info, NULL comments,price_detail,updatetime,freeze,0 late_pay_price,service_charge_pay | ||||
| from wx_bill_daily | |||||
| where tenant_id=#{tenantId} | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| from wx_bill_daily where tenant_id=#{tenantId} | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| union all | union all | ||||
| select id,merchant_id,shop_id,tenant_id,sub_tenant_id,name,7 bill_type_value,concat('其他费用-',name) as bill_type,0 as | select id,merchant_id,shop_id,tenant_id,sub_tenant_id,name,7 bill_type_value,concat('其他费用-',name) as bill_type,0 as | ||||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime, | need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime, | ||||
| rent_shop_type,'[]' shop_info,comments,'' price_detail,updatetime,freeze,0 late_pay_price,service_charge_pay | rent_shop_type,'[]' shop_info,comments,'' price_detail,updatetime,freeze,0 late_pay_price,service_charge_pay | ||||
| from wx_bill_other | from wx_bill_other | ||||
| where tenant_id=#{tenantId} | where tenant_id=#{tenantId} | ||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| union all | union all | ||||
| select id,merchant_id,shop_id,tenant_id,sub_tenant_id,comments as name,8 bill_type_value,concat('其他押金-',comments) as | select id,merchant_id,shop_id,tenant_id,sub_tenant_id,comments as name,8 bill_type_value,concat('其他押金-',comments) as | ||||
| bill_type,0 as | bill_type,0 as | ||||
| @@ -114,7 +114,7 @@ | |||||
| rent_shop_type,'[]' shop_info,comments,'' price_detail,updatetime,freeze,0 late_pay_price,service_charge_pay | rent_shop_type,'[]' shop_info,comments,'' price_detail,updatetime,freeze,0 late_pay_price,service_charge_pay | ||||
| from wx_bill_other_deposit | from wx_bill_other_deposit | ||||
| where tenant_id=#{tenantId} | where tenant_id=#{tenantId} | ||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| ) bill | ) bill | ||||
| left join wx_merchant m on bill.merchant_id=m.id | left join wx_merchant m on bill.merchant_id=m.id | ||||
| left join wx_shop s on bill.shop_id=s.id | left join wx_shop s on bill.shop_id=s.id | ||||
| @@ -122,9 +122,9 @@ | |||||
| <if test=" null != tenantId "> | <if test=" null != tenantId "> | ||||
| and bill.tenant_id=#{tenantId} | and bill.tenant_id=#{tenantId} | ||||
| </if> | </if> | ||||
| <if test=" null != subTenantId "> | |||||
| and bill.`sub_tenant_id` = #{subTenantId} | |||||
| </if> | |||||
| <if test=" null != subTenantId "> | |||||
| and bill.sub_tenant_id=#{subTenantId} | |||||
| </if> | |||||
| <if test=" null != month and ''!=month"> | <if test=" null != month and ''!=month"> | ||||
| and date_format(bill.receive_date,'%Y-%m')=#{month} | and date_format(bill.receive_date,'%Y-%m')=#{month} | ||||
| </if> | </if> | ||||
| @@ -197,8 +197,8 @@ | |||||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other_deposit | need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other_deposit | ||||
| ) bill | ) bill | ||||
| where bill.tenant_id=#{tenantId} | where bill.tenant_id=#{tenantId} | ||||
| <if test=" null != subTenantId "> and bill.`sub_tenant_id` = #{subTenantId} </if> | |||||
| and bill.status=#{status} | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| and bill.status=#{status} | |||||
| <if test=" null != starttime and null!= endtime "> | <if test=" null != starttime and null!= endtime "> | ||||
| and bill.receive_date between #{starttime} and #{endtime} | and bill.receive_date between #{starttime} and #{endtime} | ||||
| </if> | </if> | ||||
| @@ -254,7 +254,7 @@ | |||||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other_deposit | need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other_deposit | ||||
| ) bill | ) bill | ||||
| where bill.tenant_id=#{tenantId} | where bill.tenant_id=#{tenantId} | ||||
| <if test=" null != subTenantId "> and bill.`sub_tenant_id` = #{subTenantId} </if> | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| and bill.status=#{status} | and bill.status=#{status} | ||||
| <if test=" null != starttime and null!= endtime "> | <if test=" null != starttime and null!= endtime "> | ||||
| and bill.receive_date between #{starttime} and #{endtime} | and bill.receive_date between #{starttime} and #{endtime} | ||||
| @@ -282,8 +282,8 @@ | |||||
| from wx_bill_rent | from wx_bill_rent | ||||
| where is_preview = 0 | where is_preview = 0 | ||||
| and tenant_id=#{tenantId} | and tenant_id=#{tenantId} | ||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| and rent_contract_id in (select id from wx_rent_contract where status in (2,3,4)) | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| and rent_contract_id in (select id from wx_rent_contract where status in (2,3,4)) | |||||
| union all | union all | ||||
| select '' settle_number,id,merchant_id,shop_id,tenant_id,sub_tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金' | select '' settle_number,id,merchant_id,shop_id,tenant_id,sub_tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金' | ||||
| bill_type,need_pay,receive_pay,pay,(receive_pay-pay) | bill_type,need_pay,receive_pay,pay,(receive_pay-pay) | ||||
| @@ -291,7 +291,7 @@ | |||||
| price_detail,freeze,0 late_pay_price,0 service_charge_pay | price_detail,freeze,0 late_pay_price,0 service_charge_pay | ||||
| from wx_bill_rent_deposit | from wx_bill_rent_deposit | ||||
| where tenant_id=#{tenantId} | where tenant_id=#{tenantId} | ||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| and rent_contract_id in (select id from wx_rent_contract | and rent_contract_id in (select id from wx_rent_contract | ||||
| where status in (2,3,4)) | where status in (2,3,4)) | ||||
| union all | union all | ||||
| @@ -302,7 +302,7 @@ | |||||
| from wx_bill_property | from wx_bill_property | ||||
| where is_preview = 0 | where is_preview = 0 | ||||
| and tenant_id=#{tenantId} | and tenant_id=#{tenantId} | ||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| <if test=" null != subTenantId "> and sub_tenant_id=#{subTenantId}</if> | |||||
| and property_contract_id in (select id from | and property_contract_id in (select id from | ||||
| wx_property_contract | wx_property_contract | ||||
| where status in(2,3,4)) | where status in(2,3,4)) | ||||
| @@ -313,7 +313,7 @@ | |||||
| price_detail,freeze,0 late_pay_price,0 service_charge_pay | price_detail,freeze,0 late_pay_price,0 service_charge_pay | ||||
| from wx_bill_property_deposit | from wx_bill_property_deposit | ||||
| where tenant_id=#{tenantId} | where tenant_id=#{tenantId} | ||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| and property_contract_id in (select id from | and property_contract_id in (select id from | ||||
| wx_property_contract where status in | wx_property_contract where status in | ||||
| (2,3,4)) | (2,3,4)) | ||||
| @@ -324,26 +324,26 @@ | |||||
| pay,(receive_pay+service_charge_pay-pay) owe,receive_date,pay_date,expired_day,status,starttime,endtime, | pay,(receive_pay+service_charge_pay-pay) owe,receive_date,pay_date,expired_day,status,starttime,endtime, | ||||
| rent_shop_type,price_detail,freeze,0 late_pay_price,service_charge_pay | rent_shop_type,price_detail,freeze,0 late_pay_price,service_charge_pay | ||||
| from wx_bill_daily where tenant_id=#{tenantId} | from wx_bill_daily where tenant_id=#{tenantId} | ||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| union all | union all | ||||
| select '' settle_number,id,merchant_id,shop_id,tenant_id,sub_tenant_id,name,7 bill_type_vaue,'其他费用' bill_type,0 as | select '' settle_number,id,merchant_id,shop_id,tenant_id,sub_tenant_id,name,7 bill_type_vaue,'其他费用' bill_type,0 as | ||||
| need_pay,receive_pay,pay,(receive_pay+service_charge_pay-pay) owe,receive_date,pay_date,expired_day,status,'' | need_pay,receive_pay,pay,(receive_pay+service_charge_pay-pay) owe,receive_date,pay_date,expired_day,status,'' | ||||
| starttime,'' endtime,rent_shop_type,'' | starttime,'' endtime,rent_shop_type,'' | ||||
| price_detail,freeze,0 late_pay_price,service_charge_pay | price_detail,freeze,0 late_pay_price,service_charge_pay | ||||
| from wx_bill_other where tenant_id=#{tenantId} | from wx_bill_other where tenant_id=#{tenantId} | ||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| union all | union all | ||||
| select '' settle_number,id,merchant_id,shop_id,tenant_id,sub_tenant_id,comments as name,8 bill_type_value,'其他押金' bill_type,0 as | select '' settle_number,id,merchant_id,shop_id,tenant_id,sub_tenant_id,comments as name,8 bill_type_value,'其他押金' bill_type,0 as | ||||
| need_pay,receive_pay,pay,(receive_pay+service_charge_pay-pay) owe,receive_date,pay_date,expired_day,status,'' | need_pay,receive_pay,pay,(receive_pay+service_charge_pay-pay) owe,receive_date,pay_date,expired_day,status,'' | ||||
| starttime,'' endtime,rent_shop_type,'' | starttime,'' endtime,rent_shop_type,'' | ||||
| price_detail,freeze,0 late_pay_price,service_charge_pay | price_detail,freeze,0 late_pay_price,service_charge_pay | ||||
| from wx_bill_other_deposit where tenant_id=#{tenantId} | from wx_bill_other_deposit where tenant_id=#{tenantId} | ||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| union all | union all | ||||
| select s.settle_number,s.id,s.merchant_id,'' shop_id,s.tenant_id,s.sub_tenant_id,'结算单' name, 10 bill_type_value,'结算单' bill_type,0 need_pay, | |||||
| select s.settle_number,s.id,s.merchant_id,'' shop_id,s.tenant_id,sub_tenant_id,'结算单' name, 10 bill_type_value,'结算单' bill_type,0 need_pay, | |||||
| ((select IFNULL(sum(bill.owe),0) from wx_bill_settle_bill bb left join | ((select IFNULL(sum(bill.owe),0) from wx_bill_settle_bill bb left join | ||||
| (select id,merchant_id,shop_id,tenant_id,1 bill_type_value,'租金' | |||||
| (select id,merchant_id,shop_id,tenant_id,sub_tenant_id,1 bill_type_value,'租金' | |||||
| bill_type,need_pay,receive_pay,pay,(receive_pay+service_charge_pay+ifnull(late_pay_price,0)-pay) | bill_type,need_pay,receive_pay,pay,(receive_pay+service_charge_pay+ifnull(late_pay_price,0)-pay) | ||||
| owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_rent where is_preview = 0 | owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_rent where is_preview = 0 | ||||
| union all | union all | ||||
| @@ -442,7 +442,7 @@ | |||||
| status,'' starttime,'' endtime,'' rent_shop_type,'' price_detail, 0 freeze, | status,'' starttime,'' endtime,'' rent_shop_type,'' price_detail, 0 freeze, | ||||
| 0 late_pay_price,0 service_charge_pay | 0 late_pay_price,0 service_charge_pay | ||||
| from wx_bill_settle s where s.tenant_id=#{tenantId} | from wx_bill_settle s where s.tenant_id=#{tenantId} | ||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| <if test=" null != subTenantId "> and s.`sub_tenant_id` = #{subTenantId} </if> | |||||
| and s.status >0 | and s.status >0 | ||||
| ) bill | ) bill | ||||
| @@ -457,9 +457,9 @@ | |||||
| <if test=" null != tenantId "> | <if test=" null != tenantId "> | ||||
| and bill.tenant_id=#{tenantId} | and bill.tenant_id=#{tenantId} | ||||
| </if> | </if> | ||||
| <if test=" null != subTenantId "> | |||||
| and bill.sub_tenant_id=#{subTenantId} | |||||
| </if> | |||||
| <if test=" null != subTenantId "> | |||||
| and bill.sub_tenant_id=#{subTenantId} | |||||
| </if> | |||||
| <if test=" null != merchantId "> | <if test=" null != merchantId "> | ||||
| and bill.merchant_id=#{merchantId} | and bill.merchant_id=#{merchantId} | ||||
| </if> | </if> | ||||
| @@ -493,9 +493,9 @@ | |||||
| <select id="getWaitPayBill" resultType="hashmap"> | <select id="getWaitPayBill" resultType="hashmap"> | ||||
| select bill.tenant_id tenantId,bill.sub_tenant_id sub_tenant_id,bill.merchant_id merchantId,m.name merchantName,bill.receive_date receiveDate, | |||||
| select bill.tenant_id tenantId,bill.sub_tenant_id subTenantId,bill.merchant_id merchantId,m.name merchantName,bill.receive_date receiveDate, | |||||
| bill.need_pay needPay,m.link_phone linkPhone,app.appname,m.email,bill.bill_type billType from ( | bill.need_pay needPay,m.link_phone linkPhone,app.appname,m.email,bill.bill_type billType from ( | ||||
| select bill.bill_type,bill.tenant_id,bill.sub_tenant_id,bill.merchant_id,bill.receive_date,ifnull(sum(need_pay),0) need_pay from ( | |||||
| select bill.bill_type,bill.tenant_id,sub_tenant_id,bill.merchant_id,bill.receive_date,ifnull(sum(need_pay),0) need_pay from ( | |||||
| select id,merchant_id,shop_id,tenant_id,sub_tenant_id,'租金' name,1 bill_type_value,'租金' | select id,merchant_id,shop_id,tenant_id,sub_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,'' | 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 | endtime,rent_shop_type from wx_bill_rent where is_preview = 0 | ||||
| @@ -535,13 +535,13 @@ | |||||
| where bill.status not in(3,5,6) | where bill.status not in(3,5,6) | ||||
| group by bill.tenant_id,bill.sub_tenant_id,bill.merchant_id,bill.receive_date) bill | group by bill.tenant_id,bill.sub_tenant_id,bill.merchant_id,bill.receive_date) bill | ||||
| left join wx_merchant m on bill.merchant_id=m.id | 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 (select tenant_id,sub_tenant_id,`name` appname from wx_appinfo app where type=1) app on bill.tenant_id=app.tenant_id | |||||
| where m.status=1 and DATEDIFF(bill.receive_date,now())=m.bill_setting | where m.status=1 and DATEDIFF(bill.receive_date,now())=m.bill_setting | ||||
| </select> | </select> | ||||
| <select id="getOweBill" resultType="hashmap"> | <select id="getOweBill" resultType="hashmap"> | ||||
| select bill.tenant_id tenantId,bill.sub_tenant_id sub_tenant_id,bill.merchant_id merchantId,m.name merchantName,bill.owe,m.link_phone linkPhone,app.appname from ( | |||||
| select bill.tenant_id tenantId,bill.sub_tenant_id subTenantId,bill.merchant_id merchantId,m.name merchantName,bill.owe,m.link_phone linkPhone,app.appname from ( | |||||
| select bill.tenant_id,bill.sub_tenant_id,bill.merchant_id,sum(owe) owe from ( | select bill.tenant_id,bill.sub_tenant_id,bill.merchant_id,sum(owe) owe from ( | ||||
| select id,merchant_id,shop_id,tenant_id,sub_tenant_id,'租金' name,1 bill_type_value,'租金' | select id,merchant_id,shop_id,tenant_id,sub_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,'' | bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' | ||||
| @@ -582,12 +582,12 @@ | |||||
| where DATEDIFF(bill.receive_date,now())<0 and bill.status not in(3,5,6) | where DATEDIFF(bill.receive_date,now())<0 and bill.status not in(3,5,6) | ||||
| group by bill.tenant_id,bill.sub_tenant_id,bill.merchant_id) bill | group by bill.tenant_id,bill.sub_tenant_id,bill.merchant_id) bill | ||||
| left join wx_merchant m on bill.merchant_id=m.id | 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 (select tenant_id,sub_tenant_id,`name` appname from wx_appinfo app where type=1) app on bill.tenant_id=app.tenant_id | |||||
| where m.status=1 | where m.status=1 | ||||
| </select> | </select> | ||||
| <select id="getWaitPayBillForEmail" resultType="hashmap"> | <select id="getWaitPayBillForEmail" resultType="hashmap"> | ||||
| select bill.tenant_id tenantId,bill.sub_tenant_id sub_tenant_id,bill.merchant_id merchantId,m.name merchantName,bill.receive_date receiveDate, | |||||
| select bill.tenant_id tenantId,bill.sub_tenant_id subTenantId,bill.merchant_id merchantId,m.name merchantName,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 ( | 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.sub_tenant_id,bill.merchant_id,bill.receive_date,ifnull(sum(need_pay),0) need_pay from ( | select bill.bill_type,bill.tenant_id,bill.sub_tenant_id,bill.merchant_id,bill.receive_date,ifnull(sum(need_pay),0) need_pay from ( | ||||
| select id,merchant_id,shop_id,tenant_id,sub_tenant_id,'租金' name,1 bill_type_value,'租金' | select id,merchant_id,shop_id,tenant_id,sub_tenant_id,'租金' name,1 bill_type_value,'租金' | ||||
| @@ -630,14 +630,14 @@ | |||||
| group by bill.tenant_id,bill.sub_tenant_id,bill.merchant_id,bill.receive_date,bill.bill_type | group by bill.tenant_id,bill.sub_tenant_id,bill.merchant_id,bill.receive_date,bill.bill_type | ||||
| ) bill | ) bill | ||||
| left join wx_merchant m on bill.merchant_id=m.id | 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 (select tenant_id,sub_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_merchant_shop wms on wms.merchant_id = m.id | ||||
| left join wx_shop ws on wms.shop_id = ws.id | left join wx_shop ws on wms.shop_id = ws.id | ||||
| where m.status=1 and DATEDIFF(bill.receive_date,now())=m.bill_setting | where m.status=1 and DATEDIFF(bill.receive_date,now())=m.bill_setting | ||||
| </select> | </select> | ||||
| <select id="getOweBillForEmail" resultType="hashmap"> | <select id="getOweBillForEmail" resultType="hashmap"> | ||||
| select bill.tenant_id tenantId,bill.sub_tenant_id subTenantId,bill.merchant_id merchantId,bill.bill_type billType,bill.owe owe,m.link_phone managerPhone,m.`link_person` manager,m.email,app.appname,bill.receive_date receiveDate | |||||
| select bill.tenant_id tenantId,bill.sub_tenant_id, subTenantId,bill.merchant_id merchantId,bill.bill_type billType,bill.owe owe,m.link_phone managerPhone,m.`link_person` manager,m.email,app.appname,bill.receive_date receiveDate | |||||
| ,DATEDIFF(now(),bill.receive_date) expiredDay from ( | ,DATEDIFF(now(),bill.receive_date) expiredDay from ( | ||||
| select bill.tenant_id,bill.sub_tenant_id,bill.merchant_id,bill.bill_type,sum(owe) owe,bill.receive_date,bill.expired_day from ( | select bill.tenant_id,bill.sub_tenant_id,bill.merchant_id,bill.bill_type,sum(owe) owe,bill.receive_date,bill.expired_day from ( | ||||
| @@ -681,7 +681,7 @@ | |||||
| where DATEDIFF(bill.receive_date,now())<0 and bill.status not in(3,5,6) | where DATEDIFF(bill.receive_date,now())<0 and bill.status not in(3,5,6) | ||||
| group by bill.tenant_id,bill.sub_tenant_id,bill.merchant_id,bill.bill_type) bill | group by bill.tenant_id,bill.sub_tenant_id,bill.merchant_id,bill.bill_type) bill | ||||
| left join wx_merchant m on bill.merchant_id=m.id | 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 (select tenant_id,sub_tenant_id,`name` appname from wx_appinfo app where type=1) app on bill.tenant_id=app.tenant_id | |||||
| where m.status=1 | where m.status=1 | ||||
| </select> | </select> | ||||
| @@ -702,7 +702,7 @@ | |||||
| </sql> | </sql> | ||||
| <select id="getOweBillAsPage" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap"> | <select id="getOweBillAsPage" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap"> | ||||
| select bill.tenant_id tenantId,bill.sub_tenant_id sub_tenantId,bill.merchant_id merchantId,m.name merchantName,bill.bill_type billType, | |||||
| select bill.tenant_id tenantId,bill.sub_tenant_id subTenantId,bill.merchant_id merchantId,m.name merchantName,bill.bill_type billType, | |||||
| m.link_phone managerPhone,m.`link_person` manager,m.email, | m.link_phone managerPhone,m.`link_person` manager,m.email, | ||||
| bill.receive_date receiveDate,DATEDIFF(now(),bill.receive_date) expiredDay, | bill.receive_date receiveDate,DATEDIFF(now(),bill.receive_date) expiredDay, | ||||
| @@ -770,70 +770,66 @@ | |||||
| max(case oweList.bill_type when '其他费用' then oweList.serviceChargePay else 0 end) otherServiceChargePay | max(case oweList.bill_type when '其他费用' then oweList.serviceChargePay else 0 end) otherServiceChargePay | ||||
| from( | from( | ||||
| select bill.tenant_id,bill.sub_tenant_id,bill.merchant_id,bill.bill_type,sum(owe) owe, | |||||
| bill.receive_date,bill.expired_day,sum(bill.receive_pay) receive_pay,sum(bill.pay) pay, | |||||
| sum(ifnull(bill.late_pay_price,0)) latePayPrice,sum(bill.service_charge_pay) serviceChargePay from ( | |||||
| select bill.tenant_id,bill.sub_tenant_id,bill.merchant_id,bill.bill_type,sum(owe) | |||||
| owe,bill.receive_date,bill.expired_day,sum(bill.receive_pay) receive_pay,sum(bill.pay) | |||||
| pay,sum(ifnull(bill.late_pay_price,0)) latePayPrice,sum(bill.service_charge_pay) serviceChargePay from ( | |||||
| select id,merchant_id,shop_id,tenant_id,sub_tenant_id,'租金' name,1 bill_type_value,'租金' | select id,merchant_id,shop_id,tenant_id,sub_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,late_pay_price,service_charge_pay from wx_bill_rent | |||||
| where tenant_id = #{tenantId} | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| and is_preview = 0 | |||||
| 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,late_pay_price,service_charge_pay from wx_bill_rent where tenant_id = #{tenantId} | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| and is_preview = 0 | |||||
| <include refid="getOweBillAsPageConditions"/> | <include refid="getOweBillAsPageConditions"/> | ||||
| union all | union all | ||||
| select id,merchant_id,shop_id,tenant_id,sub_tenant_id,'物业费' name,3 bill_type_value,'物业费' | select id,merchant_id,shop_id,tenant_id,sub_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,'' | 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,late_pay_price,service_charge_pay from wx_bill_property | |||||
| where tenant_id = #{tenantId} | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| and is_preview = 0 | |||||
| endtime,rent_shop_type,late_pay_price,service_charge_pay from wx_bill_property where tenant_id = #{tenantId} | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| and is_preview = 0 | |||||
| <include refid="getOweBillAsPageConditions"/> | <include refid="getOweBillAsPageConditions"/> | ||||
| union all | union all | ||||
| select res.id,res.merchant_id,res.shop_id,res.tenant_id,sub_tenant_id,res.name,res.bill_type_value,res.bill_type,res.need_pay, | |||||
| res.receive_pay,res.pay,res.owe owe, | |||||
| res.receive_date,res.pay_date,res.expired_day,res.status,res.starttime,res.endtime,res.rent_shop_type, | |||||
| 0 late_pay_price,0 service_charge_pay from( | |||||
| select res.id,res.merchant_id,res.shop_id,res.tenant_id,res.sub_tenant_id,res.name,res.bill_type_value,res.bill_type,res.need_pay, | |||||
| res.receive_pay,res.pay,res.owe | |||||
| owe,res.receive_date,res.pay_date,res.expired_day,res.status,res.starttime,res.endtime,res.rent_shop_type,0 | |||||
| late_pay_price,0 service_charge_pay from( | |||||
| select id,merchant_id,shop_id,tenant_id,sub_tenant_id,'欠缴押金' name,2 bill_type_value,'欠缴押金' | select id,merchant_id,shop_id,tenant_id,sub_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,'' | 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,service_charge_pay from wx_bill_rent_deposit | |||||
| where tenant_id = #{tenantId} | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| endtime,rent_shop_type,service_charge_pay from wx_bill_rent_deposit where tenant_id = #{tenantId} | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| <include refid="getOweBillAsPageConditions"/> | <include refid="getOweBillAsPageConditions"/> | ||||
| union all | union all | ||||
| select id,merchant_id,shop_id,tenant_id,sub_tenant_id,'欠缴押金' name,4 bill_type_value,'欠缴押金' | select id,merchant_id,shop_id,tenant_id,sub_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,'' | 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,0 service_charge_pay from wx_bill_property_deposit where tenant_id = #{tenantId} | endtime,rent_shop_type,0 service_charge_pay from wx_bill_property_deposit where tenant_id = #{tenantId} | ||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| <include refid="getOweBillAsPageConditions"/> | <include refid="getOweBillAsPageConditions"/> | ||||
| union all | union all | ||||
| select id,merchant_id,shop_id,tenant_id,sub_tenant_id,'欠缴押金' name,8 bill_type_value,'欠缴押金' bill_type,0 as | select id,merchant_id,shop_id,tenant_id,sub_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, | 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,service_charge_pay | pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type,service_charge_pay | ||||
| from wx_bill_other_deposit where tenant_id = #{tenantId} | from wx_bill_other_deposit where tenant_id = #{tenantId} | ||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| <include refid="getOweBillAsPageConditions"/> | <include refid="getOweBillAsPageConditions"/> | ||||
| ) res | ) res | ||||
| union all | union all | ||||
| select res.id,res.merchant_id,res.shop_id,res.tenant_id,sub_tenant_id,res.name,res.bill_type_value,res.bill_type,res.need_pay, | |||||
| res.receive_pay,res.pay,res.owe owe, | |||||
| res.receive_date,res.pay_date,res.expired_day,res.status,res.starttime,res.endtime,res.rent_shop_type0 | |||||
| late_pay_price,service_charge_pay | |||||
| from( | |||||
| select res.id,res.merchant_id,res.shop_id,res.tenant_id,res.sub_tenant_id,res.name,res.bill_type_value,res.bill_type,res.need_pay, | |||||
| res.receive_pay,res.pay,res.owe | |||||
| owe,res.receive_date,res.pay_date,res.expired_day,res.status,res.starttime,res.endtime,res.rent_shop_type,0 | |||||
| late_pay_price,service_charge_pay from( | |||||
| select id,merchant_id,shop_id,tenant_id,sub_tenant_id,'其他费用' name,5 bill_type_value,'其他费用' bill_type,0 as | select id,merchant_id,shop_id,tenant_id,sub_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, | 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,service_charge_pay | expired_day,status,'' starttime,'' endtime,rent_shop_type,service_charge_pay | ||||
| from wx_bill_daily where tenant_id = #{tenantId} | from wx_bill_daily where tenant_id = #{tenantId} | ||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| and type in(1,2,3) | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| and type in(1,2,3) | |||||
| <include refid="getOweBillAsPageConditions"/> | <include refid="getOweBillAsPageConditions"/> | ||||
| union all | union all | ||||
| select id,merchant_id,shop_id,tenant_id,sub_tenant_id,'其他费用' name,7 bill_type_value,'其他费用' bill_type,0 as | select id,merchant_id,shop_id,tenant_id,sub_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, | 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,service_charge_pay | expired_day,status,'' starttime,'' endtime,rent_shop_type,service_charge_pay | ||||
| from wx_bill_other where tenant_id = #{tenantId} | from wx_bill_other where tenant_id = #{tenantId} | ||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| <include refid="getOweBillAsPageConditions"/> | <include refid="getOweBillAsPageConditions"/> | ||||
| ) res | ) res | ||||
| @@ -846,13 +842,14 @@ | |||||
| ) bill | ) bill | ||||
| left join wx_merchant m on bill.merchant_id=m.id | left join wx_merchant m on bill.merchant_id=m.id | ||||
| where m.tenant_id = #{tenantId} | where m.tenant_id = #{tenantId} | ||||
| <if test=" null != subTenantId "> and m.`sub_tenant_id` = #{subTenantId} </if> | |||||
| <if test=" null != subTenantId "> and m.`sub_tenant_id` = #{subTenantId} </if> | |||||
| <if test=" null != merchantName and '' != merchantName">and m.name like concat('%', #{merchantName},'%')</if> | <if test=" null != merchantName and '' != merchantName">and m.name like concat('%', #{merchantName},'%')</if> | ||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | <if test=" null != sortColumns"> order by ${sortColumns} </if> | ||||
| <if test=" null == sortColumns"> order by totalOwe desc </if> | <if test=" null == sortColumns"> order by totalOwe desc </if> | ||||
| </select> | </select> | ||||
| <select id="getReceiveAndPayBillAsPage" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap"> | <select id="getReceiveAndPayBillAsPage" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap"> | ||||
| select tt.* from ( | select tt.* from ( | ||||
| select m.tenant_id,m.sub_tenant_id,m.id,m.name,ws.shop_number shopNumber,ws.type,m.link_person linkPerson,m.link_phone linkPhone, | select m.tenant_id,m.sub_tenant_id,m.id,m.name,ws.shop_number shopNumber,ws.type,m.link_person linkPerson,m.link_phone linkPhone, | ||||
| xb.title business,rc.rental_start_date rentalStartDate,rc.rental_end_date rentalEndDate,rc.rent_shop_type, | xb.title business,rc.rental_start_date rentalStartDate,rc.rental_end_date rentalEndDate,rc.rent_shop_type, | ||||
| @@ -899,36 +896,30 @@ | |||||
| select receive_pay money,merchant_id id from wx_bill_other_deposit where status = 3 | select receive_pay money,merchant_id id from wx_bill_other_deposit where status = 3 | ||||
| )ss where ss.id = m.id | )ss where ss.id = m.id | ||||
| )/100,2),0) payOut, | )/100,2),0) payOut, | ||||
| (ifnull(round( | (ifnull(round( | ||||
| (select sum(bill.receive_pay)+sum(bill.late_pay_price)+sum(bill.receivePay) from ( | (select sum(bill.receive_pay)+sum(bill.late_pay_price)+sum(bill.receivePay) from ( | ||||
| select merchant_id,receive_pay,ifnull(service_charge_pay,0) receivePay,late_pay_price | |||||
| from wx_bill_rent | |||||
| select merchant_id,receive_pay,ifnull(service_charge_pay,0) receivePay,late_pay_price from | |||||
| wx_bill_rent | |||||
| where is_preview = 0 and status not in(3,6) | where is_preview = 0 and status not in(3,6) | ||||
| union all | union all | ||||
| select merchant_id,receive_pay,0 receivePay,0 late_pay_price | |||||
| from wx_bill_rent_deposit | |||||
| where status not in(3,6) | |||||
| select merchant_id,receive_pay,0 receivePay,0 late_pay_price from | |||||
| wx_bill_rent_deposit where status not in(3,6) | |||||
| union all | union all | ||||
| select merchant_id,receive_pay,ifnull(service_charge_pay,0) receivePay,late_pay_price | |||||
| from wx_bill_property | |||||
| where is_preview = 0 and status not in(3,6) | |||||
| select merchant_id,receive_pay,ifnull(service_charge_pay,0) receivePay,late_pay_price from | |||||
| wx_bill_property where is_preview = 0 and status not in(3,6) | |||||
| union all | union all | ||||
| select merchant_id,receive_pay,0 receivePay,0 late_pay_price | |||||
| from wx_bill_property_deposit | |||||
| where status not in(3,6) | |||||
| select merchant_id,receive_pay,0 receivePay,0 late_pay_price from | |||||
| wx_bill_property_deposit where status not in(3,6) | |||||
| union all | union all | ||||
| select merchant_id,receive_pay,ifnull(service_charge_pay,0) receivePay,0 late_pay_price | |||||
| from wx_bill_daily | |||||
| where type in(1,2,3) and status not in(3,6) | |||||
| select merchant_id,receive_pay,ifnull(service_charge_pay,0) receivePay,0 late_pay_price from | |||||
| wx_bill_daily where type in(1,2,3) and status not in(3,6) | |||||
| union all | union all | ||||
| select merchant_id,receive_pay,ifnull(service_charge_pay,0) receivePay,0 late_pay_price | |||||
| from wx_bill_other | |||||
| where status not in(3,6) | |||||
| select merchant_id,receive_pay,ifnull(service_charge_pay,0) receivePay,0 late_pay_price from | |||||
| wx_bill_other where status not in(3,6) | |||||
| union all | union all | ||||
| select merchant_id,receive_pay,ifnull(service_charge_pay,0) receivePay,0 late_pay_price | |||||
| from wx_bill_other_deposit | |||||
| where status not in(3,6) | |||||
| select merchant_id,receive_pay,ifnull(service_charge_pay,0) receivePay,0 late_pay_price from | |||||
| wx_bill_other_deposit where status not in(3,6) | |||||
| ) bill where bill.merchant_id = m.id | ) bill where bill.merchant_id = m.id | ||||
| )/100,2),0)- | )/100,2),0)- | ||||
| ifnull(round( | ifnull(round( | ||||
| @@ -958,8 +949,9 @@ | |||||
| left join wx_rent_contract rc on(rc.merchant_id = m.id) | left join wx_rent_contract rc on(rc.merchant_id = m.id) | ||||
| where m.status=1 | where m.status=1 | ||||
| ) tt where 1=1 | ) tt where 1=1 | ||||
| <if test=" null != tenantId"> and tt.tenant_id = #{tenantId} </if> | <if test=" null != tenantId"> and tt.tenant_id = #{tenantId} </if> | ||||
| <if test=" null != subTenantId"> and tt.sub_tenant_id = #{subTenantId} </if> | |||||
| <if test=" null != subTenantId "> and tt.`sub_tenant_id` = #{subTenantId} </if> | |||||
| <if test=" null != merchantId"> and tt.id = #{merchantId} </if> | <if test=" null != merchantId"> and tt.id = #{merchantId} </if> | ||||
| <if test=" null != merchantName and ''!=merchantName">and tt.name like concat('%', #{merchantName},'%')</if> | <if test=" null != merchantName and ''!=merchantName">and tt.name like concat('%', #{merchantName},'%')</if> | ||||
| <if test=" null != rentShopType"> and tt.rent_shop_type = #{rentShopType} </if> | <if test=" null != rentShopType"> and tt.rent_shop_type = #{rentShopType} </if> | ||||
| @@ -976,23 +968,25 @@ | |||||
| select bill.* | select bill.* | ||||
| from ( | from ( | ||||
| select id,merchant_id,shop_id,tenant_id,sub_tenant_id,'租赁押金' name,2 billTypeValue,'租赁押金' | select id,merchant_id,shop_id,tenant_id,sub_tenant_id,'租赁押金' name,2 billTypeValue,'租赁押金' | ||||
| billType,need_pay,receive_pay receivePay,pay,owe,receive_date receiveDate,pay_date,expired_day,status,freeze, | |||||
| 0 late_pay_price,0 service_charge_pay | |||||
| billType,need_pay,receive_pay receivePay,pay,owe,receive_date receiveDate,pay_date,expired_day,status,freeze,0 | |||||
| late_pay_price,0 | |||||
| service_charge_pay | |||||
| from wx_bill_rent_deposit where tenant_id=#{tenantId} | from wx_bill_rent_deposit where tenant_id=#{tenantId} | ||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| union all | union all | ||||
| select id,merchant_id,shop_id,tenant_id,sub_tenant_id,'物业押金' name,4 billTypeValue,'物业押金' | select id,merchant_id,shop_id,tenant_id,sub_tenant_id,'物业押金' name,4 billTypeValue,'物业押金' | ||||
| billType,need_pay,receive_pay receivePay,pay,owe,receive_date receiveDate,pay_date,expired_day,status,freeze, | |||||
| 0 late_pay_price,0 service_charge_pay | |||||
| billType,need_pay,receive_pay receivePay,pay,owe,receive_date receiveDate,pay_date,expired_day,status,freeze,0 | |||||
| late_pay_price,0 | |||||
| service_charge_pay | |||||
| from wx_bill_property_deposit where tenant_id=#{tenantId} | from wx_bill_property_deposit where tenant_id=#{tenantId} | ||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| union all | union all | ||||
| select id,merchant_id,shop_id,tenant_id,sub_tenant_id,comments as name,8 billTypeValue,concat('其他押金-',comments) as | select id,merchant_id,shop_id,tenant_id,sub_tenant_id,comments as name,8 billTypeValue,concat('其他押金-',comments) as | ||||
| billType,0 as need_pay,receive_pay receivePay,pay,owe,receive_date | billType,0 as need_pay,receive_pay receivePay,pay,owe,receive_date | ||||
| receiveDate,pay_date,expired_day,status,freeze,0 | receiveDate,pay_date,expired_day,status,freeze,0 | ||||
| late_pay_price,service_charge_pay | late_pay_price,service_charge_pay | ||||
| from wx_bill_other_deposit where tenant_id=#{tenantId} | from wx_bill_other_deposit where tenant_id=#{tenantId} | ||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| <if test=" null != subTenantId "> and `sub_tenant_id` = #{subTenantId} </if> | |||||
| ) bill | ) bill | ||||
| where 1=1 | where 1=1 | ||||
| <if test=" null != freeze"> and bill.freeze = #{freeze} </if> | <if test=" null != freeze"> and bill.freeze = #{freeze} </if> | ||||