
com.mybatishelper.core.config.YourResultSetHandler Maven / Gradle / Ivy
package com.mybatishelper.core.config;
import com.mybatishelper.core.base.meta.PageList;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.executor.ErrorContext;
import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.executor.parameter.ParameterHandler;
import org.apache.ibatis.executor.result.DefaultResultHandler;
import org.apache.ibatis.executor.resultset.DefaultResultSetHandler;
import org.apache.ibatis.executor.resultset.ResultSetWrapper;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.ResultMap;
import org.apache.ibatis.reflection.factory.ObjectFactory;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.RowBounds;
import org.apache.ibatis.type.IntegerTypeHandler;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Collections;
import java.util.List;
/**
* copy from mybatis link {@link org.apache.ibatis.executor.resultset.DefaultResultSetHandler}
*/
@Slf4j
public class YourResultSetHandler extends DefaultResultSetHandler {
private final boolean pager;
private final MappedStatement mappedStatement;
private final YourConfiguration configuration;
private final ResultMap pageResultMap;
private final RowBounds rowBounds;
private final ObjectFactory objectFactory;
public YourResultSetHandler(Executor executor, MappedStatement mappedStatement, ParameterHandler parameterHandler, ResultHandler> resultHandler, BoundSql boundSql, RowBounds rowBounds) {
super(executor, mappedStatement, parameterHandler, resultHandler, boundSql, rowBounds);
this.mappedStatement = mappedStatement;
this.configuration = (YourConfiguration) mappedStatement.getConfiguration();
this.pageResultMap = configuration.getPageResultMap(mappedStatement);
this.rowBounds = rowBounds;
this.objectFactory = configuration.getObjectFactory();
this.pager = null != this.pageResultMap;
}
@Override
public List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy