All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.envision.utils.SqlUtil Maven / Gradle / Ivy

The newest version!
package com.envision.utils;

import com.envision.sql.SqlHandler;
import org.apache.ibatis.cache.CacheKey;
import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.RowBounds;

import java.sql.SQLException;
import java.util.List;

/**
 * @author qiweishi
 * @date 2018/11/10
 */
public abstract class SqlUtil {

    public static  List query(Executor executor, MappedStatement ms, Object parameter,
                                    RowBounds rowBounds, ResultHandler resultHandler,
                                    BoundSql boundSql, CacheKey cacheKey) throws SQLException {
        //设置sql
        String sql = SqlHandler.tmpSql;
        //处理参数对象
        BoundSql pageBoundSql = new BoundSql(ms.getConfiguration(), sql, boundSql.getParameterMappings(), parameter);
        //执行查询
        return executor.query(ms, parameter, RowBounds.DEFAULT, resultHandler, cacheKey, pageBoundSql);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy