package cn.palmte.work.model;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.math.BigDecimal;
import java.util.List;

public interface ProjectBudgetCostRepository extends JpaRepository<ProjectBudgetCost,Integer> {
    List<ProjectBudgetCost> findAllByProjectIdEquals(int id);

    @Query(value = "select sum(cost_tax_include) from project_budget_cost where type = ?", nativeQuery = true)
    BigDecimal costTaxIncludeSum(int type);

    @Query(value = "select sum(cost_tax_exclude) from project_budget_cost where type = ?", nativeQuery = true)
    BigDecimal costTaxExcludeSum(int type);

    @Query(value = "select * from project_budget_cost where project_id in ?1", nativeQuery = true)
    List<ProjectBudgetCost> findAllByProjectIds(List<Integer> projectInt);
}
