瀏覽代碼

优化加解密处理逻辑;优化数据库增强处理逻辑;基础工具性能优化;

woody 11 月之前
父節點
當前提交
34770247d4

+ 0 - 21
framework-database/src/main/java/com/chelvc/framework/database/annotation/Confidential.java

@@ -1,21 +0,0 @@
-package com.chelvc.framework.database.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * 机密数据注解,使用该注解的字段值将会在入库前加密和出库后解密
- *
- * @author Woody
- * @date 2024/1/30
- */
-@Inherited
-@Documented
-@Target(ElementType.FIELD)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Confidential {
-}

+ 0 - 34
framework-database/src/main/java/com/chelvc/framework/database/annotation/Unique.java

@@ -1,34 +0,0 @@
-package com.chelvc.framework.database.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * 数据唯一约束注解
- *
- * @author Woody
- * @date 2024/1/30
- */
-@Inherited
-@Documented
-@Target(ElementType.FIELD)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Unique {
-    /**
-     * 获取联合唯一字段数组
-     *
-     * @return 字段名称数组
-     */
-    String[] composites() default {};
-
-    /**
-     * 违反约束异常信息
-     *
-     * @return 异常信息
-     */
-    String message() default "Duplicate value";
-}

+ 0 - 88
framework-database/src/main/java/com/chelvc/framework/database/context/GetterContext.java

@@ -1,88 +0,0 @@
-package com.chelvc.framework.database.context;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import com.baomidou.mybatisplus.core.conditions.AbstractWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
-import com.chelvc.framework.common.util.AssertUtils;
-import com.chelvc.framework.common.util.ObjectUtils;
-import lombok.Getter;
-import lombok.NonNull;
-
-/**
- * 对象实体Getter方法上下文
- *
- * @param <T> Getter方法实体类型
- * @param <T> Getter方法返回类型
- * @author Woody
- * @date 2024/1/30
- */
-@Getter
-public class GetterContext<T, R> implements SFunction<T, R> {
-    /**
-     * 目标属性
-     */
-    private final String property;
-
-    /**
-     * 方法被引用对象
-     */
-    private final Class<?> reference;
-
-    /**
-     * 属性直接所属对象
-     */
-    private final Class<?> declaring;
-
-    public GetterContext(@NonNull String property, @NonNull Class<?> reference, @NonNull Class<?> declaring) {
-        this.property = property;
-        this.reference = reference;
-        this.declaring = declaring;
-    }
-
-    @Override
-    @SuppressWarnings("unchecked")
-    public R apply(T t) {
-        Method getter = ObjectUtils.lookupPropertyGetter(this.declaring, this.property);
-        AssertUtils.nonnull(getter,
-                () -> "Getter method not found: " + this.declaring.getName() + "." + this.property);
-        try {
-            return (R) getter.invoke(t);
-        } catch (IllegalAccessException | InvocationTargetException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    /**
-     * 自定义Getter方法引用查询包装器
-     *
-     * @param <T> 实体类型
-     */
-    public static class Query<T> extends LambdaQueryWrapper<T> {
-        private static final Field PARAM_NAME_SEQ_FIELD = ObjectUtils.getField(AbstractWrapper.class, "paramNameSeq");
-        private static final Field PARAM_NAME_VALUE_PAIRS_FIELD =
-                ObjectUtils.getField(AbstractWrapper.class, "paramNameValuePairs");
-
-        public Query(Class<T> clazz) {
-            super(clazz);
-        }
-
-        @Override
-        protected LambdaQueryWrapper<T> instance() {
-            LambdaQueryWrapper<T> instance = new Query<>(this.getEntityClass());
-            // 复制paramNameSeq、paramNameValuePairs,不然会出现子查询参数为空的情况
-            ObjectUtils.setValue(instance, PARAM_NAME_SEQ_FIELD, this.paramNameSeq);
-            ObjectUtils.setValue(instance, PARAM_NAME_VALUE_PAIRS_FIELD, this.paramNameValuePairs);
-            return instance;
-        }
-
-        @Override
-        @SuppressWarnings("unchecked")
-        protected String columnToString(SFunction<T, ?> getter, boolean onlyColumn) {
-            return DatabaseContextHolder.getter2column((GetterContext<T, ?>) getter);
-        }
-    }
-}

+ 0 - 39
framework-database/src/main/java/com/chelvc/framework/database/context/UniqueContext.java

@@ -1,39 +0,0 @@
-package com.chelvc.framework.database.context;
-
-import java.lang.reflect.Field;
-import java.util.List;
-
-import com.chelvc.framework.database.annotation.Unique;
-import lombok.Getter;
-import lombok.NonNull;
-
-/**
- * 唯一约束字段上下文
- *
- * @param <T> 实体类型
- * @author Woody
- * @date 2024/1/30
- */
-@Getter
-public class UniqueContext<T> {
-    /**
-     * 目标字段
-     */
-    private final Field field;
-
-    /**
-     * 唯一约束注解实例
-     */
-    private final Unique unique;
-
-    /**
-     * 唯一约束字段Getter方法列表
-     */
-    private final List<GetterContext<T, ?>> getters;
-
-    public UniqueContext(@NonNull Field field, @NonNull Unique unique, @NonNull List<GetterContext<T, ?>> getters) {
-        this.field = field;
-        this.unique = unique;
-        this.getters = getters;
-    }
-}

+ 0 - 0
framework-database/src/main/java/com/chelvc/framework/database/interceptor/DeletedExcludeInterceptor.java → framework-database/src/main/java/com/chelvc/framework/database/interceptor/DeletedIsolateInterceptor.java


+ 0 - 0
framework-database/src/main/java/com/chelvc/framework/database/interceptor/PropertyUpdateInterceptor.java → framework-database/src/main/java/com/chelvc/framework/database/interceptor/DynamicInvokeInterceptor.java


+ 0 - 393
framework-database/src/main/java/com/chelvc/framework/database/interceptor/JsonHandlerConfigureInterceptor.java

@@ -1,393 +0,0 @@
-package com.chelvc.framework.database.interceptor;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicLong;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
-import com.baomidou.mybatisplus.core.metadata.TableInfo;
-import com.chelvc.framework.common.model.File;
-import com.chelvc.framework.common.model.Modification;
-import com.chelvc.framework.common.model.Period;
-import com.chelvc.framework.common.model.Reference;
-import com.chelvc.framework.common.model.Region;
-import com.chelvc.framework.common.util.ObjectUtils;
-import com.chelvc.framework.common.util.StringUtils;
-import com.chelvc.framework.database.context.DatabaseContextHolder;
-import com.chelvc.framework.database.handler.BooleansTypeHandler;
-import com.chelvc.framework.database.handler.DoublesTypeHandler;
-import com.chelvc.framework.database.handler.FilesTypeHandler;
-import com.chelvc.framework.database.handler.FloatsTypeHandler;
-import com.chelvc.framework.database.handler.IntegersTypeHandler;
-import com.chelvc.framework.database.handler.JsonTypeHandler;
-import com.chelvc.framework.database.handler.ListTypeHandler;
-import com.chelvc.framework.database.handler.ListsTypeHandler;
-import com.chelvc.framework.database.handler.LongsTypeHandler;
-import com.chelvc.framework.database.handler.MapTypeHandler;
-import com.chelvc.framework.database.handler.MapsTypeHandler;
-import com.chelvc.framework.database.handler.ModificationsTypeHandler;
-import com.chelvc.framework.database.handler.PeriodsTypeHandler;
-import com.chelvc.framework.database.handler.RegionsTypeHandler;
-import com.chelvc.framework.database.handler.SetTypeHandler;
-import com.chelvc.framework.database.handler.SetsTypeHandler;
-import com.chelvc.framework.database.handler.ShortsTypeHandler;
-import com.chelvc.framework.database.handler.StringsTypeHandler;
-import com.chelvc.framework.database.handler.UniqueBooleansTypeHandler;
-import com.chelvc.framework.database.handler.UniqueDoublesTypeHandler;
-import com.chelvc.framework.database.handler.UniqueFilesTypeHandler;
-import com.chelvc.framework.database.handler.UniqueFloatsTypeHandler;
-import com.chelvc.framework.database.handler.UniqueIntegersTypeHandler;
-import com.chelvc.framework.database.handler.UniqueLongsTypeHandler;
-import com.chelvc.framework.database.handler.UniqueModificationsTypeHandler;
-import com.chelvc.framework.database.handler.UniquePeriodsTypeHandler;
-import com.chelvc.framework.database.handler.UniqueRegionsTypeHandler;
-import com.chelvc.framework.database.handler.UniqueShortsTypeHandler;
-import com.chelvc.framework.database.handler.UniqueStringsTypeHandler;
-import com.google.common.collect.Maps;
-import javassist.ClassPool;
-import javassist.CtClass;
-import javassist.CtConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.ibatis.parsing.XNode;
-import org.apache.ibatis.type.TypeAliasRegistry;
-import org.apache.ibatis.type.UnknownTypeHandler;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * JSON类型字段处理器配置拦截器
- *
- * @author Woody
- * @date 2024/4/6
- */
-@Slf4j
-public class JsonHandlerConfigureInterceptor extends MybatisConfigureInterceptor {
-    /**
-     * JSON类型处理器计数器
-     */
-    private final AtomicLong counter = new AtomicLong(0);
-
-    /**
-     * JSON类型/处理器映射表
-     */
-    private final Map<Type, Class<?>> handlers = Maps.newConcurrentMap();
-
-    /**
-     * 内置的别名/对象类型映射表
-     */
-    private final Map<String, Class<?>> aliases = new TypeAliasRegistry().getTypeAliases();
-
-    /**
-     * 判断是否是元类型
-     *
-     * @param clazz 对象类型
-     * @return true/false
-     */
-    private boolean isMetaType(Class<?> clazz) {
-        return DatabaseContextHolder.isTypeHandlerRegistered(clazz) || Map.class.isAssignableFrom(clazz)
-                || Collection.class.isAssignableFrom(clazz);
-    }
-
-    /**
-     * 绑定字段JSON类型处理器
-     *
-     * @param field 表字段信息
-     */
-    private void bindJsonHandler(TableFieldInfo field) {
-        Class<?> handler = this.lookupJsonHandlerClass(field.getField());
-        ObjectUtils.setValue(field, "typeHandler", handler);
-        String el = ObjectUtils.getValue(field, "el") + ",typeHandler=" + handler.getName();
-        ObjectUtils.setValue(field, "el", el);
-    }
-
-    /**
-     * 查找JSON类型处理器对象
-     *
-     * @param field JSON字段实例
-     * @return JSON类型处理器对象类型
-     */
-    private Class<?> lookupJsonHandlerClass(Field field) {
-        Type type = field.getGenericType();
-        if (ObjectUtils.isOnlyMap(type)) {
-            return MapTypeHandler.class;
-        } else if (ObjectUtils.isOnlySet(type)) {
-            return SetTypeHandler.class;
-        } else if (ObjectUtils.isOnlyList(type)) {
-            return ListTypeHandler.class;
-        } else if (type instanceof ParameterizedType) {
-            Type raw = ((ParameterizedType) type).getRawType();
-            Type arg = ((ParameterizedType) type).getActualTypeArguments()[0];
-            if (raw == Set.class) {
-                if (arg == int.class || arg == Integer.class) {
-                    return UniqueIntegersTypeHandler.class;
-                } else if (arg == short.class || arg == Short.class) {
-                    return UniqueShortsTypeHandler.class;
-                } else if (arg == long.class || arg == Long.class) {
-                    return UniqueLongsTypeHandler.class;
-                } else if (arg == float.class || arg == Float.class) {
-                    return UniqueFloatsTypeHandler.class;
-                } else if (arg == double.class || arg == Double.class) {
-                    return UniqueDoublesTypeHandler.class;
-                } else if (arg == boolean.class || arg == Boolean.class) {
-                    return UniqueBooleansTypeHandler.class;
-                } else if (arg == String.class) {
-                    return UniqueStringsTypeHandler.class;
-                } else if (arg == File.class) {
-                    return UniqueFilesTypeHandler.class;
-                } else if (arg == Period.class) {
-                    return UniquePeriodsTypeHandler.class;
-                } else if (arg == Region.class) {
-                    return UniqueRegionsTypeHandler.class;
-                } else if (arg == Modification.class) {
-                    return UniqueModificationsTypeHandler.class;
-                }
-            } else if (raw == List.class) {
-                if (arg == int.class || arg == Integer.class) {
-                    return IntegersTypeHandler.class;
-                } else if (arg == short.class || arg == Short.class) {
-                    return ShortsTypeHandler.class;
-                } else if (arg == long.class || arg == Long.class) {
-                    return LongsTypeHandler.class;
-                } else if (arg == float.class || arg == Float.class) {
-                    return FloatsTypeHandler.class;
-                } else if (arg == double.class || arg == Double.class) {
-                    return DoublesTypeHandler.class;
-                } else if (arg == boolean.class || arg == Boolean.class) {
-                    return BooleansTypeHandler.class;
-                } else if (arg == String.class) {
-                    return StringsTypeHandler.class;
-                } else if (arg == File.class) {
-                    return FilesTypeHandler.class;
-                } else if (arg == Period.class) {
-                    return PeriodsTypeHandler.class;
-                } else if (arg == Region.class) {
-                    return RegionsTypeHandler.class;
-                } else if (arg == Modification.class) {
-                    return ModificationsTypeHandler.class;
-                } else if (ObjectUtils.isOnlyMap(arg)) {
-                    return MapsTypeHandler.class;
-                } else if (ObjectUtils.isOnlySet(arg)) {
-                    return SetsTypeHandler.class;
-                } else if (ObjectUtils.isOnlyList(arg)) {
-                    return ListsTypeHandler.class;
-                }
-            }
-        }
-        return this.handlers.computeIfAbsent(type, t -> {
-            try {
-                return this.initializeJsonHandlerClass(field);
-            } catch (Exception e) {
-                throw new RuntimeException(e);
-            }
-        });
-    }
-
-    /**
-     * 初始化JSON类型处理器对象
-     *
-     * @param field JSON字段实例
-     * @return JSON类型处理器对象类型
-     * @throws Exception 对象初始化异常
-     */
-    private Class<?> initializeJsonHandlerClass(Field field) throws Exception {
-        ClassPool pool = ClassPool.getDefault();
-        CtClass handler = pool.makeClass(String.format("_JsonTypeHandler_%d", this.counter.incrementAndGet()));
-        handler.setSuperclass(pool.get(JsonTypeHandler.Simple.class.getName()));
-        CtConstructor constructor = new CtConstructor(new CtClass[]{}, handler);
-        constructor.setBody(String.format("{super(%s);}", ObjectUtils.analyse(field.getGenericType())));
-        handler.addConstructor(constructor);
-        return handler.toClass(this.getClass().getClassLoader(), null);
-    }
-
-    /**
-     * 判断字段是否可以配置JSON类型处理器
-     *
-     * @param field 数据模型字段
-     * @return true/false
-     */
-    private boolean isJsonHandlerConfigurable(Field field) {
-        TableField annotation = field.getAnnotation(TableField.class);
-        if (annotation == null || annotation.exist()) {
-            Class<?> handler = ObjectUtils.ifNull(annotation, TableField::typeHandler);
-            return (handler == null || handler == UnknownTypeHandler.class)
-                    && !DatabaseContextHolder.isTypeHandlerRegistered(field.getType());
-        }
-        return false;
-    }
-
-    /**
-     * 判断数据模型是否可以配置JSON类型处理器
-     *
-     * @param clazz 数据模型对象
-     * @return true/false
-     */
-    private boolean isJsonHandlerConfigurable(Class<?> clazz) {
-        if (this.isMetaType(clazz)) {
-            return false;
-        }
-        Reference<Boolean> configurable = new Reference<>();
-        ObjectUtils.iterateFields(clazz, (i, field) -> {
-            if (this.isJsonHandlerConfigurable(field)) {
-                configurable.set(true);
-                return false;
-            }
-            return true;
-        });
-        return configurable.get(false);
-    }
-
-    /**
-     * 判断表字段是否可以配置JSON类型处理器
-     *
-     * @param field 表字段信息
-     * @return true/false
-     */
-    private boolean isJsonHandlerConfigurable(TableFieldInfo field) {
-        return field.getTypeHandler() == null
-                && !DatabaseContextHolder.isTypeHandlerRegistered(field.getPropertyType());
-    }
-
-    /**
-     * 获取查询结果类型
-     *
-     * @param node 查询节点
-     * @return 对象类型
-     */
-    private Class<?> getSelectResultType(XNode node) {
-        String type = node.getStringAttribute("resultType");
-        if (StringUtils.notEmpty(type)) {
-            Class<?> clazz = this.aliases.get(type);
-            if (clazz != null) {
-                return clazz;
-            }
-            try {
-                return Class.forName(type);
-            } catch (ClassNotFoundException e) {
-                log.warn("Result type class load failed: {}", e.getMessage());
-            }
-        }
-        return null;
-    }
-
-    /**
-     * 获取查询结果类型
-     *
-     * @param node 查询节点
-     * @return 对象类型
-     */
-    private Class<?> getResultMappingType(XNode node) {
-        String type = node.getStringAttribute("type");
-        if (StringUtils.notEmpty(type)) {
-            Class<?> clazz = this.aliases.get(type);
-            if (clazz != null) {
-                return clazz;
-            }
-            try {
-                return Class.forName(type);
-            } catch (ClassNotFoundException e) {
-                log.warn("Result map class load failed: {}", e.getMessage());
-            }
-        }
-        return null;
-    }
-
-    /**
-     * 初始化resultMap
-     *
-     * @param document xml文档对象
-     * @param clazz    对象类型
-     * @return 节点元素
-     */
-    private Element initializeResultMapping(Document document, Class<?> clazz) {
-        // 构建resultMap节点元素
-        Element element = document.createElement("resultMap");
-        element.setAttribute("id", StringUtils.uuid());
-        element.setAttribute("type", clazz.getName());
-
-        // 添加resultMap字段映射
-        ObjectUtils.iterateFields(clazz, (i, field) -> {
-            String tag = field.isAnnotationPresent(TableId.class) ? "id" : "result";
-            String column = StringUtils.ifEmpty(
-                    ObjectUtils.ifNull(field.getAnnotation(TableField.class), TableField::value),
-                    () -> StringUtils.hump2underscore(field.getName())
-            );
-            Element child = document.createElement(tag);
-            child.setAttribute("column", column);
-            child.setAttribute("property", field.getName());
-
-            // 设置json类型处理器
-            if (this.isJsonHandlerConfigurable(field)) {
-                Class<?> handler = this.lookupJsonHandlerClass(field);
-                child.setAttribute("typeHandler", handler.getName());
-            }
-            element.appendChild(child);
-        });
-        return element;
-    }
-
-    @Override
-    public void intercept(XNode mapper) {
-        // 设置已有resultMap的json类型处理器
-        List<XNode> maps = mapper.evalNodes("resultMap");
-        if (ObjectUtils.notEmpty(maps)) {
-            for (XNode map : maps) {
-                Class<?> clazz = this.getResultMappingType(map);
-                if (clazz == null || this.isMetaType(clazz)) {
-                    continue;
-                }
-                for (XNode child : map.getChildren()) {
-                    // 判断当前是有存在typeHandler,如果不存在且字段满足配置json类型处理器条件,则自动绑定json类型处理器
-                    if (StringUtils.isEmpty(child.getStringAttribute("typeHandler"))) {
-                        String property = child.getStringAttribute("property");
-                        Field field = ObjectUtils.lookupField(clazz, property);
-                        if (field != null && this.isJsonHandlerConfigurable(field)) {
-                            Class<?> handler = this.lookupJsonHandlerClass(field);
-                            ((Element) child.getNode()).setAttribute("typeHandler", handler.getName());
-                        }
-                    }
-                }
-            }
-        }
-
-        // 设置resultType对应的resultMap,并将原来的resultType替换成resultMap
-        Document document = mapper.getNode().getOwnerDocument();
-        List<XNode> selects = mapper.evalNodes("select");
-        if (ObjectUtils.notEmpty(selects)) {
-            Map<Class<?>, Element> cache = Maps.newHashMap();
-            for (XNode select : selects) {
-                // 判断resultType是否可配置json类型处理器
-                Class<?> clazz = this.getSelectResultType(select);
-                try {
-                    if (clazz != null && this.isJsonHandlerConfigurable(clazz)) {
-                        // 构建并注册resultMap
-                        Element map = cache.computeIfAbsent(clazz, c -> this.initializeResultMapping(document, clazz));
-                        mapper.getNode().appendChild(map);
-
-                        // 用户新生成的resultMap替换resultType
-                        Element element = (Element) select.getNode();
-                        element.removeAttribute("resultType");
-                        element.setAttribute("resultMap", map.getAttribute("id"));
-                    }
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-    }
-
-    @Override
-    public void intercept(TableInfo table) {
-        // 自动绑定JSON类型字段处理器
-        List<TableFieldInfo> fields = table.getFieldList();
-        if (ObjectUtils.notEmpty(fields)) {
-            fields.stream().filter(this::isJsonHandlerConfigurable).forEach(this::bindJsonHandler);
-        }
-    }
-}

+ 0 - 186
framework-database/src/main/java/com/chelvc/framework/database/interceptor/MybatisConfigureInterceptor.java

@@ -1,186 +0,0 @@
-package com.chelvc.framework.database.interceptor;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import com.baomidou.mybatisplus.core.config.GlobalConfig;
-import com.baomidou.mybatisplus.core.metadata.TableInfo;
-import com.chelvc.framework.base.util.SpringUtils;
-import com.chelvc.framework.common.util.ObjectUtils;
-import com.google.common.collect.Lists;
-import javassist.ClassPool;
-import javassist.CtClass;
-import javassist.CtMethod;
-import javassist.CtNewMethod;
-import javassist.LoaderClassPath;
-import javassist.NotFoundException;
-import lombok.NonNull;
-import org.apache.ibatis.parsing.XNode;
-import org.springframework.core.annotation.Order;
-
-/**
- * Mybatis配置拦截器抽象实现类
- *
- * @author Woody
- * @date 2024/4/6
- */
-public abstract class MybatisConfigureInterceptor {
-    /**
-     * 是否已初始化
-     */
-    private static boolean INITIALIZED;
-
-    /**
-     * 拦截器实例列表
-     */
-    private static final List<MybatisConfigureInterceptor> INSTANCES = Lists.newArrayList();
-
-    /**
-     * 初始化配置拦截器
-     */
-    public synchronized static void initialize() {
-        if (!INITIALIZED) {
-            try {
-                ClassPool pool = ClassPool.getDefault();
-                pool.appendClassPath(new LoaderClassPath(Thread.currentThread().getContextClassLoader()));
-                initializeMapperListener(pool);
-                initializeTableInfoListener(pool);
-                INSTANCES.addAll(initializeInterceptorInstances());
-                ((ArrayList<MybatisConfigureInterceptor>) INSTANCES).trimToSize();
-            } catch (Exception e) {
-                throw new RuntimeException(e);
-            } finally {
-                INITIALIZED = true;
-            }
-        }
-    }
-
-    /**
-     * 初始化Mapper解析监听器
-     *
-     * @param pool 类对象池
-     * @throws Exception 初始化异常
-     */
-    private static void initializeMapperListener(ClassPool pool) throws Exception {
-        // 替换XMLMapperBuilder.parse方法逻辑,加入Mapper解析监听回调逻辑
-        CtClass clazz = pool.get("org.apache.ibatis.builder.xml.XMLMapperBuilder");
-        CtMethod method = clazz.getDeclaredMethod("parse");
-        method.setBody(String.format("{\n" +
-                "if (!this.configuration.isResourceLoaded(this.resource)) {\n" +
-                "   %s node = this.parser.evalNode(\"/mapper\");\n" +
-                "   %s.configure(node);\n" +
-                "   this.configurationElement(node);\n" +
-                "   this.configuration.addLoadedResource(this.resource);\n" +
-                "   this.bindMapperForNamespace();\n" +
-                "}\n" +
-                "this.parsePendingResultMaps();\n" +
-                "this.parsePendingCacheRefs();\n" +
-                "this.parsePendingStatements();\n" +
-                "}", XNode.class.getName(), MybatisConfigureInterceptor.class.getName()));
-        clazz.toClass();
-    }
-
-    /**
-     * 初始化数据模型表信息监听器
-     *
-     * @param pool 类对象池
-     * @throws Exception 初始化异常
-     */
-    private static void initializeTableInfoListener(ClassPool pool) throws Exception {
-        // 获取原始initTableFields方法
-        CtMethod initTableFields = null;
-        CtClass clazz = pool.get("com.baomidou.mybatisplus.core.metadata.TableInfoHelper");
-        for (CtMethod method : clazz.getDeclaredMethods()) {
-            if (method.getName().equals("initTableFields")) {
-                initTableFields = method;
-            }
-        }
-        if (initTableFields == null) {
-            throw new NotFoundException("initTableFields");
-        }
-
-        // 重命名initTableFields方法名
-        CtMethod copy = CtNewMethod.copy(initTableFields, clazz, null);
-        copy.setName("doInitTableFields");
-        clazz.removeMethod(initTableFields);
-        clazz.addMethod(copy);
-
-        // 替换initTableFields方法,加入表信息初始化回调逻辑
-        CtMethod replace = CtNewMethod.make(String.format("private static void initTableFields(" +
-                        "Class clazz, %s globalConfig, %s tableInfo, java.util.List excludeProperty) {\n" +
-                        "doInitTableFields(clazz, globalConfig, tableInfo, excludeProperty);\n" +
-                        "%s.configure(tableInfo);\n" +
-                        "}",
-                GlobalConfig.class.getName(), TableInfo.class.getName(), MybatisConfigureInterceptor.class.getName()),
-                clazz
-        );
-        clazz.addMethod(replace);
-        clazz.toClass();
-    }
-
-    /**
-     * 初始化Mybatis配置拦截器实例
-     *
-     * @return Mybatis配置拦截器列表
-     * @throws Exception 初始化异常
-     */
-    private static List<MybatisConfigureInterceptor> initializeInterceptorInstances() throws Exception {
-        // 查找当前包目录下MybatisConfigureInterceptor实现
-        List<Class<?>> classes = SpringUtils.lookupClasses(
-                MybatisConfigureInterceptor.class.getPackage().getName(),
-                clazz -> clazz != MybatisConfigureInterceptor.class
-                        && MybatisConfigureInterceptor.class.isAssignableFrom(clazz)
-        );
-
-        // 基于@Order注解对拦截器对象排序
-        classes.sort(Comparator.comparingInt(
-                clazz -> ObjectUtils.ifNull(clazz.getAnnotation(Order.class), Order::value, () -> 0)
-        ));
-
-        // 初始化对象实例
-        if (ObjectUtils.isEmpty(classes)) {
-            return Collections.emptyList();
-        }
-        List<MybatisConfigureInterceptor> interceptors = Lists.newArrayListWithCapacity(classes.size());
-        for (Class<?> clazz : classes) {
-            interceptors.add((MybatisConfigureInterceptor) clazz.newInstance());
-        }
-        return interceptors;
-    }
-
-    /**
-     * 配置Mapper XML节点
-     *
-     * @param mapper Mapper XML节点
-     */
-    public static void configure(@NonNull XNode mapper) {
-        INSTANCES.forEach(interceptor -> interceptor.intercept(mapper));
-    }
-
-    /**
-     * 配置数据模型表信息
-     *
-     * @param table 数据模型表信息
-     */
-    public static void configure(@NonNull TableInfo table) {
-        INSTANCES.forEach(interceptor -> interceptor.intercept(table));
-    }
-
-    /**
-     * 拦截Mapper配置
-     *
-     * @param mapper Mapper XML节点
-     */
-    public void intercept(XNode mapper) {
-    }
-
-    /**
-     * 拦截数据模型配置
-     *
-     * @param table 数据模型表信息
-     */
-    public void intercept(TableInfo table) {
-    }
-}