瀏覽代碼

fix 文章

zwhui 2 年之前
父節點
當前提交
2edcf6b94f

+ 1 - 2
netflix-dao/src/main/java/com/cyksj/model/views/InformationView.java

@@ -14,8 +14,7 @@ import java.util.List;
  */
 @Getter
 @Setter
-@SearchBean(tables = "information i" +
-        " left join information_category ic on i.category_id = ic.id")
+@SearchBean(tables = "information i")
 public class InformationView {
     @DbField("i.id")
     private Long id;

+ 1 - 1
netflix-dao/src/main/resources/mapper/InformationMapper.xml

@@ -8,7 +8,7 @@
         select title,thumbnail,created_time,content from information where status is true and deleted is true
         <choose>
             <when test="categoryId != null">
-                and JSON_CONTAINS(category_ids,'"${categoryId}"') = 1
+                and JSON_CONTAINS(category_ids,'${categoryId}') = 1
             </when>
             <otherwise>
                 and recommend is true

+ 5 - 0
netflix-web/src/main/java/com/cyksj/web/controller/manage/information/CmsInformationController.java

@@ -92,9 +92,14 @@ public class CmsInformationController {
                         .in(GoodsDon::getId, goodsIds)
                         .eq(GoodsDon::getStatus, true)
                         .eq(GoodsDon::getDeleted,true)).stream().map(GoodsDon::getTitle).collect(Collectors.toList()));
+                List<Long> categoryIds = Jsons.parseList(data.getCategoryIds(), Long.class);
+                data.setCategoryNames(informationCategoryService.list(Wrappers.lambdaQuery(InformationCategory.class)
+                        .select(InformationCategory::getName)
+                        .in(InformationCategory::getId,categoryIds)).stream().map(InformationCategory::getName).collect(Collectors.toList()));
             } catch (Exception e) {
                 e.printStackTrace();
             }
+
         });
         return GatewayResponse.SUCCESS.newBuilder().toResult(list);
     }