mirror of
				https://github.com/dromara/RuoYi-Vue-Plus.git
				synced 2025-11-04 16:23:42 +08:00 
			
		
		
		
	update [重磅更新] 重构分页 简化使用
This commit is contained in:
		@@ -1,5 +1,10 @@
 | 
			
		||||
package com.ruoyi.common.core.domain;
 | 
			
		||||
 | 
			
		||||
import cn.hutool.core.util.ObjectUtil;
 | 
			
		||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
 | 
			
		||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 | 
			
		||||
import com.ruoyi.common.utils.StringUtils;
 | 
			
		||||
import com.ruoyi.common.utils.sql.SqlUtil;
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import lombok.experimental.Accessors;
 | 
			
		||||
@@ -42,4 +47,47 @@ public class PageQuery implements Serializable {
 | 
			
		||||
    @ApiModelProperty(value = "排序的方向", example = "asc,desc")
 | 
			
		||||
    private String isAsc;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 当前记录起始索引 默认值
 | 
			
		||||
     */
 | 
			
		||||
    public static final int DEFAULT_PAGE_NUM = 1;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 每页显示记录数 默认值 默认查全部
 | 
			
		||||
     */
 | 
			
		||||
    public static final int DEFAULT_PAGE_SIZE = Integer.MAX_VALUE;
 | 
			
		||||
 | 
			
		||||
    public <T> Page<T> build() {
 | 
			
		||||
        Integer pageNum = ObjectUtil.defaultIfNull(getPageNum(), DEFAULT_PAGE_NUM);
 | 
			
		||||
        Integer pageSize = ObjectUtil.defaultIfNull(getPageSize(), DEFAULT_PAGE_SIZE);
 | 
			
		||||
        if (pageNum <= 0) {
 | 
			
		||||
            pageNum = DEFAULT_PAGE_NUM;
 | 
			
		||||
        }
 | 
			
		||||
        Page<T> page = new Page<>(pageNum, pageSize);
 | 
			
		||||
        OrderItem orderItem = buildOrderItem();
 | 
			
		||||
        if (ObjectUtil.isNotNull(orderItem)) {
 | 
			
		||||
            page.addOrder(orderItem);
 | 
			
		||||
        }
 | 
			
		||||
        return page;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private OrderItem buildOrderItem() {
 | 
			
		||||
        // 兼容前端排序类型
 | 
			
		||||
        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;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -77,11 +77,11 @@ public interface BaseMapperPlus<T> extends BaseMapper<T> {
 | 
			
		||||
    /**
 | 
			
		||||
     * 分页查询VO
 | 
			
		||||
     */
 | 
			
		||||
    default <V> IPage<V> selectVoPage(IPage<T> page, Wrapper<T> wrapper, Class<V> voClass) {
 | 
			
		||||
    default <V, P extends IPage<V>> P selectVoPage(IPage<T> page, Wrapper<T> wrapper, Class<V> voClass) {
 | 
			
		||||
        IPage<T> pageData = this.selectPage(page, wrapper);
 | 
			
		||||
        IPage<V> voPage = new Page<>(pageData.getCurrent(), pageData.getSize(), pageData.getTotal());
 | 
			
		||||
        voPage.setRecords(BeanCopyUtils.copyList(pageData.getRecords(), voClass));
 | 
			
		||||
        return voPage;
 | 
			
		||||
        return (P) voPage;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -202,8 +202,10 @@ public class ServicePlusImpl<M extends BaseMapperPlus<T>, T, V> extends ServiceI
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 翻页查询
 | 
			
		||||
     * @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);
 | 
			
		||||
@@ -217,7 +219,7 @@ public class ServicePlusImpl<M extends BaseMapperPlus<T>, T, V> extends ServiceI
 | 
			
		||||
     * @param page         翻页对象
 | 
			
		||||
     * @param queryWrapper 实体对象封装操作类
 | 
			
		||||
     */
 | 
			
		||||
    public IPage<V> pageVo(IPage<T> page, Wrapper<T> queryWrapper) {
 | 
			
		||||
    public <P extends IPage<V>> P pageVo(IPage<T> page, Wrapper<T> queryWrapper) {
 | 
			
		||||
        return getBaseMapper().selectVoPage(page, queryWrapper, voClass);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -16,9 +16,11 @@ import java.util.List;
 | 
			
		||||
 * @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> {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,7 @@
 | 
			
		||||
package com.ruoyi.common.core.page;
 | 
			
		||||
 | 
			
		||||
import cn.hutool.http.HttpStatus;
 | 
			
		||||
import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
			
		||||
import io.swagger.annotations.ApiModel;
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
@@ -57,4 +59,29 @@ public class TableDataInfo<T> implements Serializable {
 | 
			
		||||
		this.total = total;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    public static <T> TableDataInfo<T> build(IPage<T> page) {
 | 
			
		||||
        TableDataInfo<T> rspData = new TableDataInfo<>();
 | 
			
		||||
        rspData.setCode(HttpStatus.HTTP_OK);
 | 
			
		||||
        rspData.setMsg("查询成功");
 | 
			
		||||
        rspData.setRows(page.getRecords());
 | 
			
		||||
        rspData.setTotal(page.getTotal());
 | 
			
		||||
        return rspData;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static <T> TableDataInfo<T> build(List<T> list) {
 | 
			
		||||
        TableDataInfo<T> rspData = new TableDataInfo<>();
 | 
			
		||||
        rspData.setCode(HttpStatus.HTTP_OK);
 | 
			
		||||
        rspData.setMsg("查询成功");
 | 
			
		||||
        rspData.setRows(list);
 | 
			
		||||
        rspData.setTotal(list.size());
 | 
			
		||||
        return rspData;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static <T> TableDataInfo<T> build() {
 | 
			
		||||
        TableDataInfo<T> rspData = new TableDataInfo<>();
 | 
			
		||||
        rspData.setCode(HttpStatus.HTTP_OK);
 | 
			
		||||
        rspData.setMsg("查询成功");
 | 
			
		||||
        return rspData;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,7 @@ 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;
 | 
			
		||||
@@ -17,7 +18,9 @@ import java.util.List;
 | 
			
		||||
 * 分页工具
 | 
			
		||||
 *
 | 
			
		||||
 * @author Lion Li
 | 
			
		||||
 * @deprecated 3.6.0 删除 请使用 {@link PageQuery} 与 {@link TableDataInfo}
 | 
			
		||||
 */
 | 
			
		||||
@Deprecated
 | 
			
		||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
 | 
			
		||||
public class PageUtils {
 | 
			
		||||
 | 
			
		||||
@@ -48,11 +51,13 @@ public class PageUtils {
 | 
			
		||||
    /**
 | 
			
		||||
     * 当前记录起始索引 默认值
 | 
			
		||||
     */
 | 
			
		||||
    @Deprecated
 | 
			
		||||
    public static final int DEFAULT_PAGE_NUM = 1;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 每页显示记录数 默认值 默认查全部
 | 
			
		||||
     */
 | 
			
		||||
    @Deprecated
 | 
			
		||||
    public static final int DEFAULT_PAGE_SIZE = Integer.MAX_VALUE;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -61,7 +66,7 @@ public class PageUtils {
 | 
			
		||||
     * @param <T> domain 实体
 | 
			
		||||
     * @param <K> vo 实体
 | 
			
		||||
     * @return 分页对象
 | 
			
		||||
     * @deprecated 3.6.0 删除 请使用 {@link PageUtils#buildPagePlus(PageQuery)}
 | 
			
		||||
     * @deprecated 3.6.0 删除 请使用 {@link PageQuery#build()}
 | 
			
		||||
     * 由于使用 Servlet 获取只能从 param 获取 灵活性降低 故将传参操作交给用户
 | 
			
		||||
     */
 | 
			
		||||
    @Deprecated
 | 
			
		||||
@@ -81,22 +86,6 @@ public class PageUtils {
 | 
			
		||||
        return page;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static <T, K> PagePlus<T, K> buildPagePlus(PageQuery pageQuery) {
 | 
			
		||||
        Integer pageNum = ObjectUtil.defaultIfNull(pageQuery.getPageNum(), DEFAULT_PAGE_NUM);
 | 
			
		||||
        Integer pageSize = ObjectUtil.defaultIfNull(pageQuery.getPageSize(), DEFAULT_PAGE_SIZE);
 | 
			
		||||
        String orderByColumn = pageQuery.getOrderByColumn();
 | 
			
		||||
        String isAsc = pageQuery.getIsAsc();
 | 
			
		||||
        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);
 | 
			
		||||
@@ -107,7 +96,7 @@ public class PageUtils {
 | 
			
		||||
     *
 | 
			
		||||
     * @param <T> domain 实体
 | 
			
		||||
     * @return 分页对象
 | 
			
		||||
     * @deprecated 3.6.0 删除 请使用 {@link PageUtils#buildPage(PageQuery)}
 | 
			
		||||
     * @deprecated 3.6.0 删除 请使用 {@link PageQuery#build()}
 | 
			
		||||
     * 由于使用 Servlet 获取只能从 param 获取 灵活性降低 故将传参操作交给用户
 | 
			
		||||
     */
 | 
			
		||||
    @Deprecated
 | 
			
		||||
@@ -127,23 +116,6 @@ public class PageUtils {
 | 
			
		||||
        return page;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static <T> Page<T> buildPage(PageQuery pageQuery) {
 | 
			
		||||
        Integer pageNum = ObjectUtil.defaultIfNull(pageQuery.getPageNum(), DEFAULT_PAGE_NUM);
 | 
			
		||||
        Integer pageSize = ObjectUtil.defaultIfNull(pageQuery.getPageSize(), DEFAULT_PAGE_SIZE);
 | 
			
		||||
        String orderByColumn = pageQuery.getOrderByColumn();
 | 
			
		||||
        String isAsc = pageQuery.getIsAsc();
 | 
			
		||||
        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)) {
 | 
			
		||||
@@ -163,6 +135,15 @@ public class PageUtils {
 | 
			
		||||
        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);
 | 
			
		||||
@@ -172,6 +153,10 @@ public class PageUtils {
 | 
			
		||||
        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);
 | 
			
		||||
@@ -181,6 +166,10 @@ public class PageUtils {
 | 
			
		||||
        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);
 | 
			
		||||
@@ -190,6 +179,10 @@ public class PageUtils {
 | 
			
		||||
        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);
 | 
			
		||||
 
 | 
			
		||||
@@ -6,9 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 | 
			
		||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 | 
			
		||||
import com.ruoyi.common.core.domain.PageQuery;
 | 
			
		||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
 | 
			
		||||
import com.ruoyi.common.core.page.PagePlus;
 | 
			
		||||
import com.ruoyi.common.core.page.TableDataInfo;
 | 
			
		||||
import com.ruoyi.common.utils.PageUtils;
 | 
			
		||||
import com.ruoyi.common.utils.StringUtils;
 | 
			
		||||
import com.ruoyi.demo.domain.TestDemo;
 | 
			
		||||
import com.ruoyi.demo.domain.bo.TestDemoBo;
 | 
			
		||||
@@ -38,8 +36,8 @@ public class TestDemoServiceImpl extends ServicePlusImpl<TestDemoMapper, TestDem
 | 
			
		||||
	@Override
 | 
			
		||||
	public TableDataInfo<TestDemoVo> queryPageList(TestDemoBo bo, PageQuery pageQuery) {
 | 
			
		||||
        LambdaQueryWrapper<TestDemo> lqw = buildQueryWrapper(bo);
 | 
			
		||||
        PagePlus<TestDemo, TestDemoVo> result = pageVo(PageUtils.buildPagePlus(pageQuery), lqw);
 | 
			
		||||
		return PageUtils.buildDataInfo(result);
 | 
			
		||||
        Page<TestDemoVo> result = pageVo(pageQuery.build(), lqw);
 | 
			
		||||
		return TableDataInfo.build(result);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
@@ -48,8 +46,8 @@ public class TestDemoServiceImpl extends ServicePlusImpl<TestDemoMapper, TestDem
 | 
			
		||||
	@Override
 | 
			
		||||
	public TableDataInfo<TestDemoVo> customPageList(TestDemoBo bo, PageQuery pageQuery) {
 | 
			
		||||
        LambdaQueryWrapper<TestDemo> lqw = buildQueryWrapper(bo);
 | 
			
		||||
		Page<TestDemoVo> result = baseMapper.customPageList(PageUtils.buildPage(pageQuery), lqw);
 | 
			
		||||
		return PageUtils.buildDataInfo(result);
 | 
			
		||||
		Page<TestDemoVo> result = baseMapper.customPageList(pageQuery.build(), lqw);
 | 
			
		||||
		return TableDataInfo.build(result);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,6 @@ import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
 | 
			
		||||
import com.ruoyi.common.core.page.TableDataInfo;
 | 
			
		||||
import com.ruoyi.common.exception.ServiceException;
 | 
			
		||||
import com.ruoyi.common.utils.JsonUtils;
 | 
			
		||||
import com.ruoyi.common.utils.PageUtils;
 | 
			
		||||
import com.ruoyi.common.utils.SecurityUtils;
 | 
			
		||||
import com.ruoyi.common.utils.StringUtils;
 | 
			
		||||
import com.ruoyi.common.utils.file.FileUtils;
 | 
			
		||||
@@ -69,14 +68,14 @@ public class GenTableServiceImpl extends ServicePlusImpl<GenTableMapper, GenTabl
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public TableDataInfo<GenTable> selectPageGenTableList(GenTable genTable, PageQuery pageQuery) {
 | 
			
		||||
        Page<GenTable> page = baseMapper.selectPageGenTableList(PageUtils.buildPage(pageQuery), genTable);
 | 
			
		||||
        return PageUtils.buildDataInfo(page);
 | 
			
		||||
        Page<GenTable> page = baseMapper.selectPageGenTableList(pageQuery.build(), genTable);
 | 
			
		||||
        return TableDataInfo.build(page);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public TableDataInfo<GenTable> selectPageDbTableList(GenTable genTable, PageQuery pageQuery) {
 | 
			
		||||
        Page<GenTable> page = baseMapper.selectPageDbTableList(PageUtils.buildPage(pageQuery), genTable);
 | 
			
		||||
        return PageUtils.buildDataInfo(page);
 | 
			
		||||
        Page<GenTable> page = baseMapper.selectPageDbTableList(pageQuery.build(), genTable);
 | 
			
		||||
        return TableDataInfo.build(page);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -3,8 +3,6 @@ package ${packageName}.service.impl;
 | 
			
		||||
import cn.hutool.core.bean.BeanUtil;
 | 
			
		||||
import com.ruoyi.common.utils.StringUtils;
 | 
			
		||||
#if($table.crud || $table.sub)
 | 
			
		||||
import com.ruoyi.common.utils.PageUtils;
 | 
			
		||||
import com.ruoyi.common.core.page.PagePlus;
 | 
			
		||||
import com.ruoyi.common.core.page.TableDataInfo;
 | 
			
		||||
import com.ruoyi.common.core.domain.PageQuery;
 | 
			
		||||
#end
 | 
			
		||||
@@ -40,8 +38,8 @@ public class ${ClassName}ServiceImpl extends ServicePlusImpl<${ClassName}Mapper,
 | 
			
		||||
    @Override
 | 
			
		||||
    public TableDataInfo<${ClassName}Vo> queryPageList(${ClassName}Bo bo, PageQuery pageQuery) {
 | 
			
		||||
        LambdaQueryWrapper<${ClassName}> lqw = buildQueryWrapper(bo);
 | 
			
		||||
        PagePlus<${ClassName}, ${ClassName}Vo> result = pageVo(PageUtils.buildPagePlus(pageQuery), lqw);
 | 
			
		||||
        return PageUtils.buildDataInfo(result);
 | 
			
		||||
        Page<${ClassName}Vo> result = pageVo(pageQuery.build(), lqw);
 | 
			
		||||
        return TableDataInfo.build(result);
 | 
			
		||||
    }
 | 
			
		||||
#end
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -11,7 +11,6 @@ import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
 | 
			
		||||
import com.ruoyi.common.core.page.TableDataInfo;
 | 
			
		||||
import com.ruoyi.common.core.service.ConfigService;
 | 
			
		||||
import com.ruoyi.common.exception.ServiceException;
 | 
			
		||||
import com.ruoyi.common.utils.PageUtils;
 | 
			
		||||
import com.ruoyi.common.utils.RedisUtils;
 | 
			
		||||
import com.ruoyi.common.utils.StringUtils;
 | 
			
		||||
import com.ruoyi.system.domain.SysConfig;
 | 
			
		||||
@@ -41,8 +40,8 @@ public class SysConfigServiceImpl extends ServicePlusImpl<SysConfigMapper, SysCo
 | 
			
		||||
            .like(StringUtils.isNotBlank(config.getConfigKey()), SysConfig::getConfigKey, config.getConfigKey())
 | 
			
		||||
            .between(params.get("beginTime") != null && params.get("endTime") != null,
 | 
			
		||||
                SysConfig::getCreateTime, params.get("beginTime"), params.get("endTime"));
 | 
			
		||||
        Page<SysConfig> page = page(PageUtils.buildPage(pageQuery), lqw);
 | 
			
		||||
        return PageUtils.buildDataInfo(page);
 | 
			
		||||
        Page<SysConfig> page = page(pageQuery.build(), lqw);
 | 
			
		||||
        return TableDataInfo.build(page);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,6 @@ import com.ruoyi.common.core.domain.PageQuery;
 | 
			
		||||
import com.ruoyi.common.core.domain.entity.SysDictData;
 | 
			
		||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
 | 
			
		||||
import com.ruoyi.common.core.page.TableDataInfo;
 | 
			
		||||
import com.ruoyi.common.utils.PageUtils;
 | 
			
		||||
import com.ruoyi.common.utils.RedisUtils;
 | 
			
		||||
import com.ruoyi.common.utils.StringUtils;
 | 
			
		||||
import com.ruoyi.system.mapper.SysDictDataMapper;
 | 
			
		||||
@@ -31,8 +30,8 @@ public class SysDictDataServiceImpl extends ServicePlusImpl<SysDictDataMapper, S
 | 
			
		||||
                .like(StringUtils.isNotBlank(dictData.getDictLabel()), SysDictData::getDictLabel, dictData.getDictLabel())
 | 
			
		||||
                .eq(StringUtils.isNotBlank(dictData.getStatus()), SysDictData::getStatus, dictData.getStatus())
 | 
			
		||||
                .orderByAsc(SysDictData::getDictSort);
 | 
			
		||||
        Page<SysDictData> page = page(PageUtils.buildPage(pageQuery), lqw);
 | 
			
		||||
        return PageUtils.buildDataInfo(page);
 | 
			
		||||
        Page<SysDictData> page = page(pageQuery.build(), lqw);
 | 
			
		||||
        return TableDataInfo.build(page);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -13,7 +13,6 @@ import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
 | 
			
		||||
import com.ruoyi.common.core.page.TableDataInfo;
 | 
			
		||||
import com.ruoyi.common.core.service.DictService;
 | 
			
		||||
import com.ruoyi.common.exception.ServiceException;
 | 
			
		||||
import com.ruoyi.common.utils.PageUtils;
 | 
			
		||||
import com.ruoyi.common.utils.RedisUtils;
 | 
			
		||||
import com.ruoyi.common.utils.StringUtils;
 | 
			
		||||
import com.ruoyi.system.mapper.SysDictDataMapper;
 | 
			
		||||
@@ -48,8 +47,8 @@ public class SysDictTypeServiceImpl extends ServicePlusImpl<SysDictTypeMapper, S
 | 
			
		||||
            .like(StringUtils.isNotBlank(dictType.getDictType()), SysDictType::getDictType, dictType.getDictType())
 | 
			
		||||
            .between(params.get("beginTime") != null && params.get("endTime") != null,
 | 
			
		||||
                SysDictType::getCreateTime, params.get("beginTime"), params.get("endTime"));
 | 
			
		||||
        Page<SysDictType> page = page(PageUtils.buildPage(pageQuery), lqw);
 | 
			
		||||
        return PageUtils.buildDataInfo(page);
 | 
			
		||||
        Page<SysDictType> page = page(pageQuery.build(), lqw);
 | 
			
		||||
        return TableDataInfo.build(page);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,6 @@ import com.ruoyi.common.core.domain.PageQuery;
 | 
			
		||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
 | 
			
		||||
import com.ruoyi.common.core.page.TableDataInfo;
 | 
			
		||||
import com.ruoyi.common.core.service.LogininforService;
 | 
			
		||||
import com.ruoyi.common.utils.PageUtils;
 | 
			
		||||
import com.ruoyi.common.utils.ServletUtils;
 | 
			
		||||
import com.ruoyi.common.utils.StringUtils;
 | 
			
		||||
import com.ruoyi.common.utils.ip.AddressUtils;
 | 
			
		||||
@@ -100,8 +99,8 @@ public class SysLogininforServiceImpl extends ServicePlusImpl<SysLogininforMappe
 | 
			
		||||
        if(StringUtils.isBlank(pageQuery.getOrderByColumn())) {
 | 
			
		||||
            pageQuery.setOrderByColumn("info_id").setIsAsc("desc");
 | 
			
		||||
        }
 | 
			
		||||
        Page<SysLogininfor> page = page(PageUtils.buildPage(pageQuery), lqw);
 | 
			
		||||
        return PageUtils.buildDataInfo(page);
 | 
			
		||||
        Page<SysLogininfor> page = page(pageQuery.build(), lqw);
 | 
			
		||||
        return TableDataInfo.build(page);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 | 
			
		||||
import com.ruoyi.common.core.domain.PageQuery;
 | 
			
		||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
 | 
			
		||||
import com.ruoyi.common.core.page.TableDataInfo;
 | 
			
		||||
import com.ruoyi.common.utils.PageUtils;
 | 
			
		||||
import com.ruoyi.common.utils.StringUtils;
 | 
			
		||||
import com.ruoyi.system.domain.SysNotice;
 | 
			
		||||
import com.ruoyi.system.mapper.SysNoticeMapper;
 | 
			
		||||
@@ -29,8 +28,8 @@ public class SysNoticeServiceImpl extends ServicePlusImpl<SysNoticeMapper, SysNo
 | 
			
		||||
                .like(StringUtils.isNotBlank(notice.getNoticeTitle()), SysNotice::getNoticeTitle, notice.getNoticeTitle())
 | 
			
		||||
                .eq(StringUtils.isNotBlank(notice.getNoticeType()), SysNotice::getNoticeType, notice.getNoticeType())
 | 
			
		||||
                .like(StringUtils.isNotBlank(notice.getCreateBy()), SysNotice::getCreateBy, notice.getCreateBy());
 | 
			
		||||
        Page<SysNotice> page = page(PageUtils.buildPage(pageQuery), lqw);
 | 
			
		||||
        return PageUtils.buildDataInfo(page);
 | 
			
		||||
        Page<SysNotice> page = page(pageQuery.build(), lqw);
 | 
			
		||||
        return TableDataInfo.build(page);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,6 @@ import com.ruoyi.common.core.domain.dto.OperLogDTO;
 | 
			
		||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
 | 
			
		||||
import com.ruoyi.common.core.page.TableDataInfo;
 | 
			
		||||
import com.ruoyi.common.core.service.OperLogService;
 | 
			
		||||
import com.ruoyi.common.utils.PageUtils;
 | 
			
		||||
import com.ruoyi.common.utils.StringUtils;
 | 
			
		||||
import com.ruoyi.common.utils.ip.AddressUtils;
 | 
			
		||||
import com.ruoyi.system.domain.SysOperLog;
 | 
			
		||||
@@ -65,8 +64,8 @@ public class SysOperLogServiceImpl extends ServicePlusImpl<SysOperLogMapper, Sys
 | 
			
		||||
        if(StringUtils.isBlank(pageQuery.getOrderByColumn())) {
 | 
			
		||||
            pageQuery.setOrderByColumn("oper_id").setIsAsc("desc");
 | 
			
		||||
        }
 | 
			
		||||
        Page<SysOperLog> page = page(PageUtils.buildPage(pageQuery), lqw);
 | 
			
		||||
        return PageUtils.buildDataInfo(page);
 | 
			
		||||
        Page<SysOperLog> page = page(pageQuery.build(), lqw);
 | 
			
		||||
        return TableDataInfo.build(page);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -5,15 +5,14 @@ import cn.hutool.core.collection.CollUtil;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 | 
			
		||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 | 
			
		||||
import com.google.common.collect.Lists;
 | 
			
		||||
import com.ruoyi.common.constant.UserConstants;
 | 
			
		||||
import com.ruoyi.common.core.domain.PageQuery;
 | 
			
		||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
 | 
			
		||||
import com.ruoyi.common.core.page.PagePlus;
 | 
			
		||||
import com.ruoyi.common.core.page.TableDataInfo;
 | 
			
		||||
import com.ruoyi.common.exception.ServiceException;
 | 
			
		||||
import com.ruoyi.common.utils.JsonUtils;
 | 
			
		||||
import com.ruoyi.common.utils.PageUtils;
 | 
			
		||||
import com.ruoyi.common.utils.RedisUtils;
 | 
			
		||||
import com.ruoyi.common.utils.StringUtils;
 | 
			
		||||
import com.ruoyi.oss.constant.OssConstant;
 | 
			
		||||
@@ -70,8 +69,8 @@ public class SysOssConfigServiceImpl extends ServicePlusImpl<SysOssConfigMapper,
 | 
			
		||||
    @Override
 | 
			
		||||
    public TableDataInfo<SysOssConfigVo> queryPageList(SysOssConfigBo bo, PageQuery pageQuery) {
 | 
			
		||||
        LambdaQueryWrapper<SysOssConfig> lqw = buildQueryWrapper(bo);
 | 
			
		||||
        PagePlus<SysOssConfig, SysOssConfigVo> result = pageVo(PageUtils.buildPagePlus(pageQuery), lqw);
 | 
			
		||||
        return PageUtils.buildDataInfo(result);
 | 
			
		||||
        Page<SysOssConfigVo> result = pageVo(pageQuery.build(), lqw);
 | 
			
		||||
        return TableDataInfo.build(result);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,12 +2,11 @@ package com.ruoyi.system.service.impl;
 | 
			
		||||
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 | 
			
		||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 | 
			
		||||
import com.ruoyi.common.core.domain.PageQuery;
 | 
			
		||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
 | 
			
		||||
import com.ruoyi.common.core.page.PagePlus;
 | 
			
		||||
import com.ruoyi.common.core.page.TableDataInfo;
 | 
			
		||||
import com.ruoyi.common.exception.ServiceException;
 | 
			
		||||
import com.ruoyi.common.utils.PageUtils;
 | 
			
		||||
import com.ruoyi.common.utils.StringUtils;
 | 
			
		||||
import com.ruoyi.oss.entity.UploadResult;
 | 
			
		||||
import com.ruoyi.oss.factory.OssFactory;
 | 
			
		||||
@@ -36,8 +35,8 @@ public class SysOssServiceImpl extends ServicePlusImpl<SysOssMapper, SysOss, Sys
 | 
			
		||||
    @Override
 | 
			
		||||
    public TableDataInfo<SysOssVo> queryPageList(SysOssBo bo, PageQuery pageQuery) {
 | 
			
		||||
        LambdaQueryWrapper<SysOss> lqw = buildQueryWrapper(bo);
 | 
			
		||||
        PagePlus<SysOss, SysOssVo> result = pageVo(PageUtils.buildPagePlus(pageQuery), lqw);
 | 
			
		||||
        return PageUtils.buildDataInfo(result);
 | 
			
		||||
        Page<SysOssVo> result = pageVo(pageQuery.build(), lqw);
 | 
			
		||||
        return TableDataInfo.build(result);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private LambdaQueryWrapper<SysOss> buildQueryWrapper(SysOssBo bo) {
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,6 @@ import com.ruoyi.common.core.domain.PageQuery;
 | 
			
		||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
 | 
			
		||||
import com.ruoyi.common.core.page.TableDataInfo;
 | 
			
		||||
import com.ruoyi.common.exception.ServiceException;
 | 
			
		||||
import com.ruoyi.common.utils.PageUtils;
 | 
			
		||||
import com.ruoyi.common.utils.StringUtils;
 | 
			
		||||
import com.ruoyi.system.domain.SysPost;
 | 
			
		||||
import com.ruoyi.system.domain.SysUserPost;
 | 
			
		||||
@@ -37,8 +36,8 @@ public class SysPostServiceImpl extends ServicePlusImpl<SysPostMapper, SysPost,
 | 
			
		||||
                .like(StringUtils.isNotBlank(post.getPostCode()), SysPost::getPostCode, post.getPostCode())
 | 
			
		||||
                .eq(StringUtils.isNotBlank(post.getStatus()), SysPost::getStatus, post.getStatus())
 | 
			
		||||
                .like(StringUtils.isNotBlank(post.getPostName()), SysPost::getPostName, post.getPostName());
 | 
			
		||||
        Page<SysPost> page = page(PageUtils.buildPage(pageQuery), lqw);
 | 
			
		||||
        return PageUtils.buildDataInfo(page);
 | 
			
		||||
        Page<SysPost> page = page(pageQuery.build(), lqw);
 | 
			
		||||
        return TableDataInfo.build(page);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,6 @@ import com.ruoyi.common.core.domain.entity.SysUser;
 | 
			
		||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
 | 
			
		||||
import com.ruoyi.common.core.page.TableDataInfo;
 | 
			
		||||
import com.ruoyi.common.exception.ServiceException;
 | 
			
		||||
import com.ruoyi.common.utils.PageUtils;
 | 
			
		||||
import com.ruoyi.common.utils.SecurityUtils;
 | 
			
		||||
import com.ruoyi.common.utils.StringUtils;
 | 
			
		||||
import com.ruoyi.common.utils.spring.SpringUtils;
 | 
			
		||||
@@ -46,8 +45,8 @@ public class SysRoleServiceImpl extends ServicePlusImpl<SysRoleMapper, SysRole,
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public TableDataInfo<SysRole> selectPageRoleList(SysRole role, PageQuery pageQuery) {
 | 
			
		||||
        Page<SysRole> page = baseMapper.selectPageRoleList(PageUtils.buildPage(pageQuery), role);
 | 
			
		||||
        return PageUtils.buildDataInfo(page);
 | 
			
		||||
        Page<SysRole> page = baseMapper.selectPageRoleList(pageQuery.build(), role);
 | 
			
		||||
        return TableDataInfo.build(page);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,6 @@ import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
 | 
			
		||||
import com.ruoyi.common.core.page.TableDataInfo;
 | 
			
		||||
import com.ruoyi.common.core.service.UserService;
 | 
			
		||||
import com.ruoyi.common.exception.ServiceException;
 | 
			
		||||
import com.ruoyi.common.utils.PageUtils;
 | 
			
		||||
import com.ruoyi.common.utils.SecurityUtils;
 | 
			
		||||
import com.ruoyi.common.utils.StringUtils;
 | 
			
		||||
import com.ruoyi.common.utils.spring.SpringUtils;
 | 
			
		||||
@@ -54,8 +53,8 @@ public class SysUserServiceImpl extends ServicePlusImpl<SysUserMapper, SysUser,
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public TableDataInfo<SysUser> selectPageUserList(SysUser user, PageQuery pageQuery) {
 | 
			
		||||
        Page<SysUser> page = baseMapper.selectPageUserList(PageUtils.buildPage(pageQuery), user);
 | 
			
		||||
        return PageUtils.buildDataInfo(page);
 | 
			
		||||
        Page<SysUser> page = baseMapper.selectPageUserList(pageQuery.build(), user);
 | 
			
		||||
        return TableDataInfo.build(page);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -77,8 +76,8 @@ public class SysUserServiceImpl extends ServicePlusImpl<SysUserMapper, SysUser,
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public TableDataInfo<SysUser> selectAllocatedList(SysUser user, PageQuery pageQuery) {
 | 
			
		||||
        Page<SysUser> page = baseMapper.selectAllocatedList(PageUtils.buildPage(pageQuery), user);
 | 
			
		||||
        return PageUtils.buildDataInfo(page);
 | 
			
		||||
        Page<SysUser> page = baseMapper.selectAllocatedList(pageQuery.build(), user);
 | 
			
		||||
        return TableDataInfo.build(page);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -89,8 +88,8 @@ public class SysUserServiceImpl extends ServicePlusImpl<SysUserMapper, SysUser,
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public TableDataInfo<SysUser> selectUnallocatedList(SysUser user, PageQuery pageQuery) {
 | 
			
		||||
        Page<SysUser> page = baseMapper.selectUnallocatedList(PageUtils.buildPage(pageQuery), user);
 | 
			
		||||
        return PageUtils.buildDataInfo(page);
 | 
			
		||||
        Page<SysUser> page = baseMapper.selectUnallocatedList(pageQuery.build(), user);
 | 
			
		||||
        return TableDataInfo.build(page);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user