From 6754df3c4faf22d426d45d1c4995c865cab686de Mon Sep 17 00:00:00 2001
From: weicd <weicd@yhzhg.cn>
Date: Mon, 20 Feb 2023 02:45:16 +0000
Subject: [PATCH] 流水相关
---
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskUserRepository.java | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskUserRepository.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskUserRepository.java
index e054013..aaae200 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskUserRepository.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskUserRepository.java
@@ -16,6 +16,7 @@
package me.zhengjie.modules.task.repository;
import me.zhengjie.modules.task.domain.TaskUser;
+
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
@@ -52,4 +53,49 @@
*/
@Query(value = "SELECT user_id FROM task_user WHERE task_id = ?1", nativeQuery = true)
List<Long> findUserIdByTaskId(Long taskId);
+
+ /**
+ * 根据用户ID查询项目ID
+ * @param userId
+ * @return
+ */
+ @Query(value = "SELECT project_id FROM task_user WHERE user_id = ?1", nativeQuery = true)
+ List<Long> findProjectIdByUserId(Long userId);
+
+ /**
+ * 根据用户ID、项目ID查询任务ID
+ * @param userId
+ * @return
+ */
+ @Query(value = "SELECT task_id FROM task_user WHERE user_id = ?1 AND project_id = ?2", nativeQuery = true)
+ List<Long> findTaskIdByUserIdAndProjectId(Long userId, Long projectId);
+
+ /**
+ * 根据多任务ID查询
+ * @param userId
+ * @param taskIds
+ * @return
+ */
+ List<TaskUser> findByUserIdAndTaskIdIn(Long userId, List<Long> taskIds);
+
+ /**
+ * 根据多任务ID查询
+ * @param taskIds
+ * @return
+ */
+ List<TaskUser> findByTaskIdIn(List<Long> taskIds);
+
+ /**
+ * 根据任务ID和员工ID查询
+ * @param taskId
+ * @param userId
+ * @return
+ */
+ TaskUser findByTaskIdAndUserId(Long taskId, Long userId);
+
+ /**
+ * 根据项目ID删除
+ * @param projectId
+ */
+ void deleteByProjectId(Long projectId);
}
\ No newline at end of file
--
Gitblit v1.9.3