List of usage examples for org.apache.ibatis.session RowBounds RowBounds
public RowBounds(int offset, int limit)
From source file:co.com.xoftix.spaservicios.servicios.ge.impl.DistritoServicioImpl.java
@Override public List<Distrito> consultar(Distrito entidad, int desde, int hasta) throws Exception { return distritoMapper.consultar(entidad, new RowBounds(desde, hasta)); }
From source file:co.com.xoftix.spaservicios.servicios.ge.impl.ProvinciaServicioImpl.java
@Override public List<Provincia> consultar(Provincia entidad, int desde, int hasta) throws Exception { return provinciaMapper.consultar(entidad, new RowBounds(desde, hasta)); }
From source file:com.acube.common.domain.jqgrid.GridRequest.java
License:Apache License
public RowBounds getRowBounds() { int offset = 0; if (this.getPageNumber() >= 1) { offset = (this.getPageNumber() - 1) * this.getPageSize(); }/*from w w w .j a va 2 s. co m*/ int limit = this.getPageSize(); return new RowBounds(offset, limit); }
From source file:com.comodin.fleet.service.impl.VehicleService.java
@Override public List<VehicleBean> getListByVo(VehicleBeanVo vo) { log.info("service getListByVo request parameters vo JSON: " + JSON.toJSONString(vo)); if (vo == null) { log.error("request parameter error, check vo is null"); throw new ParameterException("Query parameter error, check vo is null"); }/*w w w . jav a2 s . c o m*/ if (vo.getStart() == null || vo.getLength() == null) { log.error( "request parameter error, check paging start:" + vo.getStart() + " length: " + vo.getLength()); throw new ParameterException( "Query parameter error, check paging start:" + vo.getStart() + " length: " + vo.getLength()); } Example example = new Example(VehicleBean.class); Example.Criteria criteria = example.createCriteria(); if (StringUtils.isNotBlank(vo.getName())) { criteria.andLike("name", FleetBasiUtil.likePercent(vo.getName().trim())); } if (StringUtils.isNotBlank(vo.getLicensePlate())) { criteria.andLike("licensePlate", FleetBasiUtil.likePercent(vo.getLicensePlate().trim())); } if (vo.getLocationDeviceId() != null) { criteria.andLike("locationDeviceId", FleetBasiUtil.likePercent(vo.getLocationDeviceId().toString().trim())); } if (StringUtils.isNotBlank(vo.getStatus())) { criteria.andEqualTo("status", vo.getStatus().trim()); } if (StringUtils.isNotBlank(vo.getCreateDataTimeStartTime())) { criteria.andGreaterThanOrEqualTo("createDateTime", vo.getCreateDataTimeStartTime().trim()); } if (StringUtils.isNotBlank(vo.getCreateDataTimeEndTime())) { criteria.andLessThanOrEqualTo("createDateTime", vo.getCreateDataTimeEndTime().trim()); } criteria.andEqualTo("deleteFlag", ConstantsFinalValue.DELETE_FLAG_NORMAL); return mapper.selectByExampleAndRowBounds(example, new RowBounds(vo.getStart(), vo.getLength())); }
From source file:com.eryansky.common.orm.mybatis.interceptor.PaginationInterceptor.java
License:Apache License
@Override public Object intercept(Invocation invocation) throws Throwable { final MappedStatement mappedStatement = (MappedStatement) invocation.getArgs()[0]; // //?SQL //// if (mappedStatement.getId().matches(_SQL_PATTERN)) { // if (StringUtils.indexOfIgnoreCase(mappedStatement.getId(), _SQL_PATTERN) != -1) { Object parameter = invocation.getArgs()[1]; BoundSql boundSql = mappedStatement.getBoundSql(parameter); Object parameterObject = boundSql.getParameterObject(); //??// w w w.j av a2 s.c o m Page<Object> page = null; if (parameterObject != null) { page = convertParameter(parameterObject, page); } // if (page != null && page.getPageSize() != -1) { if (StringUtils.isBlank(boundSql.getSql())) { return null; } String originalSql = boundSql.getSql().trim(); if (log.isDebugEnabled()) { log.debug("SQL:" + originalSql); } // page.setTotalCount( SQLHelper.getCount(originalSql, null, mappedStatement, parameterObject, boundSql, log)); Dialect dialect = DIALECT; //? String dbName = convertDbNameParameter(parameterObject); if (StringUtils.isNotBlank(dbName)) { dialect = getDialect(dbName); } // ?? String pageSql = SQLHelper.generatePageSql(originalSql, page, dialect); if (log.isDebugEnabled()) { log.debug("PAGE SQL:" + StringUtils.replace(pageSql, "\n", "")); } invocation.getArgs()[2] = new RowBounds(RowBounds.NO_ROW_OFFSET, RowBounds.NO_ROW_LIMIT); BoundSql newBoundSql = new BoundSql(mappedStatement.getConfiguration(), pageSql, boundSql.getParameterMappings(), boundSql.getParameterObject()); MappedStatement newMs = copyFromMappedStatement(mappedStatement, new BoundSqlSqlSource(newBoundSql)); invocation.getArgs()[0] = newMs; } // } return invocation.proceed(); }
From source file:com.eryansky.common.orm.mybatis.MyBatisSuportDao.java
License:Apache License
/** * ?/* w w w.j a va 2 s. c o m*/ * * @param key * @param offset * ??? * @param limit * ?? * @param params * ? (Map<String,Object>) * @return List<T> * @date 2012-7-29 ?1:35:32 */ public <T> List<T> getList(String key, int offset, int limit, Object params) { return getSqlSession().selectList(key, params, new RowBounds(offset, limit)); }
From source file:com.eryansky.common.orm.mybatis.MyBatisSuportDao.java
License:Apache License
/** * ?/*w ww. ja v a2s . c o m*/ * * @param key * @param page * @param params * ? (Map<String,Object>) * @return Page<T> * @date 2012-7-29 ?3:50:26 */ public <T> Page<T> getPage(String key, Page<T> page, Object params) { int offset = Page.countOffset(page.getPageSize(), page.getPageNo()); List<T> list = getList(key, params); if (!list.isEmpty() && list.size() > 0) { page.setTotalCount(list.size()); } page.setTotalPage(Page.countTotalPage(page.getPageSize(), page.getTotalCount())); List<T> result = getSqlSession().selectList(key, params, new RowBounds(offset, page.getPageSize())); page.setResult(result); return page; }
From source file:com.eryansky.common.orm.mybatis.proxy.PaginationMapperMethod.java
License:Apache License
/** * ?/*from w w w .ja v a 2s .c om*/ * * @param args ?? * @return */ @SuppressWarnings("unchecked") public Object execute(Object[] args) { final Object param = getParam(args); Page<Object> page; RowBounds rowBounds; if (paginationIndex != null) { page = (Page<Object>) args[paginationIndex]; rowBounds = new RowBounds(page.getFirstResult(), page.getMaxResults()); } else if (rowBoundsIndex != null) { rowBounds = (RowBounds) args[rowBoundsIndex]; page = new Page<Object>(); } else { throw new BindingException( "Invalid bound statement (not found rowBounds or pagination in paramenters)"); } page.setTotalCount(executeForCount(param)); page.setResult(executeForList(param, rowBounds)); return page; }
From source file:com.esofthead.mycollab.common.service.ibatis.TagServiceImpl.java
License:Open Source License
@Override public List<AggregateTag> findTagsInProject(Integer projectId, @CacheKey Integer accountId) { TagSearchCriteria searchCriteria = new TagSearchCriteria(); searchCriteria.setSaccountid(NumberSearchField.and(accountId)); searchCriteria.setProjectId(NumberSearchField.and(projectId)); return tagMapperExt.findPagableListByCriteria(searchCriteria, new RowBounds(0, Integer.MAX_VALUE)); }
From source file:com.esofthead.mycollab.core.persistence.service.DefaultSearchService.java
License:Open Source License
@Override public List findPagableListByCriteria(SearchRequest<S> searchRequest) { return getSearchMapper().findPagableListByCriteria(searchRequest.getSearchCriteria(), new RowBounds((searchRequest.getCurrentPage() - 1) * searchRequest.getNumberOfItems(), searchRequest.getNumberOfItems())); }