Explorar o código

feat(app): 优化课程验证记录查询逻辑

- 在AppCoursesVerificationRecordMapper.xml中增加UNION ALL查询条件,支持查询order_id为空且未延期的记录
- 在CommercialController中增加对临时课程列表的非空校验,避免空指针异常
- 提升课程验证记录查询的完整性和健壮性
wzq hai 1 semana
pai
achega
6178053134

+ 3 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/controller/commercial/CommercialController.java

@@ -138,7 +138,9 @@ public class CommercialController {
 
         List<AppCoursesVerificationRecord> temporaryCourseList =
                 appCoursesVerificationRecordService.queryTemporaryCourseUser(form.getCoursePriceRulesId(),form.getOrPostpone(),form.getVerifyStatus(),loginUser.getId());
-        verificationRecords.addAll(temporaryCourseList);
+        if(CollUtil.isNotEmpty(temporaryCourseList)){
+            verificationRecords.addAll(temporaryCourseList);
+        }
         List<AppCoursesVerificationRecord> list = verificationRecords.stream()
                 .collect(Collectors.collectingAndThen(
                         Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(AppCoursesVerificationRecord::getUseUserId))),

+ 10 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/xml/AppCoursesVerificationRecordMapper.xml

@@ -58,5 +58,15 @@
         WHERE o.del_flag = 0
           AND o.order_status BETWEEN 1 AND 3
           AND cvr.courses_price_rule_id = #{priceRulesId}
+        UNION ALL
+        SELECT
+            *
+        FROM
+            nm_courses_verification_record cvr
+                LEFT JOIN nm_order o ON o.id = cvr.order_id
+        WHERE
+            cvr.order_id IS NULL
+          AND cvr.courses_price_rule_id = #{priceRulesId}
+          AND cvr.or_postpone = 0
     </select>
 </mapper>