本文整理了Java中com.github.pagehelper.PageHelper.orderBy()
方法的一些代码示例,展示了PageHelper.orderBy()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。PageHelper.orderBy()
方法的具体详情如下:
包路径:com.github.pagehelper.PageHelper
类名称:PageHelper
方法名:orderBy
暂无
代码示例来源:origin: souyunku/SpringBootExamples
@Override
public <T> List<T> selectList(String statementPostfix, Object entity, String orderBy) {
if (!StringUtils.isEmpty(orderBy)) {
PageHelper.orderBy(orderBy);
}
return getSqlSession().selectList(statementPostfix, entity);
}
代码示例来源:origin: souyunku/Picture-Bed
@Override
public <T> List<T> selectList(String statementPostfix, Object entity, String orderBy) {
if (!StringUtils.isEmpty(orderBy)) {
PageHelper.orderBy(orderBy);
}
return getSqlSession().selectList(statementPostfix, entity);
}
代码示例来源:origin: com.intoverflow.booster/booster-core
private void orderBy(Sort sort) {
if (sort != null) {
Iterator<Sort.Order> iter = sort.iterator();
StringBuilder orderby = new StringBuilder();
while (iter.hasNext()) {
Sort.Order order = iter.next();
if (orderby.length() > 0) {
orderby.append(", ");
}
String property = order.getProperty();
orderby.append(property).append(" ")
.append(order.getDirection().name().toLowerCase());
}
if (orderby.length() > 0) {
PageHelper.orderBy(orderby.toString());
}
}
}
代码示例来源:origin: com.intoverflow.booster/booster-core
protected void orderBy(Sort sort) {
if (sort != null) {
Iterator<Sort.Order> iter = sort.iterator();
StringBuilder orderby = new StringBuilder();
while (iter.hasNext()) {
Sort.Order order = iter.next();
if (orderby.length() > 0) {
orderby.append(", ");
}
String property = order.getProperty();
property = convertPropertyToColumn(entityClass, property);
orderby.append(property).append(" ")
.append(order.getDirection().name().toLowerCase());
}
if (orderby.length() > 0) {
PageHelper.orderBy(orderby.toString());
}
}
}
代码示例来源:origin: com.intoverflow.booster/booster-core
protected void orderBy(Sort sort) {
if (sort != null) {
Iterator<Sort.Order> iter = sort.iterator();
StringBuilder orderby = new StringBuilder();
while (iter.hasNext()) {
Sort.Order order = iter.next();
if (orderby.length() > 0) {
orderby.append(", ");
}
String property = order.getProperty();
property = PersistentRecognizer.propertyToColumn(entityClass, property);
orderby.append(property).append(" ")
.append(order.getDirection().name().toLowerCase());
}
if (orderby.length() > 0) {
PageHelper.orderBy(orderby.toString());
}
}
}
代码示例来源:origin: souyunku/SpringBootExamples
@Override
public <T> List<T> selectList(String statementPostfix, Object entity, int pageNum, int pageSize, String orderBy) {
PageHelper.startPage(pageNum, pageSize, false);
if (!StringUtils.isEmpty(orderBy)) {
PageHelper.orderBy(orderBy);
}
List<T> list = getSqlSession().selectList(statementPostfix, entity);
return list;
}
代码示例来源:origin: souyunku/Picture-Bed
@Override
public <T> List<T> selectList(String statementPostfix, Object entity, int pageNum, int pageSize, String orderBy) {
PageHelper.startPage(pageNum, pageSize, false);
if (!StringUtils.isEmpty(orderBy)) {
PageHelper.orderBy(orderBy);
}
List<T> list = getSqlSession().selectList(statementPostfix, entity);
return list;
}
代码示例来源:origin: souyunku/SpringBootExamples
@Override
public <T> QueryResult<T> selectListAndCount(String statementPostfix, Object entity, int pageNum, int pageSize, String orderBy) {
Page<?> page = PageHelper.startPage(pageNum, pageSize);
if (!StringUtils.isEmpty(orderBy)) {
PageHelper.orderBy(orderBy);
}
List<T> list = getSqlSession().selectList(statementPostfix, entity);
QueryResult<T> result = new QueryResult<>(list, page.getTotal());
return result;
}
代码示例来源:origin: souyunku/Picture-Bed
@Override
public <T> QueryResult<T> selectListAndCount(String statementPostfix, Object entity, int pageNum, int pageSize, String orderBy) {
Page<?> page = PageHelper.startPage(pageNum, pageSize);
if (!StringUtils.isEmpty(orderBy)) {
PageHelper.orderBy(orderBy);
}
List<T> list = getSqlSession().selectList(statementPostfix, entity);
QueryResult<T> result = new QueryResult<>(list, page.getTotal());
return result;
}
代码示例来源:origin: okhelperTeam/okhelper-service
PageHelper.orderBy(pageModel.getOrderBy());
代码示例来源:origin: okhelperTeam/okhelper-service
PageHelper.orderBy("total_stock");
代码示例来源:origin: okhelperTeam/okhelper-service
@Override
public PageModel<Supplier> getSupplierList(PageModel pageModel) {
logger.info("Enter method getSupplierList()");
//启动分页
PageHelper.startPage(pageModel.getPageNum(), pageModel.getLimit());
//启动排序
PageHelper.orderBy(pageModel.getOrderBy());
Long storeId = JWTUtil.getStoreId();
if(storeId == null){
throw new IllegalException("参数异常");
}
List<Supplier> supplierList = supplierMapper.getSupplierByStoreId(storeId);
PageInfo<Supplier> pageInfo = new PageInfo<>(supplierList);
logger.info("Exit method getSupplierList() Params:"+pageInfo);
return PageModel.convertToPageModel(pageInfo);
}
代码示例来源:origin: okhelperTeam/okhelper-service
PageHelper.orderBy(pageModel.getOrderBy());
代码示例来源:origin: okhelperTeam/okhelper-service
@Override
public PageModel<SaleOrder> getUnSendOrder(PageModel pageModel) {
//启动分页
PageHelper.startPage(pageModel.getPageNum(), pageModel.getLimit());
//启动排序
PageHelper.orderBy(pageModel.getOrderBy());
List<SaleOrder> unSendOrder = saleOrderMapper.getUnSendOrder(JWTUtil.getStoreId());
if(CollectionUtils.isEmpty(unSendOrder)){
throw new NotFoundException("没有未发货订单");
}
PageInfo pageInfo=new PageInfo();
return null;
}
}
代码示例来源:origin: okhelperTeam/okhelper-service
@Override
public PageModel<ProductsVo> getProductsList(String condition, PageModel pageModel) {
logger.info(" Enter getProductsList() params:" + condition);
//启动分页
PageHelper.startPage(pageModel.getPageNum(), pageModel.getLimit());
//启动排序
PageHelper.orderBy(pageModel.getOrderBy());
List<ProductsVo> productsVos = null;
Long storeId = JWTUtil.getStoreId();
if (storeId == null) {
throw new AuthenticationException("登陆异常");
}
productsVos = productMapper.getProductsList(condition, storeId);
PageInfo<ProductsVo> pageInfo = new PageInfo<>(productsVos);
logger.info("Exit method getProductsList() return:" + pageInfo);
return PageModel.convertToPageModel(pageInfo);
}
代码示例来源:origin: okhelperTeam/okhelper-service
PageHelper.orderBy(pageModel.getOrderBy());
代码示例来源:origin: cjbi/wetech-admin
@Override
public PageResultSet<RoleDto> findByPage(RoleQuery roleQuery) {
PageHelper.offsetPage(roleQuery.getOffset(), roleQuery.getLimit());
if(!StringUtils.isEmpty(roleQuery.getOrderBy())) {
PageHelper.orderBy(roleQuery.getOrderBy());
}
Weekend<Role> example = Weekend.of(Role.class);
WeekendCriteria<Role, Object> criteria = example.weekendCriteria();
if(!StringUtils.isEmpty(roleQuery.getRole())) {
criteria.andLike(Role::getRole,"%" + roleQuery.getRole() + "%");
}
if(!StringUtils.isEmpty(roleQuery.getDescription())) {
criteria.andLike(Role::getDescription,"%" + roleQuery.getDescription() + "%");
}
PageResultSet<RoleDto> resultSet = new PageResultSet<>();
List<RoleDto> dtoList = new ArrayList<>();
roleMapper.selectByExample(example).forEach(r -> {
RoleDto dto = new RoleDto(r);
dto.setResourceNames(getResourceNames(r.getResourceIdList()));
dtoList.add(dto);
});
long total = roleMapper.selectCountByExample(example);
resultSet.setRows(dtoList);
resultSet.setTotal(total);
return resultSet;
}
代码示例来源:origin: okhelperTeam/okhelper-service
@Override
public PageModel<Customer> getCustomerList(CustomerConditionDto customerConditionDto,PageModel pageModel) {
//启动分页
PageHelper.startPage(pageModel.getPageNum(), pageModel.getLimit());
//启动排序
PageHelper.orderBy(pageModel.getOrderBy());
Customer customer = new Customer();
customer.setStoreId(JWTUtil.getStoreId());
customer.setDeleteStatus(ConstEnum.STATUSENUM_AVAILABLE.getCode());
BeanUtils.copyProperties(customerConditionDto,customer);
List<Customer> customers = customerMapper.select(customer);
PageInfo<Customer> pageInfo = new PageInfo<>(customers);
return PageModel.convertToPageModel(pageInfo);
}
代码示例来源:origin: cjbi/wetech-admin
@Override
public PageResultSet<Group> findByPage(GroupQuery groupQuery) {
if (!StringUtils.isEmpty(groupQuery.getOrderBy())) {
PageHelper.orderBy(groupQuery.getOrderBy());
}
Weekend<Group> weekend = Weekend.of(Group.class);
WeekendCriteria<Group, Object> criteria = weekend.weekendCriteria();
if (!StringUtils.isEmpty(groupQuery.getName())) {
criteria.andLike(Group::getName, groupQuery.getName());
}
PageResultSet<Group> resultSet = new PageResultSet<>();
Page page = PageHelper.offsetPage(groupQuery.getOffset(), groupQuery.getLimit()).doSelectPage(() -> groupMapper.selectByExample(weekend));
resultSet.setRows(page);
resultSet.setTotal(page.getTotal());
return resultSet;
}
代码示例来源:origin: cjbi/wetech-admin
@Override
public PageResultSet<UserDto> findByPage(UserQuery userQuery) {
if(!StringUtils.isEmpty(userQuery.getOrderBy())) {
PageHelper.orderBy(userQuery.getOrderBy());
}
Weekend<User> example = Weekend.of(User.class);
WeekendCriteria<User, Object> criteria = example.weekendCriteria();
if (!StringUtils.isEmpty(userQuery.getUsername())) {
criteria.andLike(User::getUsername, "%" + userQuery.getUsername() + "%");
}
if(userQuery.getLocked() != null) {
criteria.andEqualTo(User::getLocked,userQuery.getLocked());
}
List<UserDto> dtoList = new ArrayList<>();
PageHelper.offsetPage(userQuery.getOffset(), userQuery.getLimit());
userMapper.selectByExample(example).forEach(u -> {
UserDto dto = new UserDto(u);
dto.setOrganizationName(getOrganizationName(Long.valueOf(dto.getOrganizationId())));
dto.setRoleNames(getRoleNames(dto.getRoleIdList()));
dto.setGroupNames(getGroupNames(dto.getGroupIdList()));
dtoList.add(dto);
});
long total = userMapper.selectCountByExample(example);
PageResultSet<UserDto> resultSet = new PageResultSet<>();
resultSet.setRows(dtoList);
resultSet.setTotal(total);
return resultSet;
}
内容来源于网络,如有侵权,请联系作者删除!