|
|
@@ -38,27 +38,36 @@
|
|
|
|
|
|
|
|
|
<select id="listByModel" resultType="com.idea.customerManagement.dto.ContractManageDto">
|
|
|
- select contract_manage.*,
|
|
|
- ifnull(sum(pay_log.pay_money),0) receivedMoney,
|
|
|
- ifnull(contract_manage.buyer_money - sum(pay_log.pay_money),0) arrears
|
|
|
- from contract_manage
|
|
|
- left join pay_log on contract_manage.id = pay_log.contract_id
|
|
|
- and pay_log.pay_type = #{payType} and pay_log.content_type != 7 and pay_log.status = 0
|
|
|
- <where>
|
|
|
- and contract_status in (2,3)
|
|
|
- <if test="houseName != null and houseName != ''">
|
|
|
- and contract_manage.house_name like concat('%',#{houseName},'%')
|
|
|
- </if>
|
|
|
- <if test="collectionStatus != null and collectionStatus != ''">
|
|
|
- and collection_status = #{collectionStatus}
|
|
|
- </if>
|
|
|
- <if test="buyerName != null and buyerName != ''">
|
|
|
- and contract_manage.customer_management_id in (select customer_management_id from buyer where name like concat('%',#{buyerName},'%'))
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- group by contract_manage.id
|
|
|
- ORDER BY contract_manage.created_at DESC
|
|
|
- </select>
|
|
|
+ select contract_manage.*,
|
|
|
+ ifnull(sum(pay_log.pay_money),0) receivedMoney,
|
|
|
+ ifnull(contract_manage.buyer_money - sum(pay_log.pay_money),0) arrears
|
|
|
+ from contract_manage
|
|
|
+ left join pay_log on contract_manage.id = pay_log.contract_id
|
|
|
+ and pay_log.pay_type = #{payType} and pay_log.content_type != 7 and pay_log.status = 0
|
|
|
+ <where>
|
|
|
+ and contract_status in (2,3)
|
|
|
+ <if test="houseName != null and houseName != ''">
|
|
|
+ and contract_manage.house_name like concat('%',#{houseName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="collectionStatus != null and collectionStatus != ''">
|
|
|
+ and collection_status = #{collectionStatus}
|
|
|
+ </if>
|
|
|
+ <if test="buyerName != null and buyerName != ''">
|
|
|
+ and contract_manage.customer_management_id in (select customer_management_id from buyer where name like
|
|
|
+ concat('%',#{buyerName},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="buyerIdentityCard != null and buyerIdentityCard != ''">
|
|
|
+ and contract_manage.customer_management_id in (select customer_management_id from buyer where
|
|
|
+ identity_card like concat('%',#{buyerIdentityCard},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="batchNumber != null and batchNumber != ''">
|
|
|
+ and contract_manage.customer_management_id in (select id from customer_management where batch_number
|
|
|
+ like concat('%',#{batchNumber},'%'))
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ group by contract_manage.id
|
|
|
+ ORDER BY contract_manage.created_at DESC
|
|
|
+ </select>
|
|
|
|
|
|
<select id="countByGroupId" resultType="java.lang.Integer">
|
|
|
select count(1) from pay_log
|