本文整理汇总了Java中org.apache.ibatis.session.RowBounds类的典型用法代码示例。如果您正苦于以下问题:Java RowBounds类的具体用法?Java RowBounds怎么用?Java RowBounds使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RowBounds类属于org.apache.ibatis.session包,在下文中一共展示了RowBounds类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findByParams
import org.apache.ibatis.session.RowBounds; //导入依赖的package包/类
/**
* 分页查询
* @param user
* @param pageNo
* @param limit
* @return
*/
@Override
public Page<UUser> findByParams(UUser user, int pageNo, int limit) {
Page<UUser> page = new Page<UUser>();
page.setPageNo(pageNo);
page.setLimit(limit);
int offset = page.getOffsets();
RowBounds rowBound = new RowBounds(offset, limit);
List<UUser> users = userRolePermissionDao.findByParams(user,rowBound);
page.setRows(users);
int total = userRolePermissionDao.findAllCount(user) ;
page.setTotal(total) ;
if(offset >= page.getTotal()){
page.setPageNo(page.getTotalPages());
}
return page ;
}
示例2: main
import org.apache.ibatis.session.RowBounds; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
SqlSession sqlSession = MybatisHelper.getSqlSession();
CountryMapper countryMapper = sqlSession.getMapper(CountryMapper.class);
/*rowBounds*/
RowBounds rowBounds = new RowBounds(2, 5);
/*Example*/
Example example = new Example(Country.class);
Example.Criteria criteria = example.createCriteria();
// criteria.andCountrycodeBetween("0", "ZZZZZZZZZZ");
// criteria.andIdBetween(0, 20);
List<Country> countries1 = countryMapper.selectByExample(example);
log.debug("countries1" + countries1.size());
List<Country> countries2 = countryMapper.selectByExampleAndRowBounds(example, rowBounds);
log.debug("countries2" + countries2.size());
PageInfo<Country> pageInfo = new PageInfo<>(countries1);
System.out.println("PageHelperTest.main() pageInfo :" + pageInfo.getSize());
}
示例3: getPage
import org.apache.ibatis.session.RowBounds; //导入依赖的package包/类
/**
* 获取分页参数
*
* @param rowBounds
* RowBounds参数
* @return 返回Page对象
*/
private Page getPage(RowBounds rowBounds) {
Page page = LOCAL_PAGE.get();
// 移除本地变量
LOCAL_PAGE.remove();
if (page == null) {
if (offsetAsPageNum) {
page = new Page(rowBounds.getOffset(), rowBounds.getLimit(), rowBoundsWithCount);
} else {
page = new Page(rowBounds, rowBoundsWithCount);
}
}
// 分页合理化
if (page.getReasonable() == null) {
page.setReasonable(reasonable);
}
// 当设置为true的时候,如果pagesize设置为0(或RowBounds的limit=0),就不执行分页,返回全部结果
if (page.getPageSizeZero() == null) {
page.setPageSizeZero(pageSizeZero);
}
return page;
}
示例4: getParameterType
import org.apache.ibatis.session.RowBounds; //导入依赖的package包/类
private Class<?> getParameterType(Method method) {
Class<?> parameterType = null;
Class<?>[] parameterTypes = method.getParameterTypes();
for (Class<?> currentParameterType : parameterTypes) {
if (!RowBounds.class.isAssignableFrom(currentParameterType)
&& !ResultHandler.class.isAssignableFrom(currentParameterType)) {
if (parameterType == null) {
parameterType = currentParameterType;
} else {
// issue #135
parameterType = ParamMap.class;
}
}
}
return parameterType;
}
示例5: main
import org.apache.ibatis.session.RowBounds; //导入依赖的package包/类
public static void main(String[] args) {
/*
* 加载配置文件
*/
InputStream in = NoXMLTest.class.getClassLoader().getResourceAsStream("mysql-config.xml");
MybatisSessionFactoryBuilder mf = new MybatisSessionFactoryBuilder();
SqlSessionFactory sessionFactory = mf.build(in);
SqlSession sqlSession = sessionFactory.openSession();
/**
* 查询是否有结果
*/
TestMapper testMapper = sqlSession.getMapper(TestMapper.class);
testMapper.insert(new Test(IdWorker.getId(), "Caratacus"));
List<Map<String, Object>> list = testMapper.selectMaps(null);
List<Map<String, Object>> list1 = testMapper.selectMapsPage(RowBounds.DEFAULT, null);
List<Map<String, Object>> list2 = testMapper.selectMapsPage(new Page<>(1, 5), null);
System.out.println(list);
System.out.println(list1);
System.out.println(list2);
testMapper.delete(null);
}
示例6: selectMaxChangeSetIdBeforeCommitTime
import org.apache.ibatis.session.RowBounds; //导入依赖的package包/类
@Override
protected Long selectMaxChangeSetIdBeforeCommitTime(long maxCommitTime)
{
Assert.notNull(maxCommitTime, "maxCommitTime");
Map<String, Object> params = new HashMap<String, Object>(1);
params.put("commit_time_ms", maxCommitTime);
List<Long> sets = template.selectList(SELECT_CHANGE_SET_LAST, params, new RowBounds(0, 1));
if (sets.size() > 0)
{
return sets.get(0);
}
else
{
return null;
}
}
示例7: findStringValueByValue
import org.apache.ibatis.session.RowBounds; //导入依赖的package包/类
@Override
protected Long findStringValueByValue(String value)
{
PropertyStringValueEntity entity = new PropertyStringValueEntity();
entity.setValue(value);
List<Long> rows = template.selectList(
SELECT_PROPERTY_STRING_VALUE_BY_VALUE,
entity,
new RowBounds(0, 1));
// The CRC match prevents incorrect results from coming back. Although there could be
// several matches, we are sure that the matches are case-sensitive.
if (rows.size() > 0)
{
return rows.get(0);
}
else
{
return null;
}
}
示例8: selectPosts
import org.apache.ibatis.session.RowBounds; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public List<ActivityPostEntity> selectPosts(ActivityPostEntity activityPost, int maxItems) throws SQLException
{
int rowLimit = maxItems < 0 ? RowBounds.NO_ROW_LIMIT : maxItems;
RowBounds rowBounds = new RowBounds(RowBounds.NO_ROW_OFFSET, rowLimit);
if ((activityPost.getJobTaskNode() != -1) &&
(activityPost.getMinId() != -1) &&
(activityPost.getMaxId() != -1) &&
(activityPost.getStatus() != null))
{
return template.selectList("alfresco.activities.select_activity_posts_by_params", activityPost, rowBounds);
}
else if (activityPost.getStatus() != null)
{
return template.selectList("alfresco.activities.select_activity_posts_by_status", activityPost, rowBounds);
}
else
{
return new ArrayList<ActivityPostEntity>(0);
}
}
示例9: getContentUrlsKeepOrphaned
import org.apache.ibatis.session.RowBounds; //导入依赖的package包/类
@Override
public void getContentUrlsKeepOrphaned(
final ContentUrlHandler contentUrlHandler,
final int maxResults)
{
List<ContentUrlEntity> results = template.selectList(SELECT_CONTENT_URLS_KEEP_ORPHANED,
new RowBounds(0, maxResults));
// Pass the result to the callback
for (ContentUrlEntity result : results)
{
contentUrlHandler.handle(
result.getId(),
result.getContentUrl(),
result.getOrphanTime());
}
}
示例10: getAclChangeSets
import org.apache.ibatis.session.RowBounds; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("unchecked")
public List<AclChangeSet> getAclChangeSets(Long minAclChangeSetId, Long fromCommitTime, Long maxAclChangeSetId, Long toCommitTime, int maxResults)
{
if (maxResults <= 0 || maxResults == Integer.MAX_VALUE)
{
throw new IllegalArgumentException("Maximum results must be a reasonable number.");
}
// We simulate an ID for the sys:deleted type
Pair<Long, QName> deletedTypeQNamePair = qnameDAO.getQName(ContentModel.TYPE_DELETED);
Long deletedTypeQNameId = deletedTypeQNamePair == null ? -1L : deletedTypeQNamePair.getFirst();
SOLRTrackingParameters params = new SOLRTrackingParameters(deletedTypeQNameId);
params.setFromIdInclusive(minAclChangeSetId);
params.setFromCommitTimeInclusive(fromCommitTime);
params.setToIdExclusive(maxAclChangeSetId);
params.setToCommitTimeExclusive(toCommitTime);
return template.selectList(SELECT_CHANGESETS_SUMMARY, params, new RowBounds(0, maxResults));
}
示例11: getTransactions
import org.apache.ibatis.session.RowBounds; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("unchecked")
public List<Transaction> getTransactions(Long minTxnId, Long fromCommitTime, Long maxTxnId, Long toCommitTime, int maxResults)
{
if (maxResults <= 0 || maxResults == Integer.MAX_VALUE)
{
throw new IllegalArgumentException("Maximum results must be a reasonable number.");
}
// We simulate an ID for the sys:deleted type
Pair<Long, QName> deletedTypeQNamePair = qnameDAO.getQName(ContentModel.TYPE_DELETED);
Long deletedTypeQNameId = deletedTypeQNamePair == null ? -1L : deletedTypeQNamePair.getFirst();
SOLRTrackingParameters params = new SOLRTrackingParameters(deletedTypeQNameId);
params.setFromIdInclusive(minTxnId);
params.setFromCommitTimeInclusive(fromCommitTime);
params.setToIdExclusive(maxTxnId);
params.setToCommitTimeExclusive(toCommitTime);
return template.selectList(SELECT_TRANSACTIONS, params, new RowBounds(0, maxResults));
}
示例12: selectChildNodeIds
import org.apache.ibatis.session.RowBounds; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected List<ChildAssocEntity> selectChildNodeIds(
Long nodeId,
Boolean isPrimary,
Long minChildNodeIdInclusive,
int maxResults)
{
ChildAssocEntity assoc = new ChildAssocEntity();
NodeEntity parentNode = new NodeEntity();
parentNode.setId(nodeId);
NodeEntity childNode = new NodeEntity();
childNode.setId(minChildNodeIdInclusive);
assoc.setParentNode(parentNode);
assoc.setPrimary(isPrimary);
assoc.setChildNode(childNode);
RowBounds rowBounds = new RowBounds(0, maxResults);
return template.selectList(SELECT_CHILD_NODE_IDS, assoc, rowBounds);
}
示例13: selectLastTxnBeforeCommitTime
import org.apache.ibatis.session.RowBounds; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected Transaction selectLastTxnBeforeCommitTime(Long maxCommitTime)
{
Assert.notNull(maxCommitTime, "maxCommitTime");
TransactionQueryEntity query = new TransactionQueryEntity();
query.setMaxCommitTime(maxCommitTime);
List<Transaction> txns = template.selectList(SELECT_TXN_LAST, query, new RowBounds(0, 1));
if (txns.size() > 0)
{
return txns.get(0);
}
else
{
return null;
}
}
示例14: selectTxnsUnused
import org.apache.ibatis.session.RowBounds; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected List<Long> selectTxnsUnused(Long minTxnId, Long maxCommitTime, Integer count)
{
TransactionQueryEntity query = new TransactionQueryEntity();
query.setMinId(minTxnId);
query.setMaxCommitTime(maxCommitTime);
if (count == null)
{
return template.selectList(SELECT_TXNS_UNUSED, query);
}
else
{
return template.selectList(SELECT_TXNS_UNUSED, query, new RowBounds(0, count));
}
}
示例15: list
import org.apache.ibatis.session.RowBounds; //导入依赖的package包/类
public List<SnsTodoDetailDO> list(String userName, Boolean finished, Integer pageNum, Integer pageSize) {
SnsTodoDetailDOExample example = new SnsTodoDetailDOExample();
SnsTodoDetailDOExample.Criteria criteria = example.createCriteria();
criteria.andUsernameEqualTo(userName);
if (finished != null) {
if (finished) {
criteria.andFinishedEqualTo(true);
} else {
criteria.andFinishedEqualTo(false);
}
}
criteria.andStatusEqualTo(Flag.UniversalFlag.NORMAL);
example.setOrderByClause(" weight desc,create_time desc ");
return snsTodoDetailDOMapper.selectByExampleAndRowBounds(example, new RowBounds(pageNum, pageSize));
}