BAOLH
2025-03-14 4fa526092b61ba33a7fc7662048288691d7bb9b0
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/repository/ContractRepository.java
@@ -22,6 +22,7 @@
import java.math.BigDecimal;
import java.util.List;
import java.util.Set;
/**
* @website https://eladmin.vip
@@ -51,10 +52,11 @@
            "CASE WHEN ?8 IS NOT NULL THEN contract_payment_state = ?8 ELSE 1 = 1 END AND " +
            "CASE WHEN ?9 IS NOT NULL THEN service_payment_state = ?9 ELSE 1 = 1 END AND " +
            "CASE WHEN ?10 IS NOT NULL THEN contract_status = ?10 ELSE 1 = 1 END AND " +
            "CASE WHEN ?11 IS NOT NULL THEN contract_area_code LIKE concat(?11,'%') ELSE 1 = 1 END",nativeQuery = true)
            "CASE WHEN ?11 IS NOT NULL THEN contract_area_code LIKE concat(?11,'%') ELSE 1 = 1 END AND " +
            "company_id IN ?12",nativeQuery = true)
    BigDecimal contractTotalMoney(
            String contractNumber, String contractName, Long firstId, Long secondId, String signStartDate, String signEndDate, String contractType, String contractPaymentState,
            String servicePaymentState, String contractStatus, String contractAreaCode
            String servicePaymentState, String contractStatus, String contractAreaCode, Set<Long> companyIdSet
    );
    /**
@@ -72,10 +74,10 @@
            "CASE WHEN ?9 IS NOT NULL THEN service_payment_state = ?9 ELSE 1 = 1 END AND " +
            "CASE WHEN ?10 IS NOT NULL THEN contract_status = ?10 ELSE 1 = 1 END AND " +
            "CASE WHEN ?11 IS NOT NULL THEN contract_area_code LIKE concat(?11,'%') ELSE 1 = 1 END AND " +
            "contract_amount IS NOT NULL AND contract_amount != ''",nativeQuery = true)
            "contract_amount IS NOT NULL AND contract_amount != '' AND company_id IN ?12",nativeQuery = true)
    List<Contract> findContractAmountNotNull(
            String contractNumber, String contractName, Long firstId, Long secondId, String signStartDate, String signEndDate, String contractType, String contractPaymentState,
            String servicePaymentState, String contractStatus, String contractAreaCode
            String servicePaymentState, String contractStatus, String contractAreaCode, Set<Long> companyIdSet
    );
    /**
@@ -92,10 +94,11 @@
            "CASE WHEN ?8 IS NOT NULL THEN contract_payment_state = ?8 ELSE 1 = 1 END AND " +
            "CASE WHEN ?9 IS NOT NULL THEN service_payment_state = ?9 ELSE 1 = 1 END AND " +
            "CASE WHEN ?10 IS NOT NULL THEN contract_status = ?10 ELSE 1 = 1 END AND " +
            "CASE WHEN ?11 IS NOT NULL THEN contract_area_code LIKE concat(?11,'%') ELSE 1 = 1 END",nativeQuery = true)
            "CASE WHEN ?11 IS NOT NULL THEN contract_area_code LIKE concat(?11,'%') ELSE 1 = 1 END AND " +
            "company_id IN ?12",nativeQuery = true)
    BigDecimal serviceTotalMoney(
            String contractNumber, String contractName, Long firstId, Long secondId, String signStartDate, String signEndDate, String contractType, String contractPaymentState,
            String servicePaymentState, String contractStatus, String contractAreaCode
            String servicePaymentState, String contractStatus, String contractAreaCode, Set<Long> companyIdSet
    );
    /**
@@ -113,10 +116,10 @@
            "CASE WHEN ?9 IS NOT NULL THEN service_payment_state = ?9 ELSE 1 = 1 END AND " +
            "CASE WHEN ?10 IS NOT NULL THEN contract_status = ?10 ELSE 1 = 1 END AND " +
            "CASE WHEN ?11 IS NOT NULL THEN contract_area_code LIKE concat(?11,'%') ELSE 1 = 1 END AND " +
            "service_amount IS NOT NULL AND service_amount != ''",nativeQuery = true)
            "service_amount IS NOT NULL AND service_amount != '' AND company_id IN ?12",nativeQuery = true)
    List<Contract> findServiceAmountNotNull(
            String contractNumber, String contractName, Long firstId, Long secondId, String signStartDate, String signEndDate, String contractType, String contractPaymentState,
            String servicePaymentState, String contractStatus, String contractAreaCode
            String servicePaymentState, String contractStatus, String contractAreaCode, Set<Long> companyIdSet
    );
    /**
@@ -124,7 +127,7 @@
     * @return
     */
    @Query(value = "SELECT CAST(SUBSTRING(contract_number, 12, 3) AS UNSIGNED) AS val FROM contract \n" +
            "WHERE sign_date LIKE CONCAT(?1, '%') AND contract_number LIKE CONCAT(?2, '%') AND contract_id != ?3 \n" +
            "WHERE SUBSTRING(contract_number, 5, 2) = SUBSTRING(?1, 3, 2) AND contract_number LIKE CONCAT(?2, '%') AND contract_id != ?3 \n" +
            "ORDER BY CAST(SUBSTRING(contract_number, 12, 3) AS UNSIGNED) DESC LIMIT 1", nativeQuery = true)
    Long countContractSort(String year, String companyCode, Long id);
@@ -133,7 +136,7 @@
     * @return
     */
    @Query(value = "SELECT CAST(SUBSTRING(contract_number, 16, 4) AS UNSIGNED) AS val FROM contract \n" +
            "WHERE sign_date LIKE CONCAT(?1, '%') AND contract_id != ?2 \n" +
            "WHERE SUBSTRING(contract_number, 5, 2) = SUBSTRING(?1, 3, 2) AND contract_id != ?2 \n" +
            "ORDER BY CAST(SUBSTRING(contract_number, 16, 4) AS UNSIGNED) DESC LIMIT 1", nativeQuery = true)
    Long countAllContractSort(String year, Long id);
}