//package com.njcn.gather.event.transientes.handler;
//
//import org.apache.ibatis.executor.statement.StatementHandler;
//import org.apache.ibatis.plugin.*;
//import org.apache.ibatis.session.ResultHandler;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.stereotype.Component;
//
//import java.sql.Statement;
//import java.util.Properties;
//
///**
// * @Author: cdf
// * @CreateTime: 2025-07-14
// * @Description:
// */
//@Intercepts({
//        @Signature(type = StatementHandler.class, method = "query", args = {Statement.class, ResultHandler.class}),
//        @Signature(type = StatementHandler.class, method = "update", args = {Statement.class}),
//        @Signature(type = StatementHandler.class, method = "batch", args = {Statement.class})
//})
//@Component
//public class SqlExecuteTimeInterceptor implements Interceptor {
//    private static final Logger logger = LoggerFactory.getLogger(SqlExecuteTimeInterceptor.class);
//
//    @Override
//    public Object intercept(Invocation invocation) throws Throwable {
//        long startTime = System.currentTimeMillis();
//        try {
//            return invocation.proceed();
//        } finally {
//            long endTime = System.currentTimeMillis();
//            long executeTime = endTime - startTime;
//
//            // 获取 SQL 语句
//            StatementHandler statementHandler = (StatementHandler) invocation.getTarget();
//            String sql = statementHandler.getBoundSql().getSql();
//
//            // 打印执行时间和 SQL
//            logger.info("SQL 执行时间: {}ms, SQL: {}", executeTime, sql);
//        }
//    }
//
//    @Override
//    public Object plugin(Object target) {
//        if (target instanceof StatementHandler) {
//            return Plugin.wrap(target, this);
//        }
//        return target;
//    }
//
//    @Override
//    public void setProperties(Properties properties) {
//        // 可配置参数
//    }
//}
