BAOLH
2026-11-10 c5dfc09145e4e10f99dbf388a4a1433b5c2973e5
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/repository/ContractPaymentRepository.java
@@ -15,6 +15,7 @@
*/
package me.zhengjie.modules.contract.repository;
import me.zhengjie.modules.assetManagement.domain.AssetManagement;
import me.zhengjie.modules.contract.domain.ContractPayment;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
@@ -69,4 +70,20 @@
     * @param contractId
     */
    void deleteByContractId(Long contractId);
    /**
     * 根据公司和日期查询
     * @return
     */
    @Query(value = "SELECT * FROM `contract_payment` WHERE payment_time like %?% and company_id = ? and payment_type = ?",nativeQuery = true)
    List<ContractPayment> findByDateAndCompany(String buyDate, Long companyId, String assetsType);
    /**
     * 统计合同付款(收/支)总额
     * @param contractId
     * @param paymentType
     * @return
     */
    @Query(value = "SELECT SUM(payment_amount) AS totalAmount FROM contract_payment WHERE contract_id = ?1 AND payment_type = ?2",nativeQuery = true)
    BigDecimal sumPaymentAmountByContractIdAndPaymentType(Long contractId, String paymentType);
}