From fe1c1002a5a2b1f9ea5eec95a40c9bbbcfe17450 Mon Sep 17 00:00:00 2001
From: churf <123456>
Date: Mon, 21 Aug 2023 09:56:41 +0000
Subject: [PATCH] 缓存优化2

---
 eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/UserRepository.java |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/UserRepository.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/UserRepository.java
index 85d2d16..c397b58 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/UserRepository.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/UserRepository.java
@@ -15,6 +15,7 @@
  */
 package me.zhengjie.modules.system.repository;
 
+import me.zhengjie.modules.system.domain.Dept;
 import me.zhengjie.modules.system.domain.User;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
@@ -129,10 +130,42 @@
     int countByRoles(Set<Long> ids);
 
     /**
+     * 根据状态查询
+     * @param enabled
+     * @return
+     */
+    List<User> findAllByEnabled(Boolean enabled);
+
+    /**
      * 根据排班查询
      * @param ids /
      * @return /
      */
     @Query(value = "SELECT count(1) FROM sys_user WHERE rostering_id IN ?1", nativeQuery = true)
     int countByRosterings(Long[] ids);
+
+    /**
+     * 根据级别查询
+     * @param ids /
+     * @return /
+     */
+    @Query(value = "SELECT count(1) FROM sys_user WHERE level_id IN ?1", nativeQuery = true)
+    int countByLevels(Long[] ids);
+
+    /**
+     * 根据ID查询
+     * @param userIds
+     * @return
+     */
+	List<User> findByIdIn(List<Long> userIds);
+
+    /**
+     * 根据部门查询
+     * @param dept
+     * @return
+     */
+	List<User> findByDeptAndEnabled(Dept dept, Boolean enabled);
+
+	@Query(value = "SELECT * FROM sys_user WHERE dept_id IN ?1 AND enabled = ?2", nativeQuery = true)
+	List<User> findByDeptIdInAndEnabled(List<Long> deptIds, Boolean enabled);
 }

--
Gitblit v1.9.3