diff --git a/src/main/java/com/gxwebsoft/cms/entity/Navigation.java b/src/main/java/com/gxwebsoft/cms/entity/Navigation.java index dee9b25..5e501ab 100644 --- a/src/main/java/com/gxwebsoft/cms/entity/Navigation.java +++ b/src/main/java/com/gxwebsoft/cms/entity/Navigation.java @@ -152,6 +152,10 @@ public class Navigation implements Serializable { @TableField(exist = false) private String categoryPath; + @ApiModelProperty(value = "栏目下的新闻列表") + @TableField(exist = false) + private List
articleList; + public String getCategoryName() { return this.title; } diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/NavigationServiceImpl.java b/src/main/java/com/gxwebsoft/cms/service/impl/NavigationServiceImpl.java index 0b50f05..705ab1d 100644 --- a/src/main/java/com/gxwebsoft/cms/service/impl/NavigationServiceImpl.java +++ b/src/main/java/com/gxwebsoft/cms/service/impl/NavigationServiceImpl.java @@ -6,8 +6,11 @@ import cn.hutool.extra.pinyin.PinyinUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.cms.entity.Article; import com.gxwebsoft.cms.entity.Design; import com.gxwebsoft.cms.mapper.NavigationMapper; +import com.gxwebsoft.cms.param.ArticleParam; +import com.gxwebsoft.cms.service.ArticleService; import com.gxwebsoft.cms.service.DesignService; import com.gxwebsoft.cms.service.NavigationService; import com.gxwebsoft.cms.entity.Navigation; @@ -37,6 +40,8 @@ public class NavigationServiceImpl extends ServiceImpl pageRel(NavigationParam param) { @@ -52,6 +57,19 @@ public class NavigationServiceImpl extends ServiceImpl page = new PageParam<>(); page.setDefaultOrder("top asc,sort_number asc,navigation_id asc"); + // 是否读取新闻列表 + if (param.getSceneType() != null && param.getSceneType().equals("showArticle")) { + list.forEach(d->{ + final ArticleParam articleParam = new ArticleParam(); + articleParam.setCategoryId(d.getNavigationId()); + articleParam.setDeleted(0); + if(param.getLimit() != null){ + articleParam.setLimit(param.getLimit()); + } + final PageResult
articlePageResult = articleService.pageRel(articleParam); + d.setArticleList(articlePageResult.getList()); + }); + } return page.sortRecords(list); }