|
|
|
@@ -24,23 +24,32 @@ |
|
|
|
|
|
|
|
<sql id="dynamicWhereConditions"> |
|
|
|
where 1=1 |
|
|
|
<if test=" null != id ">and s.`id` = #{id}</if> |
|
|
|
<if test=" null != tenantId ">and s.`tenant_id` = #{tenantId}</if> |
|
|
|
<if test=" null != merchantName and merchantName !='' ">and m.name like concat('%', #{merchantName},'%')</if> |
|
|
|
<if test=" null != id ">and tt.`id` = #{id}</if> |
|
|
|
<if test=" null != tenantId ">and tt.`tenant_id` = #{tenantId}</if> |
|
|
|
<if test=" null != merchantName and merchantName !='' ">and tt.merchantName like concat('%', #{merchantName},'%')</if> |
|
|
|
<if test="startTime != null and startTime !=''"> |
|
|
|
and createtime >= #{startTime} |
|
|
|
and tt.createtime >= #{startTime} |
|
|
|
</if> |
|
|
|
<if test="endTime != null and endTime !=''"> |
|
|
|
and createtime <= #{endTime} |
|
|
|
and tt.createtime <= #{endTime} |
|
|
|
</if> |
|
|
|
<if test=" null != settleNumber and settleNumber !='' ">and tt.`settle_number` = #{settleNumber}</if> |
|
|
|
<if test=" null != status and status !=''">and tt.`status` = #{status}</if> |
|
|
|
<if test=" null != applyStatus and applyStatus !=''">and tt.`apply_status` = #{applyStatus}</if> |
|
|
|
<if test=" null != direction and direction !=''"> |
|
|
|
<if test="0 == direction"> |
|
|
|
balance >0 |
|
|
|
</if> |
|
|
|
<if test="1 == direction"> |
|
|
|
balance <0 |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
<if test=" null != settleNumber and settleNumber !='' ">and s.`settle_number` = #{settleNumber}</if> |
|
|
|
<if test=" null != status and status !=''">and s.`status` = #{status}</if> |
|
|
|
<if test=" null != applyStatus and applyStatus !=''">and s.`apply_status` = #{applyStatus}</if> |
|
|
|
|
|
|
|
<if test=" null != sortColumns">order by ${sortColumns}</if> |
|
|
|
</sql> |
|
|
|
|
|
|
|
<select id="findList" parameterType="com.iformall.domain.po.WxBillSettle" resultMap="BaseResultMap"> |
|
|
|
select tt.*,(tt.receiveMoney-tt.payMoney) balance from ( |
|
|
|
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,'租金' |
|
|
|
@@ -115,6 +124,10 @@ |
|
|
|
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) |
|
|
|
) tt |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<include refid="dynamicWhereConditions"/> |
|
|
|
</select> |
|
|
|
|