|
|
|
@@ -8,12 +8,12 @@ |
|
|
|
<result column="merchant_id" property="merchantId"/> |
|
|
|
<result column="status" property="status"/> |
|
|
|
<result column="apply_status" property="applyStatus"/> |
|
|
|
<result column="receive_money" property="receiveMoney"/> |
|
|
|
<result column="pay_money" property="payMoney"/> |
|
|
|
<result column="receiveMoney" property="receiveMoney"/> |
|
|
|
<result column="payMoney" property="payMoney"/> |
|
|
|
<result column="settletime" property="settletime"/> |
|
|
|
<result column="createtime" property="createtime"/> |
|
|
|
<result column="updatetime" property="updatetime"/> |
|
|
|
|
|
|
|
<result column="merchantName" property="merchantName"/> |
|
|
|
|
|
|
|
</resultMap> |
|
|
|
|
|
|
|
@@ -24,22 +24,88 @@ |
|
|
|
|
|
|
|
<sql id="dynamicWhereConditions"> |
|
|
|
where 1=1 |
|
|
|
<if test=" null != id ">and `id` = #{id}</if> |
|
|
|
<if test=" null != tenantId ">and `tenant_id` = #{tenantId}</if> |
|
|
|
|
|
|
|
<if test=" null != ids "> |
|
|
|
and id in |
|
|
|
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> |
|
|
|
#{idItem} |
|
|
|
</foreach> |
|
|
|
</if> |
|
|
|
<if test=" null != id ">and s.`id` = #{id}</if> |
|
|
|
<if test=" null != tenantId ">and s.`tenant_id` = #{tenantId}</if> |
|
|
|
|
|
|
|
<if test=" null != sortColumns">order by ${sortColumns}</if> |
|
|
|
</sql> |
|
|
|
|
|
|
|
<select id="findList" parameterType="com.iformall.domain.po.WxBillSettle" resultMap="BaseResultMap"> |
|
|
|
select |
|
|
|
<include refid="allColumns"/> |
|
|
|
from wx_bill_settle |
|
|
|
select s.*,m.name merchantName, |
|
|
|
(select IFNULL(sum(bill.receive_pay),0) from wx_bill_settle_bill bb 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 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,owe,receive_date,pay_date,expired_day,status,rent_shop_type 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 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,owe,receive_date,pay_date,expired_day,status,rent_shop_type 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 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 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 from wx_bill_daily where |
|
|
|
type=3 |
|
|
|
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 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 |
|
|
|
on(bb.bill_id=bill.id) where bb.settle_id = s.id and bb.type=0 |
|
|
|
) receiveMoney, |
|
|
|
(select IFNULL(sum(bill.receive_pay),0) from wx_bill_settle_bill bb 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 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,owe,receive_date,pay_date,expired_day,status,rent_shop_type 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 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,owe,receive_date,pay_date,expired_day,status,rent_shop_type 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 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 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 from wx_bill_daily where |
|
|
|
type=3 |
|
|
|
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 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 |
|
|
|
on(bb.bill_id=bill.id) where bb.settle_id = s.id and bb.type=1 |
|
|
|
) payMoney |
|
|
|
from wx_bill_settle s left JOIN wx_merchant m on(s.merchant_id=m.id) |
|
|
|
|
|
|
|
<include refid="dynamicWhereConditions"/> |
|
|
|
</select> |
|
|
|
|
|
|
|
|