@@ -46,23 +46,23 @@
</select>
<select id="findBySettleId" parameterType="com.iformall.domain.po.WxBillSettleBill" resultMap="BaseResultMap">
select bill.starttime,bill.endtime,bl.bill_id,bl.bill_type,bill.bill_type billName,IFNULL(bill.receive_pay ,0) receivePay
select bill.starttime,bill.endtime,bl.bill_id,bl.bill_type,bill.bill_type billName,IFNULL(bill.owe ,0) receivePay
from wx_bill_settle_bill bl left join
(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,starttime,endtime from wx_bill_rent where is_preview = 0
union all
select id,merchant_id,shop_id,tenant_id,2 bill_type_value,'租赁押金-租赁押金'
bill_type,need_pay,
bill_type,need_pay,receive_pay,pay,
<choose>
<when test="1==type">
receive_pay
receive_pay owe
</when>
<otherwise>
owe receive_pay
owe
</otherwise>
</choose>
,pay,owe, receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from
,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from
wx_bill_rent_deposit
union all
select id,merchant_id,shop_id,tenant_id,3 bill_type_value,'物业费-物业费'
@@ -70,16 +70,16 @@
wx_bill_property where is_preview = 0
union all
select id,merchant_id,shop_id,tenant_id,4 bill_type_value,'物业押金-物业押金'
bill_type,need_pay,
bill_type,need_pay,receive_pay,pay,
<choose>
<when test="1==type">
receive_pay
receive_pay owe
</when>
<otherwise>
owe receive_pay
owe
</otherwise>
</choose>
,pay,owe, receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from
,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from
wx_bill_property_deposit
union all
select id,merchant_id,shop_id,tenant_id,5 bill_type_value,'水费-水费' bill_type,0 as
@@ -98,16 +98,16 @@
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_other
union all
select id,merchant_id,shop_id,tenant_id,8 bill_type_value,concat('其他押金-',comments) as bill_type,0 as
need_pay,
need_pay,receive_pay,pay,
<choose>
<when test="1==type">
receive_pay
receive_pay owe
</when>
<otherwise>
owe receive_pay
owe
</otherwise>
</choose>
,pay,owe, receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_other_deposit
,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_other_deposit
union all
select id, id merchant_id,'' shop_id,tenant_id,10 bill_type_value,'补贴-补贴' bill_type,0 as
@@ -115,15 +115,101 @@
) bill
on(bl.bill_id = bill.id)
where 1=1
<if test=" null != billId ">and bill.`id` = #{billId}</if>
<if test=" null != tenantId ">and bl.`tenant_id` = #{tenantId}</if>
<if test=" null != settleId ">and bl.`settle_id` = #{settleId}</if>
<if test=" null != type ">and bl.`type` = #{type}</if>
</select>
<!--同上面的sql-->
<select id="findByBillId" parameterType="com.iformall.domain.po.WxBillSettleBill" resultMap="BaseResultMap">
select bill.bill_type billName,bill.owe receivePay 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,starttime,endtime from wx_bill_rent where is_preview = 0
union all
select id,merchant_id,shop_id,tenant_id,2 bill_type_value,'租赁押金-租赁押金'
bill_type,need_pay,receive_pay,pay,
<choose>
<when test="1==type">
receive_pay owe
</when>
<otherwise>
owe
</otherwise>
</choose>
,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from
wx_bill_rent_deposit
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,starttime,endtime from
wx_bill_property where is_preview = 0
union all
select id,merchant_id,shop_id,tenant_id,4 bill_type_value,'物业押金-物业押金'
bill_type,need_pay,receive_pay,pay,
<choose>
<when test="1==type">
receive_pay owe
</when>
<otherwise>
owe
</otherwise>
</choose>
,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from
wx_bill_property_deposit
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,starttime,endtime from wx_bill_daily where
type=1
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,starttime,endtime from wx_bill_daily where
type=2
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,starttime,endtime from wx_bill_daily where
type=3
union all
select id,merchant_id,shop_id,tenant_id,7 bill_type_value,concat('其他费用-',name) as bill_type,0 as
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_other
union all
select id,merchant_id,shop_id,tenant_id,8 bill_type_value,concat('其他押金-',comments) as bill_type,0 as
need_pay,receive_pay,pay,
<choose>
<when test="1==type">
receive_pay owe
</when>
<otherwise>
owe
</otherwise>
</choose>
,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_other_deposit
union all
select id, id merchant_id,'' shop_id,tenant_id,10 bill_type_value,'补贴-补贴' bill_type,0 as
need_pay,subsidy receive_pay,0 pay,0 owe,'' receive_date,'' pay_date,'' expired_day,status,'' rent_shop_type,'' starttime,'' endtime from wx_merchant_subsidy
) bill
where 1=1
<if test=" null != billId ">and bill.`id` = #{billId}</if>
</select>
<update id="delBySettleId" parameterType="com.iformall.domain.po.WxBillSettle">
delete from wx_bill_settle_bill where settle_id = #{id}
</update>
<select id="findExist" parameterType="com.iformall.domain.po.WxBillSettle" resultMap="BaseResultMap">
select * from wx_bill_settle_bill where 1=1
<if test=" null != id ">
and settle_id !=#{id}
</if>
<if test=" null != receiveBillIds ">
and bill_id in
<foreach collection="receiveBillIds" index="index" item="idItem" open="(" separator="," close=")">
#{idItem.billId}
</foreach>
</if>
</select>
</mapper>