فهرست منبع

feat(article): extend search to title+summary+tags; fix compile errors in FoodRecommendService and HealthReportController

- ArticleService: getPublicList/getAdminList now match keyword against title, summary, and tags fields (OR logic)
- FoodRecommendService: add missing import java.math.BigDecimal
- HealthReportController: remove undefined 'parsed' reference in buildPayloadFromLgData
liaoxg 2 ماه پیش
والد
کامیت
d02ade3e74

+ 1 - 0
cfc-backend/src/main/java/com/etotem/cfc/controller/HealthReportController.java

@@ -1896,6 +1896,7 @@ public class HealthReportController {
         report.setSubjectId(subjectId);
         report.setReportType(draft.getReportType());
         report.setFileUrl(draft.getFileUrl());
+        report.setReportFormat(payload.getReportFormat());
 
         ParsedReportPayload.Summary s = payload.getSummary();
         if (s != null) {

+ 4 - 2
cfc-backend/src/main/java/com/etotem/cfc/service/ArticleService.java

@@ -93,7 +93,8 @@ public class ArticleService {
             wrapper.eq(Article::getCategoryId, categoryId);
         }
         if (keyword != null && !keyword.trim().isEmpty()) {
-            wrapper.like(Article::getTitle, keyword.trim());
+            String kw = keyword.trim();
+            wrapper.and(w -> w.like(Article::getTitle, kw).or().like(Article::getSummary, kw).or().like(Article::getTags, kw));
         }
         if (dimensionCode != null && !dimensionCode.trim().isEmpty()) {
             String dim = dimensionCode.trim();
@@ -395,7 +396,8 @@ public class ArticleService {
             wrapper.eq(Article::getCategoryId, categoryId);
         }
         if (keyword != null && !keyword.trim().isEmpty()) {
-            wrapper.like(Article::getTitle, keyword.trim());
+            String kw = keyword.trim();
+            wrapper.and(w -> w.like(Article::getTitle, kw).or().like(Article::getSummary, kw).or().like(Article::getTags, kw));
         }
         if (contentType != null && !contentType.isEmpty()) {
             wrapper.eq(Article::getContentType, contentType);

+ 1 - 0
cfc-backend/src/main/java/com/etotem/cfc/service/FoodRecommendService.java

@@ -13,6 +13,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import javax.annotation.Resource;
+import java.math.BigDecimal;
 import java.util.*;
 import java.util.stream.Collectors;