From 10a197878527f0a9c44e6f6f31e2c1ea9e30c50c Mon Sep 17 00:00:00 2001 From: tianliyong Date: Mon, 24 Oct 2022 19:52:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E9=A1=B5=E7=9B=B8=E5=85=B3=E5=B0=81?= =?UTF-8?q?=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + RELEASE.md | 1 + axzo-common-domain/pom.xml | 10 ++++++++ .../domain/web/result/ApiPageResult.java | 12 +++++++--- axzo-common-web/pom.xml | 8 ++++++- .../http/ApiPageEntity.java | 14 ++++++++--- pom.xml | 24 ------------------- 7 files changed, 39 insertions(+), 31 deletions(-) create mode 100644 README.md create mode 100644 RELEASE.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..ee90a3e --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# 整体介绍 \ No newline at end of file diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 0000000..c953a60 --- /dev/null +++ b/RELEASE.md @@ -0,0 +1 @@ +# 版本发布 \ No newline at end of file diff --git a/axzo-common-domain/pom.xml b/axzo-common-domain/pom.xml index 920ac07..b818aa2 100644 --- a/axzo-common-domain/pom.xml +++ b/axzo-common-domain/pom.xml @@ -87,5 +87,15 @@ swagger-annotations provided + + com.github.pagehelper + pagehelper + provided + + + com.baomidou + mybatis-plus-core + provided + \ No newline at end of file diff --git a/axzo-common-domain/src/main/java/cn/axzo/framework/domain/web/result/ApiPageResult.java b/axzo-common-domain/src/main/java/cn/axzo/framework/domain/web/result/ApiPageResult.java index 905dbe2..02d756f 100644 --- a/axzo-common-domain/src/main/java/cn/axzo/framework/domain/web/result/ApiPageResult.java +++ b/axzo-common-domain/src/main/java/cn/axzo/framework/domain/web/result/ApiPageResult.java @@ -5,7 +5,9 @@ import cn.axzo.framework.domain.page.PageImpl; import cn.axzo.framework.domain.page.PageVerbose; import cn.axzo.framework.domain.page.Pageable; import cn.axzo.framework.domain.web.code.IRespCode; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.github.pagehelper.PageInfo; import com.google.common.collect.Lists; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -69,14 +71,18 @@ public class ApiPageResult extends ApiCoreResult> { return ok(data, page.getTotal(), pageNum, pageSize, verbose); } -// public static ApiPageResult ok(PageInfo pageInfo) { -// return ok(pageInfo.getList(), pageInfo.getTotal(), pageInfo.getPageNum(), pageInfo.getPageSize()); -// } + public static ApiPageResult ok(PageInfo pageInfo) { + return ok(pageInfo.getList(), pageInfo.getTotal(), pageInfo.getPageNum(), pageInfo.getPageSize()); + } public static ApiPageResult ok(org.springframework.data.domain.Page page) { return ok(page.getContent(), page.getTotalElements()); } + public static ApiPageResult ok(IPage page) { + return ok(page.getRecords(), page.getTotal(), (int)page.getCurrent(), (int)page.getSize()); + } + public static ApiPageResult ok(List data, Long total) { return build(total, SUCCESS.getRespCode(), SUCCESS.getMessage(), data, null, null, null); diff --git a/axzo-common-web/pom.xml b/axzo-common-web/pom.xml index 73172fc..56d5ced 100644 --- a/axzo-common-web/pom.xml +++ b/axzo-common-web/pom.xml @@ -36,7 +36,13 @@ com.github.pagehelper - pagehelper-spring-boot-starter + pagehelper + provided + + + + com.baomidou + mybatis-plus-core provided diff --git a/axzo-common-web/src/main/java/cn.axzo.framework.web/http/ApiPageEntity.java b/axzo-common-web/src/main/java/cn.axzo.framework.web/http/ApiPageEntity.java index 015ab77..d2cdcf7 100644 --- a/axzo-common-web/src/main/java/cn.axzo.framework.web/http/ApiPageEntity.java +++ b/axzo-common-web/src/main/java/cn.axzo.framework.web/http/ApiPageEntity.java @@ -1,5 +1,6 @@ package cn.axzo.framework.web.http; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.pagehelper.PageInfo; import cn.axzo.framework.core.net.Nets; import cn.axzo.framework.domain.page.Page; @@ -60,6 +61,10 @@ public class ApiPageEntity extends ApiCoreEntity, ApiPageResult> { // return status(HttpStatus.OK).ok(pageInfo); // } + public static ApiPageEntity ok(IPage page) { + return status(HttpStatus.OK).ok(page); + } + public static ApiPageEntityBuilder status(@Nonnull HttpStatus status) { Assert.notNull(status, "HttpStatus must not be null"); return new ApiPageEntityBuilder(status); @@ -137,9 +142,12 @@ public class ApiPageEntity extends ApiCoreEntity, ApiPageResult> { return wrapper(ApiPageResult.ok(page)); } -// public ApiPageEntity ok(PageInfo pageInfo) { -// return wrapper(ApiPageResult.ok(pageInfo)); -// } + public ApiPageEntity ok(PageInfo pageInfo) { + return wrapper(ApiPageResult.ok(pageInfo)); + } + public ApiPageEntity ok(IPage page) { + return wrapper(ApiPageResult.ok(page)); + } public ApiPageEntity ok(List data, Long total) { return wrapper(ApiPageResult.ok(data, total)); diff --git a/pom.xml b/pom.xml index 8db86c1..b6ce6ed 100644 --- a/pom.xml +++ b/pom.xml @@ -64,28 +64,4 @@ - - - - - nexus - - false - - - - nexus - my-nexus-repository - https://nexus.axzo.cn/content/groups/public/ - - - - - nexus - my-nexus-repository - https://nexus.axzo.cn/content/groups/public/ - - - -