From c19eda1fb09764cfa1ae134bda39efd9507784aa Mon Sep 17 00:00:00 2001
From: yaozc2021 <yaozc@yhzhg.cn>
Date: Fri, 25 Apr 2025 02:23:34 +0000
Subject: [PATCH] Merge branch 'wcd-2411-update' of http://192.168.1.110:5678/r/pms-upgrade into wcd
---
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskRepository.java | 31 ++++++++++++++++++++++++++++---
1 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskRepository.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskRepository.java
index 01a3dd8..39d229b 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskRepository.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskRepository.java
@@ -16,11 +16,12 @@
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.Date;
import java.util.List;
/**
@@ -44,6 +45,30 @@
*/
List<Task> findByProjectId(Long id);
- @Query(value = "SELECT * FROM task WHERE project_id = ?1 AND create_time < ?2", nativeQuery = true)
- List<Task> findByProjectIdUntilDate(Long projectId, Date belongDate);
+ @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);
+
}
\ No newline at end of file
--
Gitblit v1.9.3