|
@@ -67,99 +67,106 @@
|
|
|
<select id="getListByCondition" parameterType="Map"
|
|
|
resultType="com.yh.saas.plugin.yiliangyiyun.entity.CollectionWarehousingRecord">
|
|
|
SELECT
|
|
|
- id,
|
|
|
- comp_id as compId,
|
|
|
- payment_no as paymentNo,
|
|
|
- goods_name as goodsName,
|
|
|
- car_no as carNo,
|
|
|
- relation_id as relationId,
|
|
|
- customer_number_card as customerNumberCard,
|
|
|
- type,
|
|
|
- in_date as inDate,
|
|
|
- contract_no as contractNo,
|
|
|
- net_weight as netWeight,
|
|
|
- invoicing_sale as invoicingSale,
|
|
|
- unit_deduction as unitDeduction,
|
|
|
- unit_have as unithave,
|
|
|
- amount_ing_payable as amountIngPayable,
|
|
|
- amount_ed_payable as amountEdPayable,
|
|
|
- amount_not_payable as amountNotPayable,
|
|
|
- payment_screenshot as paymentScreenshot,
|
|
|
- collection_screenshot as collectionScreenshot,
|
|
|
- amount_ed_collectionable as amountEdCollectionable,
|
|
|
- amount_not_collectable as amountNotCollectable,
|
|
|
- customer_name as customerName,
|
|
|
- customer_phone as customerPhone,
|
|
|
- collection_date as collectionDate,
|
|
|
- status,
|
|
|
- picture_address as pictureAddress,
|
|
|
- approve_status as approveStatus,
|
|
|
- status_flag as statusFlag,
|
|
|
- update_date as updateDate,
|
|
|
- workflow_id as workflowId,
|
|
|
- create_date as createDate,
|
|
|
- unit_deduction as unitDeduction,
|
|
|
- picture_address as pictureAddress,
|
|
|
- invoicing,
|
|
|
- grade
|
|
|
- FROM collection_warehousing_record
|
|
|
+ c.id,
|
|
|
+ c.comp_id as compId,
|
|
|
+ c.identity_id as identityId,
|
|
|
+ c.payment_no as paymentNo,
|
|
|
+ c.goods_name as goodsName,
|
|
|
+ c.car_no as carNo,
|
|
|
+ c.relation_id as relationId,
|
|
|
+ c.customer_number_card as customerNumberCard,
|
|
|
+ c.type,
|
|
|
+ c.in_date as inDate,
|
|
|
+ c.contract_no as contractNo,
|
|
|
+ c.net_weight as netWeight,
|
|
|
+ c.invoicing_sale as invoicingSale,
|
|
|
+ c.unit_deduction as unitDeduction,
|
|
|
+ c.unit_have as unithave,
|
|
|
+ c.amount_ing_payable as amountIngPayable,
|
|
|
+ c.amount_ed_payable as amountEdPayable,
|
|
|
+ c.amount_not_payable as amountNotPayable,
|
|
|
+ c.payment_screenshot as paymentScreenshot,
|
|
|
+ c.collection_screenshot as collectionScreenshot,
|
|
|
+ c.amount_ed_collectionable as amountEdCollectionable,
|
|
|
+ c.amount_not_collectable as amountNotCollectable,
|
|
|
+ c.customer_name as customerName,
|
|
|
+ c.customer_phone as customerPhone,
|
|
|
+ c.collection_date as collectionDate,
|
|
|
+ c.status,
|
|
|
+ c.picture_address as pictureAddress,
|
|
|
+ c.approve_status as approveStatus,
|
|
|
+ c.status_flag as statusFlag,
|
|
|
+ c.update_date as updateDate,
|
|
|
+ c.workflow_id as workflowId,
|
|
|
+ c.create_date as createDate,
|
|
|
+ c.invoicing,
|
|
|
+ c.grade,
|
|
|
+ (SELECT IFNULL(sum(case when p.type ='潮粮' then p.pure_weight else p.net_weight end),0)
|
|
|
+ FROM payment_management p
|
|
|
+ WHERE p.delete_flag = '0'
|
|
|
+ AND p.customer_number_card = c.customer_number_card
|
|
|
+ AND p.goods_name =c.goods_name
|
|
|
+ AND (DATE_FORMAT(p.create_date,"%Y%m%d") >=
|
|
|
+ DATE_FORMAT(#{year},"%Y%m%d"))
|
|
|
+ AND p.comp_id = c.comp_id) as num
|
|
|
+ FROM collection_warehousing_record c
|
|
|
WHERE
|
|
|
- delete_flag = '0'
|
|
|
- AND comp_id = #{compId}
|
|
|
+ c.delete_flag = '0'
|
|
|
+ AND c.comp_id = #{compId}
|
|
|
<if test="searchType != null and searchType != ''">
|
|
|
<if test="searchType == 1">
|
|
|
- AND amount_ed_payable = 0
|
|
|
+ AND c.amount_ed_payable = 0
|
|
|
</if>
|
|
|
<if test="searchType == 3">
|
|
|
- AND amount_ed_payable >0
|
|
|
+ AND c.amount_ed_payable >0
|
|
|
</if>
|
|
|
<if test="searchType == 4">
|
|
|
- AND amount_ed_collectionable=0
|
|
|
+ AND c.amount_ed_collectionable=0
|
|
|
</if>
|
|
|
<if test="searchType == 5">
|
|
|
- AND amount_ed_collectionable>0
|
|
|
+ AND c.amount_ed_collectionable>0
|
|
|
</if>
|
|
|
<if test="searchType == 6">
|
|
|
- AND invoicing='0'
|
|
|
+ AND c.invoicing='0'
|
|
|
</if>
|
|
|
<if test="searchType == 7">
|
|
|
- AND invoicing_sale='0'
|
|
|
+ AND c.invoicing_sale='0'
|
|
|
</if>
|
|
|
</if>
|
|
|
<if test="contractNo != null and contractNo != ''and contractNo != '全部合同'">
|
|
|
- AND contract_no = #{contractNo}
|
|
|
+ AND c.contract_no = #{contractNo}
|
|
|
</if>
|
|
|
<if test="startDate != null">
|
|
|
- AND (DATE_FORMAT(create_date,"%Y%m%d") >=
|
|
|
+ AND (DATE_FORMAT(c.create_date,"%Y%m%d") >=
|
|
|
DATE_FORMAT(#{startDate},"%Y%m%d"))
|
|
|
</if>
|
|
|
<if test="endDate != null">
|
|
|
- AND (DATE_FORMAT(create_date,"%Y%m%d") <=
|
|
|
+ AND (DATE_FORMAT(c.create_date,"%Y%m%d") <=
|
|
|
DATE_FORMAT(#{endDate},"%Y%m%d"))
|
|
|
</if>
|
|
|
<if test="searchKeyWord != null and searchKeyWord != ''">
|
|
|
- AND (lower(customer_name) like lower(CONCAT('%',#{searchKeyWord},'%'))
|
|
|
- OR lower(car_no) like lower(CONCAT('%',#{searchKeyWord},'%'))
|
|
|
+ AND (lower(c.customer_name) like lower(CONCAT('%',#{searchKeyWord},'%'))
|
|
|
+ OR lower(c.car_no) like lower(CONCAT('%',#{searchKeyWord},'%'))
|
|
|
)
|
|
|
</if>
|
|
|
<if test="businessKeys != null and businessKeys.size > 0">
|
|
|
and(
|
|
|
<foreach collection="businessKeys" item="businessValue" open="(" close=")" separator="or">
|
|
|
- id = #{businessValue}
|
|
|
+ c.id = #{businessValue}
|
|
|
</foreach>
|
|
|
)
|
|
|
</if>
|
|
|
<if test="statusSet != null and statusSet.size > 0">
|
|
|
or (
|
|
|
<foreach collection="statusSet" item="statusId" separator="or" open="(" close=")">
|
|
|
- status_flag =
|
|
|
+ c.status_flag =
|
|
|
<if test="statusId != null">
|
|
|
#{statusId}
|
|
|
</if>
|
|
|
</foreach>
|
|
|
)
|
|
|
</if>
|
|
|
- ORDER BY update_date DESC
|
|
|
+ ORDER BY c.update_date DESC
|
|
|
<if test="currentPage != null and currentPage != ''">
|
|
|
LIMIT ${startRecord}, ${pageSize}
|
|
|
</if>
|