| | |
| | | @PostMapping(value = "/list") |
| | | public R<Page<TInformation>> list(@RequestBody InformationQuery informationQuery) { |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | |
| | | Page<TInformation> page = informationService.lambdaQuery() |
| | | .like(!StringUtils.isEmpty(informationQuery.getInformationName()), TInformation::getInformationName, informationQuery.getInformationName()) |
| | | .eq(informationQuery.getRegionId() != null, TInformation::getRegionId, informationQuery.getRegionId()) |
| | | .eq(informationQuery.getTechnicalId() != null, TInformation::getTechnicalId, informationQuery.getTechnicalId()) |
| | | .eq(informationQuery.getMajorId() != null, TInformation::getMajorId, informationQuery.getMajorId()) |
| | | .eq(informationQuery.getLevel() != null, TInformation::getLevel, informationQuery.getLevel()) |
| | | .eq(informationQuery.getFree()!=null&&informationQuery.getFree() == 1, TInformation::getInformationPrice, BigDecimal.ZERO) |
| | | .ne(informationQuery.getFree()!=null&&informationQuery.getFree() == 2, TInformation::getInformationPrice, BigDecimal.ZERO) |
| | | .orderByDesc(TInformation::getCommitteeSort) |
| | | .page(Page.of(informationQuery.getPageNum(), informationQuery.getPageSize())); |
| | | Page<TInformation> page; |
| | | if (informationQuery.getSortType()==1){ |
| | | page = informationService.lambdaQuery() |
| | | .like(!StringUtils.isEmpty(informationQuery.getInformationName()), TInformation::getInformationName, informationQuery.getInformationName()) |
| | | .eq(informationQuery.getRegionId() != null, TInformation::getRegionId, informationQuery.getRegionId()) |
| | | .eq(informationQuery.getTechnicalId() != null, TInformation::getTechnicalId, informationQuery.getTechnicalId()) |
| | | .eq(informationQuery.getMajorId() != null, TInformation::getMajorId, informationQuery.getMajorId()) |
| | | .eq(informationQuery.getLevel() != null, TInformation::getLevel, informationQuery.getLevel()) |
| | | .eq(informationQuery.getFree()!=null&&informationQuery.getFree() == 1, TInformation::getInformationPrice, BigDecimal.ZERO) |
| | | .ne(informationQuery.getFree()!=null&&informationQuery.getFree() == 2, TInformation::getInformationPrice, BigDecimal.ZERO) |
| | | .orderByDesc(TInformation::getCreateTime) |
| | | .page(Page.of(informationQuery.getPageNum(), informationQuery.getPageSize())); |
| | | }else { |
| | | page = informationService.lambdaQuery() |
| | | .like(!StringUtils.isEmpty(informationQuery.getInformationName()), TInformation::getInformationName, informationQuery.getInformationName()) |
| | | .eq(informationQuery.getRegionId() != null, TInformation::getRegionId, informationQuery.getRegionId()) |
| | | .eq(informationQuery.getTechnicalId() != null, TInformation::getTechnicalId, informationQuery.getTechnicalId()) |
| | | .eq(informationQuery.getMajorId() != null, TInformation::getMajorId, informationQuery.getMajorId()) |
| | | .eq(informationQuery.getLevel() != null, TInformation::getLevel, informationQuery.getLevel()) |
| | | .eq(informationQuery.getFree()!=null&&informationQuery.getFree() == 1, TInformation::getInformationPrice, BigDecimal.ZERO) |
| | | .ne(informationQuery.getFree()!=null&&informationQuery.getFree() == 2, TInformation::getInformationPrice, BigDecimal.ZERO) |
| | | .orderByDesc(TInformation::getCommitteeSort) |
| | | .page(Page.of(informationQuery.getPageNum(), informationQuery.getPageSize())); |
| | | } |
| | | Set<Long> cacheSet = redisCache.getCacheSet("INFORMATION:" + userId); |
| | | |
| | | for (TInformation record : page.getRecords()) { |