From d8eddeba2456ad1c89df68979112ae98d82c7948 Mon Sep 17 00:00:00 2001
From: BAOLH <baolh@yhzhg.cn>
Date: Tue, 02 Dec 2025 08:21:25 +0000
Subject: [PATCH] 因外出及调休记录可跨天产生的修改

---
 eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/UserRepository.java |   98 ++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 93 insertions(+), 5 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..ca276e6 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,11 +15,14 @@
  */
 package me.zhengjie.modules.system.repository;
 
+import io.swagger.models.auth.In;
+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;
 import org.springframework.data.jpa.repository.Modifying;
 import org.springframework.data.jpa.repository.Query;
+
 import java.util.Date;
 import java.util.List;
 import java.util.Set;
@@ -32,6 +35,7 @@
 
     /**
      * 根据用户名查询
+     *
      * @param username 用户名
      * @return /
      */
@@ -39,6 +43,7 @@
 
     /**
      * 根据邮箱查询
+     *
      * @param email 邮箱
      * @return /
      */
@@ -46,6 +51,7 @@
 
     /**
      * 根据手机号查询
+     *
      * @param phone 手机号
      * @return /
      */
@@ -53,25 +59,28 @@
 
     /**
      * 修改密码
-     * @param username 用户名
-     * @param pass 密码
+     *
+     * @param username              用户名
+     * @param pass                  密码
      * @param lastPasswordResetTime /
      */
     @Modifying
-    @Query(value = "update sys_user set password = ?2 , pwd_reset_time = ?3 where username = ?1",nativeQuery = true)
+    @Query(value = "update sys_user set password = ?2 , pwd_reset_time = ?3 where username = ?1", nativeQuery = true)
     void updatePass(String username, String pass, Date lastPasswordResetTime);
 
     /**
      * 修改邮箱
+     *
      * @param username 用户名
-     * @param email 邮箱
+     * @param email    邮箱
      */
     @Modifying
-    @Query(value = "update sys_user set email = ?2 where username = ?1",nativeQuery = true)
+    @Query(value = "update sys_user set email = ?2 where username = ?1", nativeQuery = true)
     void updateEmail(String username, String email);
 
     /**
      * 根据角色查询用户
+     *
      * @param roleId /
      * @return /
      */
@@ -81,6 +90,7 @@
 
     /**
      * 根据角色中的部门查询
+     *
      * @param deptId /
      * @return /
      */
@@ -90,6 +100,7 @@
 
     /**
      * 根据菜单查询
+     *
      * @param id 菜单ID
      * @return /
      */
@@ -99,12 +110,14 @@
 
     /**
      * 根据Id删除
+     *
      * @param ids /
      */
     void deleteAllByIdIn(Set<Long> ids);
 
     /**
      * 根据岗位查询
+     *
      * @param ids /
      * @return /
      */
@@ -113,6 +126,7 @@
 
     /**
      * 根据部门查询
+     *
      * @param deptIds /
      * @return /
      */
@@ -121,6 +135,7 @@
 
     /**
      * 根据角色查询
+     *
      * @param ids /
      * @return /
      */
@@ -129,10 +144,83 @@
     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);
+
+    @Query(value = "select * from sys_user where dept_id = ?1 and enabled=?2", nativeQuery = true)
+    List<User> findByDeptIdInAndEnabledWithSingle(Long deptId, Boolean enabled);
+
+    @Query(value = "select dept_id from sys_user where user_id = ?1",nativeQuery = true)
+    Long findDeptIdByUserId(Long userId);
+
+    /**
+     * 查询部门
+     * @param
+     * @return
+     */
+    @Query(value = "SELECT u.* FROM sys_user u JOIN sys_dept d ON u.dept_id = d.dept_id WHERE d.dept_id = ?;", nativeQuery = true)
+    List<User> findByDeptId(Long dept_id);
+
+    /**
+     * 查询用户
+     * @param
+     * @return
+     */
+    @Query(value = "SELECT * FROM sys_user WHERE user_id = ?;", nativeQuery = true)
+    List<User> findByUserId(Long user_id);
+
+    @Query(value = "select * FROM sys_user WHERE user_id IN ?1 and enabled = true",nativeQuery = true)
+    void findByUserIdIn(List<Long> userIds, Long companyId);
+
+    @Query(value = "select * FROM sys_user WHERE user_id IN ?1 and company_id = ?2 and enabled = true",nativeQuery = true)
+    void findByUserIdInAndCompanyId(List<Long> userIds, Long companyId);
+
+    /**
+     * 根据用户昵称查询
+     *
+     * @param nickName 用户昵称
+     * @return /
+     */
+    User findByNickName(String nickName);
 }

--
Gitblit v1.9.3