| | |
| | | package me.zhengjie.modules.task.repository; |
| | | |
| | | import me.zhengjie.modules.task.domain.Task; |
| | | import me.zhengjie.modules.task.domain.TaskInterface; |
| | | |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | List<Task> findByPid(Long pid); |
| | | |
| | | /** |
| | | * 根据项目ID查询 |
| | | * @param pid |
| | | * @return |
| | | */ |
| | | List<Task> findByProjectId(Long id); |
| | | |
| | | @Query(value = "SELECT COALESCE(SUM(plan_hours), 0.0) AS planHours, COALESCE(sum(plan_workload), 0.0) as planWorkload FROM task WHERE project_id = ?1", nativeQuery = true) |
| | | TaskInterface collectByProjectId(Long projectId); |
| | | |
| | | /** |
| | | * 根据项目ID删除 |
| | | * @param projectId |
| | | */ |
| | | void deleteByProjectId(Long projectId); |
| | | |
| | | /** |
| | | * 根据项目ID查询分组工时 |
| | | * @param projectId |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT t.id AS taskId, t.plan_hours AS planHours, p.id AS projectId, p.project_distinguish AS projectDistinguish FROM task t LEFT JOIN project p ON t.project_id = p.id WHERE t.project_id IN (?1)", nativeQuery = true) |
| | | List<TaskInterface> findSubgroupWorkingHoursByProjectId(List<Long> projectId); |
| | | |
| | | |
| | | /** |
| | | * 根据项目ID查询总工时 |
| | | * @param projectId |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT COALESCE(SUM(plan_hours), 0.0) FROM task WHERE project_id IN (?1)", nativeQuery = true) |
| | | Double sumWorkingHoursByProjectId(List<Long> projectId); |
| | | } |