@@ -46,112 +46,8 @@
<result column="service_charge_pay" property="serviceChargePay"/>
</resultMap>
<select id="list" parameterType="com.iformall.domain.vo.WxBillAll" resultMap="allVoResultMap">
select
bill.id,bill.tenant_id tenantId,bill.parent_tenant_id parentTenantId,bill.merchant_id merchantId,bill.shop_id shopId,
bill.bill_type_value billTypeValue,bill.bill_type billType,bill.need_pay needPay,
bill.receive_pay receivePay,bill.pay,bill.owe,bill.receive_date receiveDate,
bill.pay_date payDate,expired_day expiredDay,bill.status,bill.starttime,
bill.endtime,bill.name,bill.rent_shop_type rentShopType,m.name merchantName,
s.shop_number shopNumber, s.manager, s.manager_phone managerPhone,bill.shop_info
shopInfo,bill.comments,bill.price_detail,updatetime,bill.freeze,bill.late_pay_price,bill.service_charge_pay
from (
select id,merchant_id,shop_id,tenant_id,parent_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,''
price_detail,updatetime,freeze,ifnull(late_pay_price,0) late_pay_price,service_charge_pay
from wx_bill_rent
where is_preview = 0
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
union all
select id,merchant_id,shop_id,tenant_id,parent_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,'' price_detail,updatetime,freeze,0
late_pay_price,0 service_charge_pay
from wx_bill_rent_deposit
where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
union all
select id,merchant_id,shop_id,tenant_id,parent_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,''
price_detail,updatetime,freeze,ifnull(late_pay_price,0) late_pay_price,service_charge_pay
from wx_bill_property
where is_preview = 0
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
union all
select id,merchant_id,shop_id,tenant_id,parent_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,'' price_detail,updatetime,freeze,0
late_pay_price,0 service_charge_pay
from wx_bill_property_deposit
where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
union all
select id,merchant_id,shop_id,tenant_id,parent_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,price_detail,updatetime,freeze,0 late_pay_price,service_charge_pay
from wx_bill_daily where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
union all
select id,merchant_id,shop_id,tenant_id,parent_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,
rent_shop_type,'[]' shop_info,comments,'' price_detail,updatetime,freeze,0 late_pay_price,service_charge_pay
from wx_bill_other
where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
union all
select id,merchant_id,shop_id,tenant_id,parent_tenant_id,comments as name,8 bill_type_value,concat('其他押金-',comments) as
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,'' price_detail,updatetime,freeze,0 late_pay_price,service_charge_pay
from wx_bill_other_deposit
where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
) bill
left join wx_merchant m on bill.merchant_id=m.id
left join wx_shop s on bill.shop_id=s.id
where 1=1
<sql id = "billConditionSql" >
<if test=" null != tenantId and '' != tenantId">
and bill.`tenant_id` = #{tenantId}
</if>
@@ -161,7 +57,6 @@
<if test=" null != month and ''!=month">
and date_format(bill.receive_date,'%Y-%m')=#{month}
</if>
<if test=" null != merchantName and ''!=merchantName ">and m.`name` like concat('%',#{merchantName},'%')</if>
<if test=" null != billTypeValue ">and bill.bill_type_value = #{billTypeValue}</if>
<if test=" null != status ">and bill.`status` = #{status}</if>
<if test=" null != rentShopType ">and bill.rent_shop_type = #{rentShopType}</if>
@@ -186,11 +81,85 @@
</if>
<if test=" null != freeze ">and bill.freeze = #{freeze}</if>
<if test=" null != id ">and bill.id = #{id}</if>
<if test=" null != merchantIdList ">
and bill.`merchant_id` in
<foreach collection="merchantIdList" index="index" item="merchantIdItem" open="(" separator="," close=")">
#{merchantIdItem}
</foreach>
</if>
<if test=" null != sortColumns"> order by ${sortColumns} </if>
<if test=" null == sortColumns"> order by bill.receive_date,bill.id desc,bill.merchant_id,bill.status</if>
</sql>
<select id="listRentBill" parameterType="com.iformall.domain.vo.WxBillAll" resultMap="allVoResultMap">
select id,merchant_id merchantId,shop_id shopId,tenant_id tenantId,parent_tenant_id parentTenantId,'租金' name,1 billTypeValue,'租金' billType,
need_pay needPay,receive_pay receivePay,pay,owe,receive_date receiveDate,pay_date payDate,expired_day expiredDay,status,starttime,
endtime,rent_shop_type rentShopType,
case when shop_info is null then '[]' else shop_info end shopInfo,
comments,'' price_detail,updatetime,freeze,ifnull(late_pay_price,0) late_pay_price,service_charge_pay
from wx_bill_rent bill
where is_preview = 0
<include refid="billConditionSql"/>
</select>
<select id="listRentDepositBill" parameterType="com.iformall.domain.vo.WxBillAll" resultMap="allVoResultMap">
select id,merchant_id merchantId,shop_id shopId,tenant_id tenantId,parent_tenant_id parentTenantId,'租赁押金' name,2 billTypeValue,'租赁押金' billType,
need_pay needPay,receive_pay receivePay,pay,owe,receive_date receiveDate,pay_date payDate,expired_day expiredDay,status,starttime,
endtime,rent_shop_type rentShopType,shop_info shopInfo,NULL comments,'' price_detail,updatetime,freeze,0 late_pay_price,0 service_charge_pay
from wx_bill_rent_deposit bill
where bill.`tenant_id` = #{tenantId}
<include refid="billConditionSql"/>
</select>
<select id="listPropertyBill" parameterType="com.iformall.domain.vo.WxBillAll" resultMap="allVoResultMap">
select id,merchant_id merchantId,shop_id shopId,tenant_id tenantId,parent_tenant_id parentTenantId,'物业费' name,3 billTypeValue,'物业费' billType,
need_pay needPay,receive_pay receivePay,pay,owe,receive_date receiveDate,pay_date payDate,expired_day expiredDay,status,starttime,
endtime,rent_shop_type rentShopType,case when shop_info is null then '[]' else shop_info end shopInfo,comments,'' price_detail,updatetime,
freeze,ifnull(late_pay_price,0) late_pay_price,service_charge_pay
from wx_bill_property bill
where is_preview = 0
<include refid="billConditionSql"/>
</select>
<select id="listPropertyDepositBill" parameterType="com.iformall.domain.vo.WxBillAll" resultMap="allVoResultMap">
select id,merchant_id merchantId,shop_id shopId,tenant_id tenantId,parent_tenant_id parentTenantId,'物业押金' name,4 billTypeValue,'物业押金' billType,
need_pay needPay,receive_pay receivePay,pay,owe,receive_date receiveDate,pay_date payDate,expired_day expiredDay,status,starttime,
endtime,rent_shop_type rentShopType,shop_info shopInfo,NULL comments,'' price_detail,updatetime,freeze,0 late_pay_price,0 service_charge_pay
from wx_bill_property_deposit bill
where bill.`tenant_id` = #{tenantId}
<include refid="billConditionSql"/>
</select>
<select id="listDailyBill" parameterType="com.iformall.domain.vo.WxBillAll" resultMap="allVoResultMap">
select id,merchant_id merchantId,shop_id shopId,tenant_id tenantId,parent_tenant_id parentTenantId,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 billTypeValue,
case when type=1 then '水费' when type=2 then '电费' else '空调费' end billType,
0 as needPay,receive_pay receivePay,pay,owe,receive_date receiveDate,pay_date payDate,expired_day expiredDay,status,starttime,endtime,
rent_shop_type rentShopType,'[]' shopInfo, NULL comments,price_detail,updatetime,freeze,0 late_pay_price,service_charge_pay
from wx_bill_daily bill
where bill.`tenant_id` = #{tenantId}
<include refid="billConditionSql"/>
</select>
<select id="listOtherBill" parameterType="com.iformall.domain.vo.WxBillAll" resultMap="allVoResultMap">
select id,merchant_id merchantId,shop_id shopId,tenant_id tenantId,parent_tenant_id parentTenantId,name,7 billTypeValue,concat('其他费用-',name) as billType,
0 as need_pay needPay,receive_pay receivePay,pay,owe,receive_date receiveDate,pay_date payDate,expired_day expiredDay,status,starttime,endtime,
rent_shop_type rentShopType,'[]' shopInfo,comments,'' price_detail,updatetime,freeze,0 late_pay_price,service_charge_pay
from wx_bill_other bill
where bill.`tenant_id` = #{tenantId}
<include refid="billConditionSql"/>
</select>
<select id="listOtherDepositBill" parameterType="com.iformall.domain.vo.WxBillAll" resultMap="allVoResultMap">
select id,merchant_id merchantId,shop_id shopId,tenant_id tenantId,parent_tenant_id parentTenantId,comments as name,8 billTypeValue,concat('其他押金-',comments) as
billType,0 as needPay,receive_pay receivePay,pay,owe,receive_date receiveDate,pay_date payDate,expired_day expiredDay,status,starttime,endtime,
rent_shop_type rentShopType,'[]' shopInfo,comments,'' price_detail,updatetime,freeze,0 late_pay_price,service_charge_pay
from wx_bill_other_deposit bill
where bill.`tenant_id` = #{tenantId}
<include refid="billConditionSql"/>
</select>
<select id="queryOweInfo" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap">
@@ -327,7 +296,6 @@
#{status}
</foreach>
</if>
<if test="null!=starttime and null!=endtime and ''!=starttime and ''!=endtime ">
and DATE_FORMAT(bill.receive_date,'%Y-%m') between #{starttime} and #{endtime}
</if>