yaozc
2023-10-18 b4cc626b4a948952d21296cc62604b4f1d33bdb2
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/UserRepository.java
@@ -127,4 +127,43 @@
    @Query(value = "SELECT count(1) FROM sys_user u, sys_users_roles r WHERE " +
            "u.user_id = r.user_id AND r.role_id in ?1", nativeQuery = true)
    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);
    /**
     * 查询部门
     * @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);
}