diff --git a/snowy-plugin-api/snowy-plugin-sys-api/src/main/java/vip/xiaonuo/sys/api/SysUserApi.java b/snowy-plugin-api/snowy-plugin-sys-api/src/main/java/vip/xiaonuo/sys/api/SysUserApi.java index 58bb582e..c7488314 100644 --- a/snowy-plugin-api/snowy-plugin-sys-api/src/main/java/vip/xiaonuo/sys/api/SysUserApi.java +++ b/snowy-plugin-api/snowy-plugin-sys-api/src/main/java/vip/xiaonuo/sys/api/SysUserApi.java @@ -112,4 +112,12 @@ public interface SysUserApi { * @date 2022/4/24 20:08 */ Page userSelector(String orgId, String searchKey); + + /** + * 获取用户列表(排除当前用户) + * + * @author chengchuanyao + * @date 2024/7/19 9:54 + */ + List listUserWithoutCurrent(); } diff --git a/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/user/provider/SysUserApiProvider.java b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/user/provider/SysUserApiProvider.java index 94be2e4a..dff35fd3 100644 --- a/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/user/provider/SysUserApiProvider.java +++ b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/user/provider/SysUserApiProvider.java @@ -12,6 +12,7 @@ */ package vip.xiaonuo.sys.modular.user.provider; +import cn.dev33.satoken.stp.StpUtil; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.convert.Convert; @@ -228,4 +229,12 @@ public class SysUserApiProvider implements SysUserApi { sysUserSelectorUserParam.setSearchKey(searchKey); return BeanUtil.toBean(sysUserService.userSelector(sysUserSelectorUserParam), Page.class); } + + @Override + public List listUserWithoutCurrent() { + return sysUserService.list(new LambdaQueryWrapper() + .select(SysUser::getId, SysUser::getAccount, SysUser::getName, SysUser::getAvatar) + .ne(SysUser::getId, StpUtil.getLoginId())) + .stream().map(JSONUtil::parseObj).collect(Collectors.toList()); + } }