From ddd1c3196aeaa2a3718c456e8001ef1c4255a6aa Mon Sep 17 00:00:00 2001 From: lizhicheng Date: Mon, 31 Oct 2022 14:55:36 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E9=97=A8=E5=88=86=E9=A1=B5=E3=80=81ur?= =?UTF-8?q?l=E5=89=8D=E7=BC=80=E6=94=B9=E4=B8=BAucs-admin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/SysLogOperationServiceImpl.java | 8 +++--- .../sys/controller/SysDeptController.java | 26 +++++++++++++++++++ .../src/main/resources/application.yml | 2 +- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/log/service/impl/SysLogOperationServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/log/service/impl/SysLogOperationServiceImpl.java index f6e2dfde..23507047 100644 --- a/renren-admin/src/main/java/io/renren/modules/log/service/impl/SysLogOperationServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/log/service/impl/SysLogOperationServiceImpl.java @@ -56,14 +56,14 @@ public class SysLogOperationServiceImpl extends BaseServiceImpl - wrapper.like("request_uri", "/renren-admin/resource%/insert") + wrapper.like("request_uri", "/ucs-admin/resource%/insert") .or() - .like("request_uri", "/renren-admin/resource%/update") + .like("request_uri", "/ucs-admin/resource%/update") .or() - .like("request_uri", "/renren-admin/resource%/delete")); + .like("request_uri", "/ucs-admin/resource%/delete")); } else { queryWrapper.like(StringUtils.isNotBlank(operationType), "request_uri", operationType); } diff --git a/renren-admin/src/main/java/io/renren/modules/sys/controller/SysDeptController.java b/renren-admin/src/main/java/io/renren/modules/sys/controller/SysDeptController.java index 100e4698..acbf715b 100644 --- a/renren-admin/src/main/java/io/renren/modules/sys/controller/SysDeptController.java +++ b/renren-admin/src/main/java/io/renren/modules/sys/controller/SysDeptController.java @@ -1,6 +1,8 @@ package io.renren.modules.sys.controller; import io.renren.common.annotation.LogOperation; +import io.renren.common.constant.Constant; +import io.renren.common.page.PageData; import io.renren.common.utils.Result; import io.renren.common.validator.AssertUtils; import io.renren.common.validator.ValidatorUtils; @@ -15,14 +17,18 @@ import io.renren.modules.sys.enums.SuperAdminEnum; import io.renren.modules.sys.service.SysDeptService; import io.renren.modules.sys.service.SysUserService; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; +import springfox.documentation.annotations.ApiIgnore; import java.util.*; +import java.util.stream.Collectors; /** * 部门管理 @@ -48,6 +54,26 @@ public class SysDeptController { return new Result>().ok(list); } + @GetMapping("page") + @ApiOperation("分页") + @ApiImplicitParams({ + @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType = "int"), + @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int") + }) + public Result> page(@ApiIgnore @RequestParam Map params) { + long curPage = 1; + long limit = 10; + if (params.get(Constant.PAGE) != null) { + curPage = Long.parseLong((String) params.get(Constant.PAGE)); + } + if (params.get(Constant.LIMIT) != null) { + limit = Long.parseLong((String) params.get(Constant.LIMIT)); + } + List dtoList = sysDeptService.list(new HashMap<>(1)); + List result = dtoList.stream().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList()); + return new Result>().ok(new PageData(result, dtoList.size())); + } + @GetMapping("listForRegion") @ApiOperation("查询区域管理员管理的部门") @LogOperation("查询区域管理员管理的部门") diff --git a/renren-admin/src/main/resources/application.yml b/renren-admin/src/main/resources/application.yml index 78bced7a..4381134f 100644 --- a/renren-admin/src/main/resources/application.yml +++ b/renren-admin/src/main/resources/application.yml @@ -36,7 +36,7 @@ server: min-spare: 30 port: 9090 servlet: - context-path: /renren-admin + context-path: /ucs-admin session: cookie: http-only: true