Эх сурвалжийг харах

feat(system): 优化课程列表排序和价格类型设置

- 在 AppCoureseServiceImpl 中添加逻辑,当 sellingPrice 为 null 或 0 时,设置 priceType 为 1
- 修改 AppCoursesMapper.xml 中的 SQL 语句,修复 orderByType 为 3时的排序逻辑
SheepHy 4 долоо хоног өмнө
parent
commit
f5bc5a9703

+ 1 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/xml/AppCoursesMapper.xml

@@ -133,7 +133,7 @@
         <if test="courseRequestVo.orderByType != null and courseRequestVo.orderByType == '0'">
             ORDER BY b.create_time DESC
         </if>
-        <if test="courseRequestVo.orderByType != null and courseRequestVo.orderByType == '0'">
+        <if test="courseRequestVo.orderByType != null and courseRequestVo.orderByType == '3'">
             ORDER BY b.good_rate DESC
         </if>
     </select>

+ 5 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/service/impl/AppCoureseServiceImpl.java

@@ -28,6 +28,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.ZoneId;
@@ -75,6 +76,10 @@ public class AppCoureseServiceImpl extends ServiceImpl<AppCoursesMapper, AppCour
             appCourses.setTenantId(site.getTenantId());
             appCourses.setSiteId(site.getId());
         }
+        if (appCoursesDTO.getCourses().getSellingPrice() == null ||
+                appCoursesDTO.getCourses().getSellingPrice().compareTo(BigDecimal.ZERO) == 0) {
+            appCourses.setPriceType(1);
+        }
 
         appCourses.setUserId(coursesCuDTO.getUserId());
         appCourses.setAddressSiteId(coursesCuDTO.getAddressSiteId());