From 293db76bd67018b40c9167eec1746c41d756d3bc Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期二, 28 十二月 2021 14:33:26 +0800
Subject: [PATCH] remove 移除过期代码 分页工具相关
---
ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/core/IServicePlus.java | 39 -------
/dev/null | 193 --------------------------------------
ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/core/ServicePlusImpl.java | 15 ---
3 files changed, 0 insertions(+), 247 deletions(-)
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/core/IServicePlus.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/core/IServicePlus.java
index e645562..f45a14e 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/core/IServicePlus.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/core/IServicePlus.java
@@ -1,10 +1,8 @@
package com.ruoyi.common.core.mybatisplus.core;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.IService;
-import com.ruoyi.common.core.page.PagePlus;
import java.io.Serializable;
import java.util.Collection;
@@ -109,43 +107,6 @@
*/
default List<V> listVo(Function<Collection<T>, List<V>> convertor) {
return listVo(Wrappers.emptyWrapper(), convertor);
- }
-
- /**
- * @param page 鍒嗛〉瀵硅薄
- * @param queryWrapper 鏌ヨ鏉′欢
- * @return V瀵硅薄
- * @deprecated 3.6.0 绉婚櫎 璇蜂娇鐢� {@link ServicePlusImpl#pageVo(IPage, Wrapper)}
- */
- @Deprecated
- PagePlus<T, V> pageVo(PagePlus<T, V> page, Wrapper<T> queryWrapper);
-
- /**
- * @param convertor 鑷畾涔夎浆鎹㈠櫒
- * @deprecated 3.6.0 绉婚櫎 璇蜂娇鐢� {@link ServicePlusImpl#pageVo(IPage, Wrapper)}
- */
- @Deprecated
- default PagePlus<T, V> pageVo(PagePlus<T, V> page, Wrapper<T> queryWrapper,
- Function<Collection<T>, List<V>> convertor) {
- PagePlus<T, V> result = getBaseMapper().selectPage(page, queryWrapper);
- return result.setRecordsVo(convertor.apply(result.getRecords()));
- }
-
- /**
- * @deprecated 3.6.0 绉婚櫎 璇蜂娇鐢� {@link ServicePlusImpl#pageVo(IPage, Wrapper)}
- */
- @Deprecated
- default PagePlus<T, V> pageVo(PagePlus<T, V> page) {
- return pageVo(page, Wrappers.emptyWrapper());
- }
-
- /**
- * @param convertor 鑷畾涔夎浆鎹㈠櫒
- * @deprecated 3.6.0 绉婚櫎 璇蜂娇鐢� {@link ServicePlusImpl#pageVo(IPage, Wrapper)}
- */
- @Deprecated
- default PagePlus<T, V> pageVo(PagePlus<T, V> page, Function<Collection<T>, List<V>> convertor) {
- return pageVo(page, Wrappers.emptyWrapper(), convertor);
}
boolean saveAll(Collection<T> entityList);
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/core/ServicePlusImpl.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/core/ServicePlusImpl.java
index 0650cfa..740cc28 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/core/ServicePlusImpl.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/core/ServicePlusImpl.java
@@ -9,8 +9,6 @@
import com.baomidou.mybatisplus.core.toolkit.Assert;
import com.baomidou.mybatisplus.core.toolkit.ReflectionKit;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.common.core.page.PagePlus;
-import com.ruoyi.common.utils.BeanCopyUtils;
import com.ruoyi.common.utils.reflect.ReflectUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -198,19 +196,6 @@
@Override
public List<V> listVo(Wrapper<T> queryWrapper) {
return getBaseMapper().selectVoList(queryWrapper, voClass);
- }
-
- /**
- * 缈婚〉鏌ヨ
- * @deprecated 3.6.0 绉婚櫎 璇蜂娇鐢� {@link #pageVo(IPage, Wrapper)}
- */
- @Override
- @Deprecated
- public PagePlus<T, V> pageVo(PagePlus<T, V> page, Wrapper<T> queryWrapper) {
- PagePlus<T, V> result = getBaseMapper().selectPage(page, queryWrapper);
- List<V> volist = BeanCopyUtils.copyList(result.getRecords(), voClass);
- result.setRecordsVo(volist);
- return result;
}
/**
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PagePlus.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PagePlus.java
deleted file mode 100644
index bff381c..0000000
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PagePlus.java
+++ /dev/null
@@ -1,158 +0,0 @@
-package com.ruoyi.common.core.page;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.metadata.OrderItem;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * 鍒嗛〉 Page 澧炲己瀵硅薄
- *
- * @param <T> 鏁版嵁搴撳疄浣�
- * @param <K> vo瀹炰綋
- * @author Lion Li
- * @deprecated 3.6.0 鍒犻櫎 璇蜂娇鐢� {@link com.ruoyi.common.core.domain.PageQuery#build()}
- */
-@Data
-@Accessors(chain = true)
-@Deprecated
-public class PagePlus<T,K> implements IPage<T> {
-
- /**
- * domain瀹炰綋鍒楄〃
- */
- private List<T> records = Collections.emptyList();
-
- /**
- * vo瀹炰綋鍒楄〃
- */
- private List<K> recordsVo = Collections.emptyList();
-
- /**
- * 鎬绘暟
- */
- private long total = 0L;
-
- /**
- * 椤甸暱搴�
- */
- private long size = 10L;
-
- /**
- * 褰撳墠椤�
- */
- private long current = 1L;
-
- /**
- * 鎺掑簭瀛楁淇℃伅
- */
- private List<OrderItem> orders = new ArrayList<>();
-
- /**
- * 鑷姩浼樺寲 COUNT SQL
- */
- private boolean optimizeCountSql = true;
-
- /**
- * 鏄惁杩涜 count 鏌ヨ
- */
- private boolean isSearchCount = true;
-
- /**
- * 鏄惁鍛戒腑count缂撳瓨
- */
- private boolean hitCount = false;
-
- /**
- * countId
- */
- private String countId;
-
- /**
- * 鏈�澶imit
- */
- private Long maxLimit;
-
- public PagePlus() {
- }
-
- public PagePlus(long current, long size) {
- this(current, size, 0L);
- }
-
- public PagePlus(long current, long size, long total) {
- this(current, size, total, true);
- }
-
- public PagePlus(long current, long size, boolean isSearchCount) {
- this(current, size, 0L, isSearchCount);
- }
-
- public PagePlus(long current, long size, long total, boolean isSearchCount) {
- if (current > 1L) {
- this.current = current;
- }
- this.size = size;
- this.total = total;
- this.isSearchCount = isSearchCount;
- }
-
- @Override
- public String countId() {
- return this.getCountId();
- }
-
- @Override
- public Long maxLimit() {
- return this.getMaxLimit();
- }
-
- public PagePlus<T, K> addOrder(OrderItem... items) {
- this.orders.addAll(Arrays.asList(items));
- return this;
- }
-
- public PagePlus<T, K> addOrder(List<OrderItem> items) {
- this.orders.addAll(items);
- return this;
- }
-
- @Override
- public List<OrderItem> orders() {
- return this.getOrders();
- }
-
- @Override
- public boolean optimizeCountSql() {
- return this.optimizeCountSql;
- }
-
- @Override
- public long getPages() {
- // 瑙e喅 github issues/3208
- return IPage.super.getPages();
- }
-
- public static <T,K> PagePlus<T,K> of(long current, long size) {
- return of(current, size, 0);
- }
-
- public static <T,K> PagePlus<T,K> of(long current, long size, long total) {
- return of(current, size, total, true);
- }
-
- public static <T,K> PagePlus<T,K> of(long current, long size, boolean searchCount) {
- return of(current, size, 0, searchCount);
- }
-
- public static <T,K> PagePlus<T,K> of(long current, long size, long total, boolean searchCount) {
- return new PagePlus<>(current, size, total, searchCount);
- }
-
-}
-
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/PageUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/PageUtils.java
deleted file mode 100644
index 5042de4..0000000
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/PageUtils.java
+++ /dev/null
@@ -1,193 +0,0 @@
-package com.ruoyi.common.utils;
-
-import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.http.HttpStatus;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.metadata.OrderItem;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.common.core.domain.PageQuery;
-import com.ruoyi.common.core.page.PagePlus;
-import com.ruoyi.common.core.page.TableDataInfo;
-import com.ruoyi.common.utils.sql.SqlUtil;
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-
-import java.util.List;
-
-/**
- * 鍒嗛〉宸ュ叿
- *
- * @author Lion Li
- * @deprecated 3.6.0 鍒犻櫎 璇蜂娇鐢� {@link PageQuery} 涓� {@link TableDataInfo}
- */
-@Deprecated
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public class PageUtils {
-
- /**
- * 褰撳墠璁板綍璧峰绱㈠紩
- */
- @Deprecated
- public static final String PAGE_NUM = "pageNum";
-
- /**
- * 姣忛〉鏄剧ず璁板綍鏁�
- */
- @Deprecated
- public static final String PAGE_SIZE = "pageSize";
-
- /**
- * 鎺掑簭鍒�
- */
- @Deprecated
- public static final String ORDER_BY_COLUMN = "orderByColumn";
-
- /**
- * 鎺掑簭鐨勬柟鍚� "desc" 鎴栬�� "asc".
- */
- @Deprecated
- public static final String IS_ASC = "isAsc";
-
- /**
- * 褰撳墠璁板綍璧峰绱㈠紩 榛樿鍊�
- */
- @Deprecated
- public static final int DEFAULT_PAGE_NUM = 1;
-
- /**
- * 姣忛〉鏄剧ず璁板綍鏁� 榛樿鍊� 榛樿鏌ュ叏閮�
- */
- @Deprecated
- public static final int DEFAULT_PAGE_SIZE = Integer.MAX_VALUE;
-
- /**
- * 鏋勫缓 plus 鍒嗛〉瀵硅薄
- *
- * @param <T> domain 瀹炰綋
- * @param <K> vo 瀹炰綋
- * @return 鍒嗛〉瀵硅薄
- * @deprecated 3.6.0 鍒犻櫎 璇蜂娇鐢� {@link PageQuery#build()}
- * 鐢变簬浣跨敤 Servlet 鑾峰彇鍙兘浠� param 鑾峰彇 鐏垫椿鎬ч檷浣� 鏁呭皢浼犲弬鎿嶄綔浜ょ粰鐢ㄦ埛
- */
- @Deprecated
- public static <T, K> PagePlus<T, K> buildPagePlus() {
- Integer pageNum = ServletUtils.getParameterToInt(PAGE_NUM, DEFAULT_PAGE_NUM);
- Integer pageSize = ServletUtils.getParameterToInt(PAGE_SIZE, DEFAULT_PAGE_SIZE);
- String orderByColumn = ServletUtils.getParameter(ORDER_BY_COLUMN);
- String isAsc = ServletUtils.getParameter(IS_ASC);
- if (pageNum <= 0) {
- pageNum = DEFAULT_PAGE_NUM;
- }
- PagePlus<T, K> page = new PagePlus<>(pageNum, pageSize);
- OrderItem orderItem = buildOrderItem(orderByColumn, isAsc);
- if (ObjectUtil.isNotNull(orderItem)) {
- page.addOrder(orderItem);
- }
- return page;
- }
-
- @Deprecated
- public static <T> Page<T> buildPage() {
- return buildPage(null, null);
- }
-
- /**
- * 鏋勫缓 MP 鏅�氬垎椤靛璞�
- *
- * @param <T> domain 瀹炰綋
- * @return 鍒嗛〉瀵硅薄
- * @deprecated 3.6.0 鍒犻櫎 璇蜂娇鐢� {@link PageQuery#build()}
- * 鐢变簬浣跨敤 Servlet 鑾峰彇鍙兘浠� param 鑾峰彇 鐏垫椿鎬ч檷浣� 鏁呭皢浼犲弬鎿嶄綔浜ょ粰鐢ㄦ埛
- */
- @Deprecated
- public static <T> Page<T> buildPage(String defaultOrderByColumn, String defaultIsAsc) {
- Integer pageNum = ServletUtils.getParameterToInt(PAGE_NUM, DEFAULT_PAGE_NUM);
- Integer pageSize = ServletUtils.getParameterToInt(PAGE_SIZE, DEFAULT_PAGE_SIZE);
- String orderByColumn = ServletUtils.getParameter(ORDER_BY_COLUMN, defaultOrderByColumn);
- String isAsc = ServletUtils.getParameter(IS_ASC, defaultIsAsc);
- if (pageNum <= 0) {
- pageNum = DEFAULT_PAGE_NUM;
- }
- Page<T> page = new Page<>(pageNum, pageSize);
- OrderItem orderItem = buildOrderItem(orderByColumn, isAsc);
- if (ObjectUtil.isNotNull(orderItem)) {
- page.addOrder(orderItem);
- }
- return page;
- }
-
- private static OrderItem buildOrderItem(String orderByColumn, String isAsc) {
- // 鍏煎鍓嶇鎺掑簭绫诲瀷
- if ("ascending".equals(isAsc)) {
- isAsc = "asc";
- } else if ("descending".equals(isAsc)) {
- isAsc = "desc";
- }
- if (StringUtils.isNotBlank(orderByColumn)) {
- String orderBy = SqlUtil.escapeOrderBySql(orderByColumn);
- orderBy = StringUtils.toUnderScoreCase(orderBy);
- if ("asc".equals(isAsc)) {
- return OrderItem.asc(orderBy);
- } else if ("desc".equals(isAsc)) {
- return OrderItem.desc(orderBy);
- }
- }
- return null;
- }
-
- /**
- * 鏋勫缓 MP 鏅�氬垎椤靛璞�
- *
- * @param <T> domain 瀹炰綋
- * @return 鍒嗛〉瀵硅薄
- * @deprecated 3.6.0 鍒犻櫎 璇蜂娇鐢� {@link PageQuery#build()}
- * 鐢变簬浣跨敤 Servlet 鑾峰彇鍙兘浠� param 鑾峰彇 鐏垫椿鎬ч檷浣� 鏁呭皢浼犲弬鎿嶄綔浜ょ粰鐢ㄦ埛
- */
- @Deprecated
- public static <T, K> TableDataInfo<K> buildDataInfo(PagePlus<T, K> page) {
- TableDataInfo<K> rspData = new TableDataInfo<>();
- rspData.setCode(HttpStatus.HTTP_OK);
- rspData.setMsg("鏌ヨ鎴愬姛");
- rspData.setRows(page.getRecordsVo());
- rspData.setTotal(page.getTotal());
- return rspData;
- }
-
- /**
- * @deprecated 3.6.0 鍒犻櫎 璇蜂娇鐢� {@link TableDataInfo#build(IPage)}
- */
- @Deprecated
- public static <T> TableDataInfo<T> buildDataInfo(Page<T> page) {
- TableDataInfo<T> rspData = new TableDataInfo<>();
- rspData.setCode(HttpStatus.HTTP_OK);
- rspData.setMsg("鏌ヨ鎴愬姛");
- rspData.setRows(page.getRecords());
- rspData.setTotal(page.getTotal());
- return rspData;
- }
-
- /**
- * @deprecated 3.6.0 鍒犻櫎 璇蜂娇鐢� {@link TableDataInfo#build(List)}
- */
- @Deprecated
- public static <T> TableDataInfo<T> buildDataInfo(List<T> list) {
- TableDataInfo<T> rspData = new TableDataInfo<>();
- rspData.setCode(HttpStatus.HTTP_OK);
- rspData.setMsg("鏌ヨ鎴愬姛");
- rspData.setRows(list);
- rspData.setTotal(list.size());
- return rspData;
- }
-
- /**
- * @deprecated 3.6.0 鍒犻櫎 璇蜂娇鐢� {@link TableDataInfo#build()}
- */
- @Deprecated
- public static <T> TableDataInfo<T> buildDataInfo() {
- TableDataInfo<T> rspData = new TableDataInfo<>();
- rspData.setCode(HttpStatus.HTTP_OK);
- rspData.setMsg("鏌ヨ鎴愬姛");
- return rspData;
- }
-
-}
--
Gitblit v1.9.3