mapperRegistryCache = new ConcurrentSkipListSet<>();
- /**
- * 元对象字段填充控制器
- */
- private MetaObjectHandler metaObjectHandler;
- /**
- * 参与 TableInfo 的初始化
- */
- private PostInitTableInfoHandler postInitTableInfoHandler = new PostInitTableInfoHandler() {
- };
- /**
- * 主键生成器
- */
- private IdentifierGenerator identifierGenerator;
-
- @Data
- public static class DbConfig {
- /**
- * 主键类型
- */
- private IdType idType = IdType.ASSIGN_ID;
- /**
- * 表名前缀
- */
- private String tablePrefix;
- /**
- * schema
- *
- * @since 3.1.1
- */
- private String schema;
- /**
- * db字段 format
- *
- * 例: `%s`
- *
- * 对主键无效
- *
- * @since 3.1.1
- */
- private String columnFormat;
- /**
- * entity 的字段(property)的 format,只有在 column as property 这种情况下生效
- *
- * 例: `%s`
- *
- * 对主键无效
- *
- * @since 3.3.0
- */
- private String propertyFormat;
- /**
- * 实验性功能,占位符替换,等同于 {@link com.baomidou.mybatisplus.extension.plugins.inner.ReplacePlaceholderInnerInterceptor},
- * 只是这个属于启动时替换,用得地方多会启动慢一点点,不适用于其他的 {@link org.apache.ibatis.scripting.LanguageDriver}
- *
- * @since 3.4.2
- */
- private boolean replacePlaceholder;
- /**
- * 转义符
- *
- * 配合 {@link #replacePlaceholder} 使用时有效
- *
- * 例: " 或 ' 或 `
- *
- * @since 3.4.2
- */
- private String escapeSymbol;
- /**
- * 表名是否使用驼峰转下划线命名,只对表名生效
- */
- private boolean tableUnderline = true;
- /**
- * 大写命名,对表名和字段名均生效
- */
- private boolean capitalMode = false;
- /**
- * 表主键生成器
- */
- private List keyGenerators;
- /**
- * 逻辑删除全局属性名
- */
- private String logicDeleteField;
- /**
- * 逻辑删除全局值(默认 1、表示已删除)
- */
- private String logicDeleteValue = "1";
- /**
- * 逻辑未删除全局值(默认 0、表示未删除)
- */
- private String logicNotDeleteValue = "0";
- /**
- * 字段验证策略之 insert
- *
- * @since 3.1.2
- */
- private FieldStrategy insertStrategy = FieldStrategy.NOT_NULL;
- /**
- * 字段验证策略之 update
- *
- * @since 3.1.2
- */
- private FieldStrategy updateStrategy = FieldStrategy.NOT_NULL;
-
- /**
- * 字段验证策略之 select
- *
- * @since 3.1.2
- * @deprecated 3.4.4
- */
- @Deprecated
- private FieldStrategy selectStrategy;
-
- /**
- * 字段验证策略之 where
- * 替代selectStrategy,保持与{@link TableField#whereStrategy()}一致
- *
- * @since 3.4.4
- */
- private FieldStrategy whereStrategy = FieldStrategy.NOT_NULL;
-
- /**
- * 重写whereStrategy的get方法,适配低版本:
- * - 如果用户自定义了selectStrategy则用用户自定义的,
- * - 后续版本移除selectStrategy后,直接删除该方法即可。
- *
- * @return 字段作为查询条件时的验证策略
- * @since 3.4.4
- */
- public FieldStrategy getWhereStrategy() {
- return selectStrategy == null ? whereStrategy : selectStrategy;
- }
- }
-}
diff --git a/chushang-common/chushang-common-mybatis/src/main/java/com/baomidou/mybatisplus/extension/plugins/inner/PaginationInnerInterceptor.java b/chushang-common/chushang-common-mybatis/src/main/java/com/baomidou/mybatisplus/extension/plugins/inner/PaginationInnerInterceptor.java
deleted file mode 100644
index c1965ea..0000000
--- a/chushang-common/chushang-common-mybatis/src/main/java/com/baomidou/mybatisplus/extension/plugins/inner/PaginationInnerInterceptor.java
+++ /dev/null
@@ -1,483 +0,0 @@
-/*
- * Copyright (c) 2011-2022, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.extension.plugins.inner;
-
-import com.baomidou.mybatisplus.annotation.DbType;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.metadata.OrderItem;
-import com.baomidou.mybatisplus.core.toolkit.*;
-import com.baomidou.mybatisplus.extension.plugins.pagination.DialectFactory;
-import com.baomidou.mybatisplus.extension.plugins.pagination.DialectModel;
-import com.baomidou.mybatisplus.extension.plugins.pagination.dialects.IDialect;
-import com.baomidou.mybatisplus.extension.toolkit.JdbcUtils;
-import com.baomidou.mybatisplus.extension.toolkit.PropertyMapper;
-import com.baomidou.mybatisplus.extension.toolkit.SqlParserUtils;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import net.sf.jsqlparser.JSQLParserException;
-import net.sf.jsqlparser.expression.Alias;
-import net.sf.jsqlparser.expression.Expression;
-import net.sf.jsqlparser.parser.CCJSqlParserUtil;
-import net.sf.jsqlparser.schema.Column;
-import net.sf.jsqlparser.schema.Table;
-import net.sf.jsqlparser.statement.select.*;
-import org.apache.ibatis.cache.CacheKey;
-import org.apache.ibatis.executor.Executor;
-import org.apache.ibatis.logging.Log;
-import org.apache.ibatis.logging.LogFactory;
-import org.apache.ibatis.mapping.BoundSql;
-import org.apache.ibatis.mapping.MappedStatement;
-import org.apache.ibatis.mapping.ParameterMapping;
-import org.apache.ibatis.mapping.ResultMap;
-import org.apache.ibatis.session.Configuration;
-import org.apache.ibatis.session.ResultHandler;
-import org.apache.ibatis.session.RowBounds;
-
-import java.sql.SQLException;
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.stream.Collectors;
-
-/**
- * 分页拦截器
- *
- * 默认对 left join 进行优化,虽然能优化count,但是加上分页的话如果1对多本身结果条数就是不正确的
- *
- * @author hubin
- * @since 3.4.0
- */
-@Data
-@NoArgsConstructor
-@SuppressWarnings({"rawtypes"})
-public class PaginationInnerInterceptor implements InnerInterceptor {
- /**
- * 获取jsqlparser中count的SelectItem
- */
- protected static final List COUNT_SELECT_ITEM = Collections.singletonList(
- new SelectExpressionItem(new Column().withColumnName("COUNT(*)")).withAlias(new Alias("total"))
- );
- protected static final Map countMsCache = new ConcurrentHashMap<>();
- protected final Log logger = LogFactory.getLog(this.getClass());
-
-
- /**
- * 溢出总页数后是否进行处理
- */
- protected boolean overflow;
- /**
- * 单页分页条数限制
- */
- protected Long maxLimit;
- /**
- * 数据库类型
- *
- * 查看 {@link #findIDialect(Executor)} 逻辑
- */
- private DbType dbType;
- /**
- * 方言实现类
- *
- * 查看 {@link #findIDialect(Executor)} 逻辑
- */
- private IDialect dialect;
- /**
- * 生成 countSql 优化掉 join
- * 现在只支持 left join
- *
- * @since 3.4.2
- */
- protected boolean optimizeJoin = true;
-
- public PaginationInnerInterceptor(DbType dbType) {
- this.dbType = dbType;
- }
-
- public PaginationInnerInterceptor(IDialect dialect) {
- this.dialect = dialect;
- }
-
- /**
- * 这里进行count,如果count为0这返回false(就是不再执行sql了)
- */
- @Override
- public boolean willDoQuery(Executor executor, MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) throws SQLException {
- IPage> page = ParameterUtils.findPage(parameter).orElse(null);
- if (page == null || page.getSize() < 0 || !page.searchCount()) {
- return true;
- }
-
- BoundSql countSql;
- MappedStatement countMs = buildCountMappedStatement(ms, page.countId());
- if (countMs != null) {
- countSql = countMs.getBoundSql(parameter);
- } else {
- countMs = buildAutoCountMappedStatement(ms);
- String countSqlStr = autoCountSql(page, boundSql.getSql());
- PluginUtils.MPBoundSql mpBoundSql = PluginUtils.mpBoundSql(boundSql);
- countSql = new BoundSql(countMs.getConfiguration(), countSqlStr, mpBoundSql.parameterMappings(), parameter);
- PluginUtils.setAdditionalParameter(countSql, mpBoundSql.additionalParameters());
- }
-
- CacheKey cacheKey = executor.createCacheKey(countMs, parameter, rowBounds, countSql);
- List