feat(core): 将项目从Java迁移到Kotlin并升级依赖
- 将多个Java文件转换为Kotlin文件,包括CallType、QuickBaseTypeHandler等 - 升级Netty版本从4.2.9.Final到4.130.Final - 添加新的Netty重连调度器ClientScheduleReconnect功能 - 新增DateTime和MySQL UUID类型处理器支持 - 创建命名线程工厂NamedThreadFactory用于线程池管理 - 修复UUID转换方法名称错误 - 更新项目版本号从4.2.7到4.3.2 - 移除Java版本的ValueGetter类,使用Kotlin数据类替代
This commit is contained in:
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright 2025 mingliqiye
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* ProjectName mingli-utils
|
||||
* ModuleName mingli-utils.main
|
||||
* CurrentFile CallType.java
|
||||
* LastUpdate 2025-09-21 21:06:52
|
||||
* UpdateUser MingLiPro
|
||||
*/
|
||||
|
||||
package com.mingliqiye.utils.mybatis;
|
||||
|
||||
/**
|
||||
* CallType枚举类定义了不同的调用类型
|
||||
* 用于标识数据库操作中结果集和可调用语句的访问方式
|
||||
*/
|
||||
public enum CallType {
|
||||
/**
|
||||
* 通过索引访问结果集
|
||||
* 使用数字索引位置来获取结果集中的数据
|
||||
*/
|
||||
RESULTSET_INDEX,
|
||||
|
||||
/**
|
||||
* 通过名称访问结果集
|
||||
* 使用列名来获取结果集中的数据
|
||||
*/
|
||||
RESULTSET_NAME,
|
||||
|
||||
/**
|
||||
* 通过索引访问可调用语句
|
||||
* 使用数字索引位置来获取可调用语句中的数据
|
||||
*/
|
||||
CALLABLE_STATEMENT_INDEX
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
/*
|
||||
* Copyright 2025 mingliqiye
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* ProjectName mingli-utils
|
||||
* ModuleName mingli-utils.main
|
||||
* CurrentFile QuickBaseTypeHandler.java
|
||||
* LastUpdate 2025-09-21 21:10:36
|
||||
* UpdateUser MingLiPro
|
||||
*/
|
||||
|
||||
package com.mingliqiye.utils.mybatis;
|
||||
|
||||
import org.apache.ibatis.type.BaseTypeHandler;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* 抽象类 QuickBaseTypeHandler 是 MyBatis 的 BaseTypeHandler 的扩展,
|
||||
* 提供了统一处理数据库字段与 Java 类型之间转换的抽象方法。
|
||||
* 子类需要实现 getValue 和 setValue 方法来完成具体的类型转换逻辑。
|
||||
*
|
||||
* @param <T> 要处理的 Java 类型
|
||||
*/
|
||||
public abstract class QuickBaseTypeHandler<T> extends BaseTypeHandler<T> {
|
||||
|
||||
/**
|
||||
* 抽象方法,用于从数据库结果中获取并转换为 Java 类型 T。
|
||||
*
|
||||
* @param vg 值获取器,封装了 ResultSet 或 CallableStatement
|
||||
* @param ct 调用类型,标识当前是从 ResultSet 还是 CallableStatement 获取数据
|
||||
* @param ci 列索引(可为 null)
|
||||
* @param cn 列名(可为 null)
|
||||
* @return 转换后的 Java 类型 T 实例
|
||||
* @throws SQLException SQL 执行异常时抛出
|
||||
*/
|
||||
public abstract T getValue(
|
||||
QuickBaseTypeHandlerValueGetter vg,
|
||||
CallType ct,
|
||||
Integer ci,
|
||||
String cn
|
||||
) throws SQLException;
|
||||
|
||||
/**
|
||||
* 抽象方法,用于将 Java 类型 T 设置到 PreparedStatement 中。
|
||||
*
|
||||
* @param ps PreparedStatement 对象
|
||||
* @param index 参数索引位置
|
||||
* @param parameter Java 类型 T 的实例
|
||||
* @param jdbcType JDBC 类型
|
||||
* @throws SQLException SQL 执行异常时抛出
|
||||
*/
|
||||
public abstract void setValue(PreparedStatement ps, int index, T parameter, JdbcType jdbcType) throws SQLException;
|
||||
|
||||
/**
|
||||
* 实现 BaseTypeHandler 的 setNonNullParameter 方法,
|
||||
* 将非空参数设置到 PreparedStatement 中。
|
||||
*
|
||||
* @param ps PreparedStatement 对象
|
||||
* @param i 参数索引位置
|
||||
* @param parameter Java 类型 T 的实例(非空)
|
||||
* @param jdbcType JDBC 类型
|
||||
* @throws SQLException SQL 执行异常时抛出
|
||||
*/
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement ps, int i, T parameter, JdbcType jdbcType) throws SQLException {
|
||||
setValue(ps, i, parameter, jdbcType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 实现 BaseTypeHandler 的 getNullableResult 方法,
|
||||
* 通过列名从 ResultSet 中获取可能为 null 的结果。
|
||||
*
|
||||
* @param rs ResultSet 对象
|
||||
* @param columnName 数据库列名
|
||||
* @return 转换后的 Java 类型 T 实例(可能为 null)
|
||||
* @throws SQLException SQL 执行异常时抛出
|
||||
*/
|
||||
@Override
|
||||
public T getNullableResult(ResultSet rs, String columnName) throws SQLException {
|
||||
return getValue(new QuickBaseTypeHandlerValueGetter(null, rs), CallType.RESULTSET_NAME, null, columnName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 实现 BaseTypeHandler 的 getNullableResult 方法,
|
||||
* 通过列索引从 ResultSet 中获取可能为 null 的结果。
|
||||
*
|
||||
* @param rs ResultSet 对象
|
||||
* @param columnIndex 数据库列索引
|
||||
* @return 转换后的 Java 类型 T 实例(可能为 null)
|
||||
* @throws SQLException SQL 执行异常时抛出
|
||||
*/
|
||||
@Override
|
||||
public T getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
|
||||
return getValue(new QuickBaseTypeHandlerValueGetter(null, rs), CallType.RESULTSET_NAME, columnIndex, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 实现 BaseTypeHandler 的 getNullableResult 方法,
|
||||
* 通过列索引从 CallableStatement 中获取可能为 null 的结果。
|
||||
*
|
||||
* @param cs CallableStatement 对象
|
||||
* @param columnIndex 数据库列索引
|
||||
* @return 转换后的 Java 类型 T 实例(可能为 null)
|
||||
* @throws SQLException SQL 执行异常时抛出
|
||||
*/
|
||||
@Override
|
||||
public T getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
|
||||
return getValue(new QuickBaseTypeHandlerValueGetter(cs, null), CallType.CALLABLE_STATEMENT_INDEX, columnIndex, null);
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Copyright 2025 mingliqiye
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* ProjectName mingli-utils
|
||||
* ModuleName mingli-utils.main
|
||||
* CurrentFile QuickBaseTypeHandlerValueGetter.java
|
||||
* LastUpdate 2025-09-21 21:07:10
|
||||
* UpdateUser MingLiPro
|
||||
*/
|
||||
|
||||
package com.mingliqiye.utils.mybatis;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.ResultSet;
|
||||
|
||||
/**
|
||||
* QuickBaseTypeHandlerValueGetter类用于封装CallableStatement和ResultSet对象的获取操作
|
||||
* 该类提供了对存储过程调用结果和查询结果集的统一访问接口
|
||||
*/
|
||||
public class QuickBaseTypeHandlerValueGetter {
|
||||
private final CallableStatement callableStatement;
|
||||
private final ResultSet resultSet;
|
||||
|
||||
/**
|
||||
* 构造函数,初始化QuickBaseTypeHandlerValueGetter实例
|
||||
*
|
||||
* @param callableStatement 存储过程调用语句对象,用于执行存储过程
|
||||
* @param resultSet 查询结果集对象,用于获取查询结果
|
||||
*/
|
||||
public QuickBaseTypeHandlerValueGetter(CallableStatement callableStatement, ResultSet resultSet) {
|
||||
this.callableStatement = callableStatement;
|
||||
this.resultSet = resultSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取结果集对象
|
||||
*
|
||||
* @return ResultSet 查询结果集对象
|
||||
*/
|
||||
public ResultSet getResultSet() {
|
||||
return resultSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取存储过程调用语句对象
|
||||
*
|
||||
* @return CallableStatement 存储过程调用语句对象
|
||||
*/
|
||||
public CallableStatement getCallableStatement() {
|
||||
return callableStatement;
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright 2025 mingliqiye
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* ProjectName mingli-utils
|
||||
* ModuleName mingli-utils.main
|
||||
* CurrentFile StreamEmptyException.java
|
||||
* LastUpdate 2025-09-20 13:24:07
|
||||
* UpdateUser MingLiPro
|
||||
*/
|
||||
|
||||
package com.mingliqiye.utils.stream;
|
||||
|
||||
public class StreamEmptyException extends java.lang.RuntimeException {
|
||||
|
||||
public StreamEmptyException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public StreamEmptyException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user