LiiuZeYu_branch
lzy 9 months ago
parent 590a8ff6b2
commit 143989191c

@ -0,0 +1,213 @@
/*
* Copyright (c) 2018-2999 广 All rights reserved.
*
* https://www.mall4j.com/
*
*
*
*
*/
package com.yami.shop.common.util;
// 导入MyBatis Plus框架中用于表示分页信息的核心类包含了分页相关的属性如当前页、每页大小等以及操作方法如获取记录列表、设置总数等
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
// 导入Jackson相关的注解用于在JSON序列化和反序列化过程中忽略指定的属性这里用于标记某些属性在转换为JSON时不进行处理
import com.fasterxml.jackson.annotation.JsonIgnore;
// 导入Swagger相关的注解用于在生成API文档时隐藏某些属性使得这些属性不在文档中展示出来一般用于内部使用或不需要对外暴露的属性
import io.swagger.v3.oas.annotations.Hidden;
// 导入Swagger相关的注解用于在生成API文档时为类、属性等添加描述信息方便前端开发人员等查看其含义和作用
import io.swagger.v3.oas.annotations.media.Schema;
// 导入SpringDoc相关的注解用于标记该类作为参数对象在生成API文档以及进行参数校验等场景下可以被识别和处理
import org.springdoc.core.annotations.ParameterObject;
import java.util.List;
/**
* PageParamMyBatis PlusPage
* PageJSON
* Page
* count
*
* @author lanhai
*/
@Schema
@ParameterObject
public class PageParam<T> extends Page<T> {
/**
* 10
* @SchemaAPI便使
*/
@Schema(description = "每页大小默认10")
private long size = 10;
/**
* 1@Schema便API
*/
@Schema(description = "当前页默认1")
private long current = 1;
/**
* @HiddenAPI使
*/
@Hidden
private List<T> records;
/**
* @HiddenAPI
*/
@Hidden
private long total = 0;
/**
* counttruecount
* @JsonIgnoreJSON
*/
@JsonIgnore
private boolean isSearchCount = true;
/**
* @JsonIgnoreJSON使
*/
@JsonIgnore
private String countId;
/**
* 100@JsonIgnoreJSON
*/
@JsonIgnore
private Long maxLimit;
/**
* countSQL@JsonIgnoreJSON使
*/
@JsonIgnore
private boolean optimizeCountSql;
/**
* Pagerecords
*
* @return List<T> T
*/
@Override
public List<T> getRecords() {
return this.records;
}
/**
* Pagerecordsthis便
* 便
*
* @param records T
* @return Page<T>
*/
@Override
public Page<T> setRecords(List<T> records) {
this.records = records;
return this;
}
/**
* Pagetotal使
*
* @return long
*/
@Override
public long getTotal() {
return this.total;
}
/**
* Pagetotalthis便
* count
*
* @param total
* @return Page<T>
*/
@Override
public Page<T> setTotal(long total) {
this.total = total;
return this;
}
/**
* countisSearchCount
* total0falsecount
* isSearchCountcount
*
* @return boolean counttruecountfalse
*/
@JsonIgnore
public boolean getSearchCount() {
if (total < 0) {
return false;
}
return isSearchCount;
}
/**
* PagecountisSearchCountthis便
* count
*
* @param isSearchCount counttruefalse
* @return Page<T>
*/
@Override
public Page<T> setSearchCount(boolean isSearchCount) {
this.isSearchCount = isSearchCount;
return this;
}
/**
* Pagesize使
*
* @return long
*/
@Override
public long getSize() {
return this.size;
}
/**
* Page
* size100size100
* sizesizethis便
*
* @param size
* @return Page<T>
*/
@Override
public Page<T> setSize(long size) {
int maxSize = 100;
if (size > maxSize) {
this.size = maxSize;
} else {
this.size = size;
}
return this;
}
/**
* Pagecurrent使
*
* @return long
*/
@Override
public long getCurrent() {
return this.current;
}
/**
* Pagecurrentthis便
*
*
* @param current
* @return Page<T>
*/
@Override
public Page<T> setCurrent(long current) {
this.current = current;
return this;
}
}
Loading…
Cancel
Save