churf
2023-08-21 fe1c1002a5a2b1f9ea5eec95a40c9bbbcfe17450
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);
}