xuhy
2024-12-11 0a1533fd30ec1a2f4624ccda4ff11f2535ea8a46
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TInformationController.java
@@ -55,6 +55,8 @@
    @Resource
    private TTitleMajorService majorService;
    @Resource
    private TLevelService levelService;
    @Resource
    private TokenService tokenService;
    @Resource
    private TOrderService orderService;
@@ -95,17 +97,30 @@
    @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()) {
@@ -163,7 +178,7 @@
        record.setRegionName(byId.getProvinceName()+"-"+byId.getName());
        TTechnicalTitle byId1 = tTechnicalTitleService.getById(record.getTechnicalId());
        TTitleMajor byId2 = majorService.getById(record.getMajorId());
        record.setTechnicalName(byId1.getTitileName()+"-"+byId2.getMajorName());
        record.setTechnicalName(byId1.getTitileName()+"-"+byId2.getMajorName()+"-"+record.getLevel());
        if (cacheSet!=null){
            if (cacheSet.contains(record.getId())){
                record.setIsCollect(1);