Commit a956ffe1 authored by 王业雄's avatar 王业雄

jpa分页查询参数fix

parent 04f7f4d5
......@@ -4,14 +4,12 @@ import com.quantgroup.asset.distribution.enums.route.UserLevel;
import com.quantgroup.asset.distribution.enums.route.UserTag;
import com.quantgroup.asset.distribution.model.entity.route.channelroute.ChannelRouteAddVo;
import com.quantgroup.asset.distribution.model.entity.route.channelroute.ChannelRouteQueryVo;
import com.quantgroup.asset.distribution.model.entity.route.channelroute.ChannelRouteSaveVo;
import com.quantgroup.asset.distribution.model.entity.route.channelroute.FundProInfoVo;
import com.quantgroup.asset.distribution.model.entity.route.fundproduct.TypeVo;
import com.quantgroup.asset.distribution.model.response.GlobalResponse;
import com.quantgroup.asset.distribution.service.route.IChannelRouteService;
import com.quantgroup.asset.distribution.util.AllRecords;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestBody;
......
......@@ -11,6 +11,7 @@ import com.quantgroup.asset.distribution.service.route.IChannelRouteService;
import com.quantgroup.asset.distribution.util.AllRecords;
import com.querydsl.core.types.dsl.BooleanExpression;
import com.querydsl.core.types.dsl.Expressions;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
......@@ -26,6 +27,7 @@ import java.util.List;
import java.util.Objects;
@Service
@Slf4j
public class ChannelRouteServiceImpl implements IChannelRouteService {
@Autowired
......@@ -58,7 +60,8 @@ public class ChannelRouteServiceImpl implements IChannelRouteService {
//查询总条数
long count = channelRuleRepository.count(booleanExpression);
//查询数据
Page<ChannelRuleEntity> plantPage = channelRuleRepository.findAll(booleanExpression, new PageRequest(channelRouteQueryVo.getOffset(), channelRouteQueryVo.getPageSize(), new Sort(Sort.Direction.DESC, "createdAt")));
log.info("{},{},{}",channelRouteQueryVo.getOffset(),channelRouteQueryVo.getPageIndex(),channelRouteQueryVo.getPageSize());
Page<ChannelRuleEntity> plantPage = channelRuleRepository.findAll(booleanExpression, new PageRequest(channelRouteQueryVo.getPageIndex()-1, channelRouteQueryVo.getPageSize(), new Sort(Sort.Direction.DESC, "createdAt")));
List<ChannelRuleEntity> channelRuleEntities = new ArrayList<>();
channelRuleEntities = plantPage.getContent();
List<ChannelRouteResultVo> channelRouteResultVos = new ArrayList<>();
......
......@@ -107,7 +107,7 @@ public class FundProductServiceImpl implements IFundProductService {
//查询总条数
long count = fundProductRepository.count(booleanExpression);
//查询数据
Page<FundProductEntity> plantPage = fundProductRepository.findAll(booleanExpression, new PageRequest(fundProductQueryVo.getOffset(), fundProductQueryVo.getPageSize(), new Sort(Sort.Direction.DESC, "createdAt")));
Page<FundProductEntity> plantPage = fundProductRepository.findAll(booleanExpression, new PageRequest(fundProductQueryVo.getPageIndex()-1, fundProductQueryVo.getPageSize(), new Sort(Sort.Direction.DESC, "createdAt")));
List<FundProductEntity> fundProductEntities = new ArrayList<>();
fundProductEntities = plantPage.getContent();
......
......@@ -56,7 +56,7 @@ public class RouteRecordServiceImpl implements IRouteRecordService {
//查询总条数
long count = routingRecordRepository.count(booleanExpression);
//查询数据
Page<RoutingRecordEntity> plantPage = routingRecordRepository.findAll(booleanExpression, new PageRequest(routeRecordQueryVo.getOffset(), routeRecordQueryVo.getPageSize(), new Sort(Sort.Direction.DESC, "createdAt")));
Page<RoutingRecordEntity> plantPage = routingRecordRepository.findAll(booleanExpression, new PageRequest(routeRecordQueryVo.getPageIndex()-1, routeRecordQueryVo.getPageSize(), new Sort(Sort.Direction.DESC, "createdAt")));
List<RoutingRecordEntity> routingRecordEntityList = new ArrayList<>();
routingRecordEntityList = plantPage.getContent();
List<RouteRecordResultVo> routeRecordResultVoList = new ArrayList<>();
......
......@@ -50,7 +50,7 @@ public class WhiteListServiceImpl implements IWhiteListService {
//查询总条数
long count = whiteListRepository.count(booleanExpression);
//查询数据
Page<WhiteListEntity> plantPage = whiteListRepository.findAll(booleanExpression, new PageRequest(whiteListQueryVo.getOffset(), whiteListQueryVo.getPageSize(), new Sort(Sort.Direction.DESC, "createdAt")));
Page<WhiteListEntity> plantPage = whiteListRepository.findAll(booleanExpression, new PageRequest(whiteListQueryVo.getPageIndex()-1, whiteListQueryVo.getPageSize(), new Sort(Sort.Direction.DESC, "createdAt")));
List<WhiteListEntity> whiteListEntityList = new ArrayList<>();
whiteListEntityList = plantPage.getContent();
List<WhiteListResultVo> whiteListResultVoArrayList = new ArrayList<>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment