前提:将自定义的拦截器注入IOC容器。
1、创建自定义拦截器,实现Interceptor接口,重写interceptor()方法
2、在自定义拦截器上使用@Interceptors注解,在该注解中使用@Signature指定拦截的接口类型,方法名与参数类型。
实例:
/*
* Copyright (c) 2020, 2024, All rights reserved.
*
*/
package com.by.config;
import cn.hutool.core.util.ReflectUtil;
import cn.scl.core.threadlocal.LocalUserUtil;
import lombok.Singular;
import org.apache.ibatis.executor.parameter.ParameterHandler;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.plugin.Intercepts;
import org.apache.ibatis.plugin.Invocation;
import org.apache.ibatis.plugin.Signature;
import org.springframework.stereotype.Component;
import java.lang.reflect.Field;
import java.sql.PreparedStatement;
import java.time.LocalDateTime;
/**
* <p>Project: wms-root - ParameterPlugin</p>
* <p>Powered by scl On 2024-03-13 10:14:21</p>
* <p>描述:<p>
*
* @author 孙臣龙 [1846080280@qq.com]
*

最低0.47元/天 解锁文章
2814

被折叠的 条评论
为什么被折叠?



