| | |
| | | |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | import org.springframework.data.jpa.repository.Modifying; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | |
| | |
| | | public interface ProjectProgressRepository extends JpaRepository<ProjectProgress, Long>, JpaSpecificationExecutor<ProjectProgress> { |
| | | |
| | | |
| | | @Query(value = "SELECT * FROM project_progress WHERE project_id = ?1 ORDER BY create_time DESC", nativeQuery = true) |
| | | List<ProjectProgress> findByProjectId(Long id); |
| | | @Query(value = "SELECT * FROM project_progress WHERE project_id = ?1 AND belong_date < ?2 ORDER BY belong_date DESC", nativeQuery = true) |
| | | List<ProjectProgress> findByProjectId(Long id, Timestamp belongDate); |
| | | |
| | | /** |
| | | * 根据年度、周度、多项目ID查询 |
| | |
| | | |
| | | @Query(value = "SELECT distinct belong_week FROM project_progress WHERE belong_year = ?1", nativeQuery = true) |
| | | List<Integer> findAllBelongWeekByBelongYear(Integer year); |
| | | |
| | | /** |
| | | * 根据项目ID删除 |
| | | * @param projectId |
| | | */ |
| | | @Modifying |
| | | @Query(value = "DELETE FROM project_progress WHERE project_id = ?1", nativeQuery = true) |
| | | void deleteByProjectId(Long projectId); |
| | | } |