
com.gitee.qdbp.jdbc.stream.SqlOnPagingResultStream Maven / Gradle / Ivy
package com.gitee.qdbp.jdbc.stream;
import org.springframework.jdbc.core.RowMapper;
import com.gitee.qdbp.able.jdbc.paging.PageList;
import com.gitee.qdbp.able.jdbc.paging.Paging;
import com.gitee.qdbp.jdbc.api.SqlDao;
/**
* 分页+结果转换后续操作: 只有list()
*
* @author zhaohuihua
* @version 20210530
*/
public class SqlOnPagingResultStream {
protected final SqlDao dao;
protected final String sqlId;
protected final Object params;
protected final Paging paging;
protected Class resultType;
protected RowMapper rowMapper;
SqlOnPagingResultStream(SqlDao dao, String sqlId, Object params, Paging paging, Class resultType) {
this.dao = dao;
this.sqlId = sqlId;
this.params = params;
this.paging = paging;
this.resultType = resultType;
}
SqlOnPagingResultStream(SqlDao dao, String sqlId, Object params, Paging paging, RowMapper rowMapper) {
this.dao = dao;
this.sqlId = sqlId;
this.params = params;
this.paging = paging;
this.rowMapper = rowMapper;
}
/**
* 查询列表
*
* @return 查询结果列表
*/
public PageList list() {
if (resultType != null) {
return this.dao.pageForObjects(sqlId, params, paging, resultType);
} else {
return this.dao.pageForObjects(sqlId, params, paging, rowMapper);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy