From 5be07b1a021f596b003eac001f4cb77416ae6c7b Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期三, 11 十二月 2024 17:08:47 +0800
Subject: [PATCH] 修改

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TInformationController.java |   35 ++++++++++++++++++++++++-----------
 1 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TInformationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TInformationController.java
index 1866ba8..8d76414 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TInformationController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TInformationController.java
@@ -95,17 +95,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()) {

--
Gitblit v1.7.1