完善泛型类型

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); CacheKey cacheKey = executor.createCacheKey(ms, parameterObject, rowBounds, boundSql);
for (MybatisPreHandler item : preHandlersChain) { for (MybatisPreHandler item : preHandlersChain) {
item.preHandle(targetExecutor, ms, args[1], (RowBounds) args[2], item.preHandle(targetExecutor, ms, args[1], (RowBounds) args[2],
(ResultHandler) args[3], cacheKey, boundSql); (ResultHandler<?>) args[3], cacheKey, boundSql);
} }
} }
Object result = invocation.proceed(); Object result = invocation.proceed();
@ -93,7 +93,7 @@ public class MybatisInterceptor implements Interceptor {
if (preHandlersChain != null && preHandlersChain.size() > 0) { if (preHandlersChain != null && preHandlersChain.size() > 0) {
for (MybatisPreHandler item : preHandlersChain) { for (MybatisPreHandler item : preHandlersChain) {
item.preHandle(targetExecutor, (MappedStatement) args[0], args[1], (RowBounds) args[2], 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(); 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.mapping.MappedStatement;
import org.apache.ibatis.session.ResultHandler; import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.RowBounds;
public interface MybatisPreHandler { public interface MybatisPreHandler {
void preHandle(Executor executor, MappedStatement mappedStatement, Object params, 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; throws Throwable;
} }

View File

@ -43,7 +43,7 @@ public class DataSecurityPreHandler implements MybatisPreHandler {
@Override @Override
public void preHandle(Executor executor, MappedStatement mappedStatement, Object params, RowBounds rowBounds, 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()) { if (SqlContextHolder.isSecurity()) {
Statement sql = parseSql(SqlUtil.parseSql(boundSql.getSql())); Statement sql = parseSql(SqlUtil.parseSql(boundSql.getSql()));
sqlFiled.set(boundSql, sql.toString()); sqlFiled.set(boundSql, sql.toString());

View File

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

View File

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