完善泛型类型

This commit is contained in:
dftre 2024-09-29 13:00:45 +08:00
parent ab81a18586
commit 643e22dc24
5 changed files with 7 additions and 8 deletions

View File

@ -79,7 +79,7 @@ public class MybatisInterceptor implements Interceptor {
CacheKey cacheKey = executor.createCacheKey(ms, parameterObject, rowBounds, boundSql);
for (MybatisPreHandler item : preHandlersChain) {
item.preHandle(targetExecutor, ms, args[1], (RowBounds) args[2],
(ResultHandler) args[3], cacheKey, boundSql);
(ResultHandler<?>) args[3], cacheKey, boundSql);
}
}
Object result = invocation.proceed();
@ -93,7 +93,7 @@ public class MybatisInterceptor implements Interceptor {
if (preHandlersChain != null && preHandlersChain.size() > 0) {
for (MybatisPreHandler item : preHandlersChain) {
item.preHandle(targetExecutor, (MappedStatement) args[0], args[1], (RowBounds) args[2],
(ResultHandler) args[3], (CacheKey) args[4], (BoundSql) args[5]);
(ResultHandler<?>) args[3], (CacheKey) args[4], (BoundSql) args[5]);
}
}
Object result = invocation.proceed();

View File

@ -6,10 +6,9 @@ import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.RowBounds;
public interface MybatisPreHandler {
void preHandle(Executor executor, MappedStatement mappedStatement, Object params,
RowBounds rowBounds, ResultHandler resultHandler, CacheKey cacheKey, BoundSql boundSql)
RowBounds rowBounds, ResultHandler<?> resultHandler, CacheKey cacheKey, BoundSql boundSql)
throws Throwable;
}

View File

@ -43,7 +43,7 @@ public class DataSecurityPreHandler implements MybatisPreHandler {
@Override
public void preHandle(Executor executor, MappedStatement mappedStatement, Object params, RowBounds rowBounds,
ResultHandler resultHandler, CacheKey cacheKey, BoundSql boundSql) throws Throwable {
ResultHandler<?> resultHandler, CacheKey cacheKey, BoundSql boundSql) throws Throwable {
if (SqlContextHolder.isSecurity()) {
Statement sql = parseSql(SqlUtil.parseSql(boundSql.getSql()));
sqlFiled.set(boundSql, sql.toString());

View File

@ -17,7 +17,7 @@ public class PageAfterHandler implements MybatisAfterHandler {
public Object handleObject(Object object) throws Throwable {
if (PageContextHolder.isPage()) {
if (object instanceof List) {
TableInfo tableInfo = new TableInfo<>((List) object);
TableInfo<Object> tableInfo = new TableInfo<Object>((List<?>) object);
tableInfo.setTotal(PageContextHolder.getTotal());
PageContextHolder.clear();
return tableInfo;

View File

@ -44,7 +44,7 @@ public class PagePreHandler implements MybatisPreHandler {
@Override
public void preHandle(Executor executor, MappedStatement mappedStatement, Object params, RowBounds rowBounds,
ResultHandler resultHandler, CacheKey cacheKey, BoundSql boundSql) throws Throwable {
ResultHandler<?> resultHandler, CacheKey cacheKey, BoundSql boundSql) throws Throwable {
if (PageContextHolder.isPage()) {
String originSql = boundSql.getSql();
Statement sql = SqlUtil.parseSql(originSql);
@ -95,7 +95,7 @@ public class PagePreHandler implements MybatisPreHandler {
}
public static Long getCount(Executor executor, MappedStatement mappedStatement, Object parameter,
BoundSql boundSql, RowBounds rowBounds, ResultHandler resultHandler, String countSql)
BoundSql boundSql, RowBounds rowBounds, ResultHandler<?> resultHandler, String countSql)
throws SQLException {
Map<String, Object> additionalParameters = boundSql.getAdditionalParameters();