From 676f7914765095e8c4f4754af27eeac812a0b499 Mon Sep 17 00:00:00 2001 From: fengshuonan Date: Fri, 21 Jul 2023 10:48:35 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=908.0.0=E3=80=91=E6=9B=B4=E6=96=B0devops?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E8=8E=B7=E5=8F=96=EF=BC=8C=E5=8F=AA=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=89=8D20=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../guns/modular/demo/controller/DevOpsController.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/cn/stylefeng/guns/modular/demo/controller/DevOpsController.java b/src/main/java/cn/stylefeng/guns/modular/demo/controller/DevOpsController.java index f5add468..dc6962e0 100644 --- a/src/main/java/cn/stylefeng/guns/modular/demo/controller/DevOpsController.java +++ b/src/main/java/cn/stylefeng/guns/modular/demo/controller/DevOpsController.java @@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; import cn.stylefeng.roses.kernel.auth.api.AuthServiceApi; import cn.stylefeng.roses.kernel.auth.api.pojo.auth.LoginRequest; import cn.stylefeng.roses.kernel.auth.api.pojo.auth.LoginResponse; +import cn.stylefeng.roses.kernel.db.api.factory.PageFactory; import cn.stylefeng.roses.kernel.rule.enums.StatusEnum; import cn.stylefeng.roses.kernel.rule.enums.YesOrNotEnum; import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException; @@ -17,6 +18,7 @@ import cn.stylefeng.roses.kernel.sys.modular.user.entity.SysUser; import cn.stylefeng.roses.kernel.sys.modular.user.pojo.request.SysUserRequest; import cn.stylefeng.roses.kernel.sys.modular.user.service.SysUserService; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; @@ -76,7 +78,12 @@ public class DevOpsController { userLambdaQueryWrapper.select(SysUser::getUserId, SysUser::getAccount); userLambdaQueryWrapper.eq(SysUser::getStatusFlag, StatusEnum.ENABLE.getCode()); userLambdaQueryWrapper.ne(SysUser::getDelFlag, YesOrNotEnum.Y.getCode()); - List list = this.sysUserService.list(userLambdaQueryWrapper); + userLambdaQueryWrapper.orderByAsc(SysUser::getUserId); + + // 只获取前20个用户 + Page page = this.sysUserService.page(PageFactory.defaultPage(), userLambdaQueryWrapper); + List list = page.getRecords(); + List collect = list.stream().map(item -> BeanUtil.toBean(item, SysUserRequest.class)).collect(Collectors.toList()); return new SuccessResponseData<>(collect); }