From 0766c42639d0e9b12d8dc2f93589b4713ced57a6 Mon Sep 17 00:00:00 2001
From: weicd <weicd@yhzhg.cn>
Date: Fri, 27 Dec 2024 07:19:36 +0000
Subject: [PATCH] 修改

---
 eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskDaliyRepository.java |   34 ++++++++++++++++++++++++++--------
 1 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskDaliyRepository.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskDaliyRepository.java
index a3834a9..90875f3 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskDaliyRepository.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskDaliyRepository.java
@@ -15,17 +15,18 @@
 */
 package me.zhengjie.modules.task.repository;
 
-import me.zhengjie.modules.task.domain.TaskDailyInterface;
-import me.zhengjie.modules.task.domain.TaskDaliy;
+import java.sql.Timestamp;
+import java.time.LocalDate;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
 
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 import org.springframework.data.jpa.repository.Query;
 
-import java.sql.Timestamp;
-import java.time.LocalDate;
-import java.util.List;
-import java.util.Map;
+import me.zhengjie.modules.task.domain.TaskDailyInterface;
+import me.zhengjie.modules.task.domain.TaskDaliy;
 
 /**
 * @website https://eladmin.vip
@@ -40,7 +41,7 @@
      * @return
      */
     @Query(value = "SELECT * FROM task_daliy WHERE project_id = ?1 AND task_id = ?2 AND user_id = ?3 AND fill_date < ?4 ORDER BY fill_date DESC LIMIT 1", nativeQuery = true)
-    TaskDaliy findPreviousByProjectIdAndTaskIdAndAndUserId(Long projectId, Long taskId, Long userId, Timestamp fillDate);
+    TaskDaliy findPreviousByProjectIdAndTaskIdAndAndUserId(Long projectId, Long taskId, Long userId, Date fillDate);
 
     /**
      * 根据项目ID、任务ID、用户ID查询填报日期后最近的任务日报信息
@@ -48,7 +49,7 @@
      * @return
      */
     @Query(value = "SELECT * FROM task_daliy WHERE project_id = ?1 AND task_id = ?2 AND user_id = ?3 AND fill_date > ?4 ORDER BY fill_date ASC LIMIT 1", nativeQuery = true)
-    TaskDaliy findNextByProjectIdAndTaskIdAndAndUserId(Long projectId, Long taskId, Long userId, Timestamp fillDate);
+    TaskDaliy findNextByProjectIdAndTaskIdAndAndUserId(Long projectId, Long taskId, Long userId, Date fillDate);
 
 
 //    @Query(value = "SELECT avg(task_progress) as taskProgress, COALESCE(sum(consumed_workload), 0.0) as consumedWorkload, sum(consumed_hours) as consumedHours FROM task_daliy WHERE task_id = ?1 AND create_time < ?2", nativeQuery = true)
@@ -96,6 +97,14 @@
      * @return
      */
     List<TaskDaliy> findByProjectIdAndTaskIdAndUserId(Long projectId, Long taskId, Long userId);
+    
+    /**
+     * 根据项目ID、任务ID、用户ID查询
+     * @param projectId
+     * @param taskId
+     * @return
+     */
+    List<TaskDaliy> findByProjectIdAndTaskIdAndUserIdOrderByFillDateDesc(Long projectId, Long taskId, Long userId);
 
     /**
      * 根据项目ID查询任务日报信息
@@ -223,4 +232,13 @@
      * @return
      */
 	List<TaskDaliy> findByProjectIdAndTaskId(Long projectId, Long id);
+
+
+    @Query(value = "select DISTINCT user_id from task_daliy where task_id = ?1",nativeQuery = true)
+    List<Long> findByTaskId(Long taskId);
+
+    List<TaskDaliy> findByTaskIdAndUserId(Long taskId, Long userId);
+
+    @Query(value = "select COALESCE(SUM(td.consumed_hours), 0) AS consumedHours, project_id as projectId, user_id as userId from task_daliy where fill_date <= ?2 and fill_date >= ?1 group by project_id, user_id order by user_id",nativeQuery = true)
+    List<Map> calcTotalConsumedHours(LocalDate startDate, LocalDate endDate);
 }
\ No newline at end of file

--
Gitblit v1.9.3