From bd3314db1c0851997c6ce7abf3d51e61e7f79fde Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Mon, 27 Jan 2025 16:49:12 +0800 Subject: [PATCH] custauth --- .../config/response/ResponseWrapper.java | 104 ++--- bonus-cust-auth/pom.xml | 102 +++-- .../bonus/auth/BonusCustAuthApplication.java | 8 +- .../auth/controller/TokenController.java | 18 +- bonus-modules/bonus-smart-canteen/pom.xml | 10 +- .../net/xnzn/core/common/page/PageDTO.java | 348 ++++++++-------- .../net/xnzn/core/common/page/PageVO.java | 382 +++++++++--------- 7 files changed, 496 insertions(+), 476 deletions(-) diff --git a/bonus-common-biz/src/main/java/net/xnzn/framework/config/response/ResponseWrapper.java b/bonus-common-biz/src/main/java/net/xnzn/framework/config/response/ResponseWrapper.java index f0dab755..e7350026 100644 --- a/bonus-common-biz/src/main/java/net/xnzn/framework/config/response/ResponseWrapper.java +++ b/bonus-common-biz/src/main/java/net/xnzn/framework/config/response/ResponseWrapper.java @@ -1,52 +1,52 @@ -package net.xnzn.framework.config.response; - -import io.swagger.annotations.ApiModelProperty; - -import java.io.Serializable; - -public class ResponseWrapper implements Serializable { - @ApiModelProperty("状态码") - protected Integer code = 10000; - @ApiModelProperty("返回信息") - protected String msg = "成功"; - @ApiModelProperty("返回数据") - protected T data; - - public ResponseWrapper(T data) { - this.data = data; - } - - public static ResponseWrapper fails(Integer code, String errorMsg) { - ResponseWrapper apiResult = new ResponseWrapper(); - apiResult.setCode(code == null ? '鱄' : code); - apiResult.setMsg(errorMsg); - return apiResult; - } - - public Integer getCode() { - return this.code; - } - - public String getMsg() { - return this.msg; - } - - public T getData() { - return this.data; - } - - public void setCode(final Integer code) { - this.code = code; - } - - public void setMsg(final String msg) { - this.msg = msg; - } - - public void setData(final T data) { - this.data = data; - } - - public ResponseWrapper() { - } -} +//package net.xnzn.framework.config.response; +// +//import io.swagger.annotations.ApiModelProperty; +// +//import java.io.Serializable; +// +//public class ResponseWrapper implements Serializable { +// @ApiModelProperty("状态码") +// protected Integer code = 10000; +// @ApiModelProperty("返回信息") +// protected String msg = "成功"; +// @ApiModelProperty("返回数据") +// protected T data; +// +// public ResponseWrapper(T data) { +// this.data = data; +// } +// +// public static ResponseWrapper fails(Integer code, String errorMsg) { +// ResponseWrapper apiResult = new ResponseWrapper(); +// apiResult.setCode(code == null ? '鱄' : code); +// apiResult.setMsg(errorMsg); +// return apiResult; +// } +// +// public Integer getCode() { +// return this.code; +// } +// +// public String getMsg() { +// return this.msg; +// } +// +// public T getData() { +// return this.data; +// } +// +// public void setCode(final Integer code) { +// this.code = code; +// } +// +// public void setMsg(final String msg) { +// this.msg = msg; +// } +// +// public void setData(final T data) { +// this.data = data; +// } +// +// public ResponseWrapper() { +// } +//} diff --git a/bonus-cust-auth/pom.xml b/bonus-cust-auth/pom.xml index dda697d3..3e15998a 100644 --- a/bonus-cust-auth/pom.xml +++ b/bonus-cust-auth/pom.xml @@ -16,6 +16,16 @@ + + + com.github.ulisesbocchio + jasypt-spring-boot-starter + ${jasypt-spring-boot-starter.version} + + + org.springframework + spring-test + com.alibaba.cloud @@ -46,28 +56,37 @@ spring-boot-starter-actuator - - - com.bonus - bonus-common-security - - - - com.github.ulisesbocchio - jasypt-spring-boot-starter - ${jasypt-spring-boot-starter.version} - - - - com.bonus - bonus-common-log - io.springfox springfox-swagger-ui ${swagger.fox.version} + + + + com.mysql + mysql-connector-j + + + + + com.bonus + bonus-common-datasource + + + + + com.bonus + bonus-common-datascope + + + + + com.bonus + bonus-common-log + + com.bonus @@ -80,28 +99,17 @@ portable-1.7.8 + + com.google.guava + guava + 30.0-jre + compile + + org.springframework.boot spring-boot-starter-mail - - com.bonus - bonus-common-config - 24.12.0-SNAPSHOT - compile - - - javax.servlet - servlet-api - 2.5 - compile - - - com.alibaba - druid - 1.2.23 - compile - com.bonus bonus-common-biz @@ -109,12 +117,30 @@ compile - com.google.guava - guava - 33.0.0-jre - compile + junit + junit + test + + + + org.apache.poi + poi-ooxml + 5.2.3 + + + + com.alipay.sdk + alipay-sdk-java + 4.34.0.ALL + + + + + + + diff --git a/bonus-cust-auth/src/main/java/com/bonus/auth/BonusCustAuthApplication.java b/bonus-cust-auth/src/main/java/com/bonus/auth/BonusCustAuthApplication.java index c4baabde..5867331c 100644 --- a/bonus-cust-auth/src/main/java/com/bonus/auth/BonusCustAuthApplication.java +++ b/bonus-cust-auth/src/main/java/com/bonus/auth/BonusCustAuthApplication.java @@ -1,24 +1,28 @@ package com.bonus.auth; +import com.bonus.common.security.annotation.EnableCustomConfig; import com.bonus.common.swagger.annotation.EnableCustomSwagger2; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import com.bonus.common.security.annotation.EnableRyFeignClients; +import org.springframework.scheduling.annotation.EnableScheduling; /** * 认证授权中心 * * @author bonus */ +@EnableCustomConfig @EnableCustomSwagger2 +@EnableScheduling @EnableRyFeignClients -@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class }) +@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) public class BonusCustAuthApplication { public static void main(String[] args) { SpringApplication.run(BonusCustAuthApplication.class, args); - System.out.println("认证授权中心启动成功"); + System.out.println("客户认证授权中心启动成功"); } } diff --git a/bonus-cust-auth/src/main/java/com/bonus/auth/controller/TokenController.java b/bonus-cust-auth/src/main/java/com/bonus/auth/controller/TokenController.java index 1267de54..c94dbff3 100644 --- a/bonus-cust-auth/src/main/java/com/bonus/auth/controller/TokenController.java +++ b/bonus-cust-auth/src/main/java/com/bonus/auth/controller/TokenController.java @@ -29,6 +29,7 @@ import com.bonus.system.api.RemoteUserService; import lombok.extern.slf4j.Slf4j; import net.xnzn.service.TokenService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -50,23 +51,12 @@ public class TokenController { private SystemConfig config; @Autowired + @Lazy private TokenService tokenService; @Autowired private SysLoginService sysLoginService; - @Autowired - private LoginStrategyFactory loginStrategyFactory; - - @Resource - private RemoteUserService remoteUserService; - - @Autowired - private SysPasswordService passwordService; - - @Autowired - private PasswordValidatorService passwordValidatorService; - @Autowired private SysRecordLogService logService; @@ -76,10 +66,10 @@ public class TokenController { @Resource private RemoteConfigService configService; - @Resource + @Autowired private CustInfoMapper custInfoMapper; - @Resource + @Autowired private CustCasualMapper custCasualMapper; private static final BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(); diff --git a/bonus-modules/bonus-smart-canteen/pom.xml b/bonus-modules/bonus-smart-canteen/pom.xml index df2217c2..a4ad1a33 100644 --- a/bonus-modules/bonus-smart-canteen/pom.xml +++ b/bonus-modules/bonus-smart-canteen/pom.xml @@ -123,11 +123,11 @@ alipay-sdk-java 4.34.0.ALL - - com.baomidou - mybatis-plus-extension - 3.5.6 - + + + + + diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/net/xnzn/core/common/page/PageDTO.java b/bonus-modules/bonus-smart-canteen/src/main/java/net/xnzn/core/common/page/PageDTO.java index b35d6464..67e95468 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/net/xnzn/core/common/page/PageDTO.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/net/xnzn/core/common/page/PageDTO.java @@ -1,174 +1,174 @@ -package net.xnzn.core.common.page; - -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.github.pagehelper.page.PageMethod; -import io.swagger.annotations.ApiModelProperty; -import net.xnzn.constant.LeConstants; -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -public class PageDTO { - @ApiModelProperty("当前页(默认1)") - private Long current; - @ApiModelProperty("每页显示条数(默认10) -1查询全部") - private Long size; - @ApiModelProperty("是否包含count查询 1是 2否 默认是") - private Integer ifCount; - @ApiModelProperty("size空(-1)时是否查询全部 1是 2否 默认是") - private Integer ifPageSizeZero; - @ApiModelProperty("排序,支持多个(仅支持PageHelper)") - private List orders; - - public Long getCurrent() { - return !ObjectUtil.isNull(this.current) && this.current > 0L ? this.current : 1L; - } - - public Long getSize() { - return !ObjectUtil.isNull(this.size) && this.size != 0L ? this.size : 10L; - } - - public List getOrders() { - return ObjectUtil.isNull(this.orders) ? Collections.emptyList() : this.orders; - } - - @ApiModelProperty( - value = "分页条件", - hidden = true - ) - public String getOrderString() { - return (String)this.getOrders().stream().map(OrderItem::orderString).collect(Collectors.joining(",")); - } - - @ApiModelProperty( - value = "PageHelper使用字段:pageNum", - hidden = true - ) - public int getPageNum() { - return this.getCurrent().intValue(); - } - - @ApiModelProperty( - value = "PageHelper使用字段:pageSize", - hidden = true - ) - public int getPageSize() { - int sizeValue = this.getSize().intValue(); - return sizeValue == -1 ? 0 : sizeValue; - } - - @ApiModelProperty( - value = "PageHelper使用字段:orderBy", - hidden = true - ) - public String getOrderBy() { - return this.getOrderString(); - } - - @ApiModelProperty( - value = "PageHelper使用字段:countSql(是否包含count查询)", - hidden = true - ) - public Boolean getCountSql() { - return LeConstants.COMMON_YES.equals(this.ifCount); - } - - @ApiModelProperty( - value = "PageHelper使用字段:pageSizeZero(size 0是否查询全部)", - hidden = true - ) - public Boolean getPageSizeZero() { - return LeConstants.COMMON_YES.equals(this.ifPageSizeZero); - } - - public void startPage() { - PageMethod.startPage(this); - } - - public static PageDTO of(Long current, Long size) { - PageDTO pageDTO = new PageDTO(); - pageDTO.setCurrent(current); - pageDTO.setSize(size); - return pageDTO; - } - - public static PageDTO countOnly() { - PageDTO pageDTO = new PageDTO(); - pageDTO.setCurrent(1L); - pageDTO.setSize(-1L); - pageDTO.setIfCount(LeConstants.COMMON_YES); - pageDTO.setIfPageSizeZero(LeConstants.COMMON_NO); - return pageDTO; - } - - public static void startPage(PageDTO page) { - if (!Objects.isNull(page)) { - page.startPage(); - } - } - - public PageDTO() { - this.ifCount = LeConstants.COMMON_YES; - this.ifPageSizeZero = LeConstants.COMMON_YES; - } - - public Integer getIfCount() { - return this.ifCount; - } - - public Integer getIfPageSizeZero() { - return this.ifPageSizeZero; - } - - public void setCurrent(final Long current) { - this.current = current; - } - - public void setSize(final Long size) { - this.size = size; - } - - public void setIfCount(final Integer ifCount) { - this.ifCount = ifCount; - } - - public void setIfPageSizeZero(final Integer ifPageSizeZero) { - this.ifPageSizeZero = ifPageSizeZero; - } - - public void setOrders(final List orders) { - this.orders = orders; - } - - public static class OrderItem { - @ApiModelProperty("字段名") - private String column; - @ApiModelProperty("true增序 false降序") - private Boolean asc = true; - - @JsonIgnore - public String orderString() { - String var10000 = StrUtil.toUnderlineCase(this.column); - return var10000 + " " + (this.asc ? "ASC" : "DESC"); - } - - public String getColumn() { - return this.column; - } - - public Boolean getAsc() { - return this.asc; - } - - public void setColumn(final String column) { - this.column = column; - } - - public void setAsc(final Boolean asc) { - this.asc = asc; - } - } -} +//package net.xnzn.core.common.page; +// +//import cn.hutool.core.util.ObjectUtil; +//import cn.hutool.core.util.StrUtil; +//import com.fasterxml.jackson.annotation.JsonIgnore; +//import com.github.pagehelper.page.PageMethod; +//import io.swagger.annotations.ApiModelProperty; +//import net.xnzn.constant.LeConstants; +//import java.util.Collections; +//import java.util.List; +//import java.util.Objects; +//import java.util.stream.Collectors; +// +//public class PageDTO { +// @ApiModelProperty("当前页(默认1)") +// private Long current; +// @ApiModelProperty("每页显示条数(默认10) -1查询全部") +// private Long size; +// @ApiModelProperty("是否包含count查询 1是 2否 默认是") +// private Integer ifCount; +// @ApiModelProperty("size空(-1)时是否查询全部 1是 2否 默认是") +// private Integer ifPageSizeZero; +// @ApiModelProperty("排序,支持多个(仅支持PageHelper)") +// private List orders; +// +// public Long getCurrent() { +// return !ObjectUtil.isNull(this.current) && this.current > 0L ? this.current : 1L; +// } +// +// public Long getSize() { +// return !ObjectUtil.isNull(this.size) && this.size != 0L ? this.size : 10L; +// } +// +// public List getOrders() { +// return ObjectUtil.isNull(this.orders) ? Collections.emptyList() : this.orders; +// } +// +// @ApiModelProperty( +// value = "分页条件", +// hidden = true +// ) +// public String getOrderString() { +// return (String)this.getOrders().stream().map(OrderItem::orderString).collect(Collectors.joining(",")); +// } +// +// @ApiModelProperty( +// value = "PageHelper使用字段:pageNum", +// hidden = true +// ) +// public int getPageNum() { +// return this.getCurrent().intValue(); +// } +// +// @ApiModelProperty( +// value = "PageHelper使用字段:pageSize", +// hidden = true +// ) +// public int getPageSize() { +// int sizeValue = this.getSize().intValue(); +// return sizeValue == -1 ? 0 : sizeValue; +// } +// +// @ApiModelProperty( +// value = "PageHelper使用字段:orderBy", +// hidden = true +// ) +// public String getOrderBy() { +// return this.getOrderString(); +// } +// +// @ApiModelProperty( +// value = "PageHelper使用字段:countSql(是否包含count查询)", +// hidden = true +// ) +// public Boolean getCountSql() { +// return LeConstants.COMMON_YES.equals(this.ifCount); +// } +// +// @ApiModelProperty( +// value = "PageHelper使用字段:pageSizeZero(size 0是否查询全部)", +// hidden = true +// ) +// public Boolean getPageSizeZero() { +// return LeConstants.COMMON_YES.equals(this.ifPageSizeZero); +// } +// +// public void startPage() { +// PageMethod.startPage(this); +// } +// +// public static PageDTO of(Long current, Long size) { +// PageDTO pageDTO = new PageDTO(); +// pageDTO.setCurrent(current); +// pageDTO.setSize(size); +// return pageDTO; +// } +// +// public static PageDTO countOnly() { +// PageDTO pageDTO = new PageDTO(); +// pageDTO.setCurrent(1L); +// pageDTO.setSize(-1L); +// pageDTO.setIfCount(LeConstants.COMMON_YES); +// pageDTO.setIfPageSizeZero(LeConstants.COMMON_NO); +// return pageDTO; +// } +// +// public static void startPage(PageDTO page) { +// if (!Objects.isNull(page)) { +// page.startPage(); +// } +// } +// +// public PageDTO() { +// this.ifCount = LeConstants.COMMON_YES; +// this.ifPageSizeZero = LeConstants.COMMON_YES; +// } +// +// public Integer getIfCount() { +// return this.ifCount; +// } +// +// public Integer getIfPageSizeZero() { +// return this.ifPageSizeZero; +// } +// +// public void setCurrent(final Long current) { +// this.current = current; +// } +// +// public void setSize(final Long size) { +// this.size = size; +// } +// +// public void setIfCount(final Integer ifCount) { +// this.ifCount = ifCount; +// } +// +// public void setIfPageSizeZero(final Integer ifPageSizeZero) { +// this.ifPageSizeZero = ifPageSizeZero; +// } +// +// public void setOrders(final List orders) { +// this.orders = orders; +// } +// +// public static class OrderItem { +// @ApiModelProperty("字段名") +// private String column; +// @ApiModelProperty("true增序 false降序") +// private Boolean asc = true; +// +// @JsonIgnore +// public String orderString() { +// String var10000 = StrUtil.toUnderlineCase(this.column); +// return var10000 + " " + (this.asc ? "ASC" : "DESC"); +// } +// +// public String getColumn() { +// return this.column; +// } +// +// public Boolean getAsc() { +// return this.asc; +// } +// +// public void setColumn(final String column) { +// this.column = column; +// } +// +// public void setAsc(final Boolean asc) { +// this.asc = asc; +// } +// } +//} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/net/xnzn/core/common/page/PageVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/net/xnzn/core/common/page/PageVO.java index ad1d88d2..8d23f347 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/net/xnzn/core/common/page/PageVO.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/net/xnzn/core/common/page/PageVO.java @@ -1,197 +1,197 @@ -package net.xnzn.core.common.page; - -import com.github.pagehelper.Page; -import java.util.Collections; -import java.util.List; - -public class PageVO { - protected List records; - protected long total; - protected long size; - protected long current; - protected boolean searchCount; - private String orderBy; - - public PageVO() { - this.records = Collections.emptyList(); - this.total = 0L; - this.size = 10L; - this.current = 1L; - this.searchCount = true; - } - - public PageVO(long current, long size) { - this(current, size, 0L); - } - - public PageVO(long current, long size, long total) { - this(current, size, total, true); - } - - public PageVO(long current, long size, boolean searchCount) { - this(current, size, 0L, searchCount); - } - - public PageVO(long current, long size, long total, boolean searchCount) { - this.records = Collections.emptyList(); - this.total = 0L; - this.size = 10L; - this.current = 1L; - this.searchCount = true; - if (current > 1L) { - this.current = current; - } - - this.size = size; - this.total = total; - this.searchCount = searchCount; - } - - public static PageVO empty() { - return new PageVO(); - } - - public static PageVO of(long current, long size, long total, boolean searchCount) { - return new PageVO(current, size, total, searchCount); - } - - public static PageVO of(long current, long size) { - return of(current, size, 0L); - } - - public static PageVO of(long current, long size, long total) { - return of(current, size, total, true); - } - - public static PageVO of(long current, long size, boolean searchCount) { - return of(current, size, 0L, searchCount); - } - -// public static PageVO of(List page, List records) { -// if (page instanceof Page) { -// PageVO vo = of((long)((Page)page).getPageNum(), (long)((Page)page).getPageSize(), ((Page)page).getTotal(), ((Page)page).isCount()); -// vo.setOrderBy(((Page)page).getOrderBy()); +//package net.xnzn.core.common.page; +// +//import com.github.pagehelper.Page; +//import java.util.Collections; +//import java.util.List; +// +//public class PageVO { +// protected List records; +// protected long total; +// protected long size; +// protected long current; +// protected boolean searchCount; +// private String orderBy; +// +// public PageVO() { +// this.records = Collections.emptyList(); +// this.total = 0L; +// this.size = 10L; +// this.current = 1L; +// this.searchCount = true; +// } +// +// public PageVO(long current, long size) { +// this(current, size, 0L); +// } +// +// public PageVO(long current, long size, long total) { +// this(current, size, total, true); +// } +// +// public PageVO(long current, long size, boolean searchCount) { +// this(current, size, 0L, searchCount); +// } +// +// public PageVO(long current, long size, long total, boolean searchCount) { +// this.records = Collections.emptyList(); +// this.total = 0L; +// this.size = 10L; +// this.current = 1L; +// this.searchCount = true; +// if (current > 1L) { +// this.current = current; +// } +// +// this.size = size; +// this.total = total; +// this.searchCount = searchCount; +// } +// +// public static PageVO empty() { +// return new PageVO(); +// } +// +// public static PageVO of(long current, long size, long total, boolean searchCount) { +// return new PageVO(current, size, total, searchCount); +// } +// +// public static PageVO of(long current, long size) { +// return of(current, size, 0L); +// } +// +// public static PageVO of(long current, long size, long total) { +// return of(current, size, total, true); +// } +// +// public static PageVO of(long current, long size, boolean searchCount) { +// return of(current, size, 0L, searchCount); +// } +// +//// public static PageVO of(List page, List records) { +//// if (page instanceof Page) { +//// PageVO vo = of((long)((Page)page).getPageNum(), (long)((Page)page).getPageSize(), ((Page)page).getTotal(), ((Page)page).isCount()); +//// vo.setOrderBy(((Page)page).getOrderBy()); +//// vo.setRecords(records); +//// return vo; +//// } else { +//// return of(records); +//// } +//// } +// +//// public static PageVO of(List records) { +//// PageVO vo = new PageVO(); +//// vo.setRecords(records); +//// if (records instanceof Page ghRecords) { +//// vo.setCurrent((long)ghRecords.getPageNum()).setSize((long)ghRecords.getPageSize()).setTotal(ghRecords.getTotal()).setSearchCount(ghRecords.isCount()).setOrderBy(vo.getOrderBy()); +//// } +//// +//// return vo; +//// } +// +//// public static PageVO of(PageDTO pageDTO, List records) { +//// PageVO vo = new PageVO(); +//// vo.setRecords(records); +//// if (records instanceof Page ghRecords) { +//// vo.setCurrent((long)ghRecords.getPageNum()).setSize((long)ghRecords.getPageSize()).setTotal(ghRecords.getTotal()).setSearchCount(ghRecords.isCount()).setOrderBy(vo.getOrderBy()); +//// } else if (records != null) { +//// vo.setCurrent(pageDTO.getCurrent()).setSize(pageDTO.getSize()).setTotal((long)records.size()).setOrderBy(pageDTO.getOrderBy()); +//// } +//// +//// return vo; +//// } +// +// public static PageVO of(com.baomidou.mybatisplus.extension.plugins.pagination.Page page) { +// if (page == null) { +// return new PageVO(); +// } else { +// PageVO vo = of(page.getCurrent(), page.getSize(), page.getTotal(), page.searchCount()); +// vo.setRecords(page.getRecords()); +// return vo; +// } +// } +// +// public static PageVO of(com.baomidou.mybatisplus.extension.plugins.pagination.Page page, List records) { +// if (page == null) { +// return new PageVO(); +// } else { +// PageVO vo = of(page.getCurrent(), page.getSize(), page.getTotal(), page.searchCount()); // vo.setRecords(records); // return vo; +// } +// } +// +// public boolean hasPrevious() { +// return this.current > 1L; +// } +// +// public boolean hasNext() { +// return this.current < this.getPages(); +// } +// +// public List getRecords() { +// return this.records; +// } +// +// public PageVO setRecords(List records) { +// this.records = records; +// return this; +// } +// +// public long getTotal() { +// return this.total; +// } +// +// public PageVO setTotal(long total) { +// this.total = total; +// return this; +// } +// +// public long getSize() { +// return this.size; +// } +// +// public PageVO setSize(long size) { +// this.size = size; +// return this; +// } +// +// public long getCurrent() { +// return this.current; +// } +// +// public PageVO setCurrent(long current) { +// this.current = current; +// return this; +// } +// +// public PageVO setSearchCount(boolean searchCount) { +// this.searchCount = searchCount; +// return this; +// } +// +// public String getOrderBy() { +// return this.orderBy; +// } +// +// public PageVO setOrderBy(String orderBy) { +// this.orderBy = orderBy; +// return this; +// } +// +// public long getPages() { +// if (this.getSize() == 0L) { +// return 0L; // } else { -// return of(records); -// } -// } - -// public static PageVO of(List records) { -// PageVO vo = new PageVO(); -// vo.setRecords(records); -// if (records instanceof Page ghRecords) { -// vo.setCurrent((long)ghRecords.getPageNum()).setSize((long)ghRecords.getPageSize()).setTotal(ghRecords.getTotal()).setSearchCount(ghRecords.isCount()).setOrderBy(vo.getOrderBy()); -// } +// long pages = this.getTotal() / this.getSize(); +// if (this.getTotal() % this.getSize() != 0L) { +// ++pages; +// } // -// return vo; -// } - -// public static PageVO of(PageDTO pageDTO, List records) { -// PageVO vo = new PageVO(); -// vo.setRecords(records); -// if (records instanceof Page ghRecords) { -// vo.setCurrent((long)ghRecords.getPageNum()).setSize((long)ghRecords.getPageSize()).setTotal(ghRecords.getTotal()).setSearchCount(ghRecords.isCount()).setOrderBy(vo.getOrderBy()); -// } else if (records != null) { -// vo.setCurrent(pageDTO.getCurrent()).setSize(pageDTO.getSize()).setTotal((long)records.size()).setOrderBy(pageDTO.getOrderBy()); +// return pages; // } -// -// return vo; // } - - public static PageVO of(com.baomidou.mybatisplus.extension.plugins.pagination.Page page) { - if (page == null) { - return new PageVO(); - } else { - PageVO vo = of(page.getCurrent(), page.getSize(), page.getTotal(), page.searchCount()); - vo.setRecords(page.getRecords()); - return vo; - } - } - - public static PageVO of(com.baomidou.mybatisplus.extension.plugins.pagination.Page page, List records) { - if (page == null) { - return new PageVO(); - } else { - PageVO vo = of(page.getCurrent(), page.getSize(), page.getTotal(), page.searchCount()); - vo.setRecords(records); - return vo; - } - } - - public boolean hasPrevious() { - return this.current > 1L; - } - - public boolean hasNext() { - return this.current < this.getPages(); - } - - public List getRecords() { - return this.records; - } - - public PageVO setRecords(List records) { - this.records = records; - return this; - } - - public long getTotal() { - return this.total; - } - - public PageVO setTotal(long total) { - this.total = total; - return this; - } - - public long getSize() { - return this.size; - } - - public PageVO setSize(long size) { - this.size = size; - return this; - } - - public long getCurrent() { - return this.current; - } - - public PageVO setCurrent(long current) { - this.current = current; - return this; - } - - public PageVO setSearchCount(boolean searchCount) { - this.searchCount = searchCount; - return this; - } - - public String getOrderBy() { - return this.orderBy; - } - - public PageVO setOrderBy(String orderBy) { - this.orderBy = orderBy; - return this; - } - - public long getPages() { - if (this.getSize() == 0L) { - return 0L; - } else { - long pages = this.getTotal() / this.getSize(); - if (this.getTotal() % this.getSize() != 0L) { - ++pages; - } - - return pages; - } - } - - public boolean searchCount() { - return this.total < 0L ? false : this.searchCount; - } -} +// +// public boolean searchCount() { +// return this.total < 0L ? false : this.searchCount; +// } +//}