设备列表 视频流服务器
This commit is contained in:
@@ -77,6 +77,15 @@ public class MybatisPlusConfig {
|
||||
PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();
|
||||
// 分页合理化
|
||||
paginationInnerInterceptor.setOverflow(true);
|
||||
// 单页上限 —— 兜住两种「一个请求打爆数据库」的姿势:
|
||||
// 1) 不传 pageSize:PageQuery#build 会回落成 DEFAULT_PAGE_SIZE = Integer.MAX_VALUE,
|
||||
// 等于「不传就取全表」,且此前 maxLimit 未设,没有任何兜底;
|
||||
// 2) 显式传超大 pageSize(如 ?pageSize=999999999)。
|
||||
// 取值 1000 的依据:当前最大单页需求是 200(设备型号候选去重),
|
||||
// 需要全量的场景(Excel 导出)走的是不分页查询,不受本上限约束。
|
||||
// ⚠️ 副作用:超过 1000 的请求会被**静默改写**(MyBatis-Plus 不抛错)。
|
||||
// 因此**需要全量数据时请用不分页查询,不要靠「不传 pageSize」**。
|
||||
paginationInnerInterceptor.setMaxLimit(1000L);
|
||||
return paginationInnerInterceptor;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,14 @@ public class PageQuery implements Serializable {
|
||||
public static final int DEFAULT_PAGE_NUM = 1;
|
||||
|
||||
/**
|
||||
* 每页显示记录数 默认值 默认查全部
|
||||
* 每页显示记录数 默认值:**不传 pageSize 时回落值**。
|
||||
* <p>
|
||||
* ⚠️ 这里是 {@link Integer#MAX_VALUE},字面语义是「查全部」,但**实际不会真的全表返回** ——
|
||||
* {@code MybatisPlusConfig#paginationInnerInterceptor} 设了 {@code maxLimit = 1000},
|
||||
* MyBatis-Plus 会把超限的 size 静默改写掉。原注释「默认查全部」有误导性,已订正。
|
||||
* <p>
|
||||
* 另外 {@link #getFirstNum()} 用本值算偏移量,{@code (pageNum - 1) * MAX_VALUE}
|
||||
* 在 {@code pageNum > 1} 时会**整型溢出** —— 该方法目前无调用方,但若要启用必须先收口。
|
||||
*/
|
||||
public static final int DEFAULT_PAGE_SIZE = Integer.MAX_VALUE;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user