2026-06-08 2c19f00b211b7ffb1a265d67991d92f2b194b1f5
src/main/resources/mapper/account/purchase/AccountPaymentApplicationMapper.xml
@@ -18,6 +18,7 @@
        <result column="apply_date" property="applyDate" />
        <result column="remark" property="remark" />
        <result column="status" property="status" />
        <result column="payment_status" property="paymentStatus" />
        <result column="payment_amount" property="paymentAmount" />
    </resultMap>
     <select
@@ -25,7 +26,8 @@
         resultType="com.ruoyi.account.bean.vo.purchase.AccountPaymentApplicationVo">
        select * from (select apa.*,
               sm.supplier_name,
               GROUP_CONCAT(sir.inbound_batches SEPARATOR ',') AS inboundBatches
               GROUP_CONCAT(sir.inbound_batches SEPARATOR ',') AS inboundBatches,
               IFNULL((SELECT SUM(app.payment_amount) FROM account_purchase_payment app WHERE app.account_payment_application_id = apa.id), 0) AS paidAmount
        from account_payment_application apa
        left join supplier_manage sm on apa.supplier_id = sm.id
        left join stock_in_record sir on FIND_IN_SET(sir.id, apa.stock_in_record_ids) > 0
@@ -39,6 +41,9 @@
            </if>
             <if test="req.status != null">
                 AND A.status = #{req.status}
            </if>
            <if test="req.paymentStatus != null">
                 AND A.payment_status = #{req.paymentStatus}
            </if>
            <if test="req.startDate != null and req.endDate != null">
                AND A.apply_date BETWEEN #{req.startDate} AND #{req.endDate}
@@ -87,12 +92,14 @@
    </select>
    <select id="existsByStockInRecordId" resultType="java.lang.Boolean">
         SELECT COUNT(*) > 0
        SELECT COUNT(*) > 0
        FROM account_payment_application
        WHERE  status != 2
        <foreach collection="stockInRecordIds" item="id" open="(" separator=" OR " close=")">
            FIND_IN_SET(#{id}, stock_in_record_ids)
        WHERE status != 2
        AND (
        <foreach collection="stockInRecordIds" item="id" separator=" OR ">
            FIND_IN_SET(#{id}, stock_in_record_ids) > 0
        </foreach>
        )
    </select>
</mapper>