diff --git a/src/main/java/com/huoran/iasf/controller/SysColumnController.java b/src/main/java/com/huoran/iasf/controller/SysColumnController.java index a7ba83b..5658612 100644 --- a/src/main/java/com/huoran/iasf/controller/SysColumnController.java +++ b/src/main/java/com/huoran/iasf/controller/SysColumnController.java @@ -144,7 +144,7 @@ public class SysColumnController { return R.success(); } - @ApiOperation("获取一级下的子级栏目(包含自己)") + @ApiOperation("获取一级下的子级栏目") @PostMapping("/getsTheSubColumn") public R getsTheSubColumn(Integer id) { String ids = this.getIds(id); @@ -153,7 +153,7 @@ public class SysColumnController { } - @ApiOperation("获取某层级下的子级栏目(包含自己)") + @ApiOperation("获取某层级下的子级栏目") @PostMapping("/getsSublevelColumnsUnderALevel") public R getsSublevelColumnsUnderALevel(Integer id) { String ids = this.getIds(id); @@ -225,5 +225,17 @@ public class SysColumnController { } + /** + * 查询栏目下的文章(若选中栏目与子级全部栏目类型一致返回全部文章,反之查询选中栏目下的文章) + * @param columnId + * @return + */ + @ApiOperation("查询栏目下的文章(若选中栏目与子级全部栏目类型一致返回全部文章,反之查询选中栏目下的文章)") + @PostMapping("/queryArticlesByColumnType") + public R queryArticlesByColumnType(@ApiParam(name = "columnId", value = "栏目id", required = true) @RequestParam Integer columnId) { + String ids = this.getIds(columnId); + return service.queryArticlesByColumnType(ids,columnId); + } + } diff --git a/src/main/java/com/huoran/iasf/mapper/SysColumnMapper.java b/src/main/java/com/huoran/iasf/mapper/SysColumnMapper.java index 2a12890..337d3fc 100644 --- a/src/main/java/com/huoran/iasf/mapper/SysColumnMapper.java +++ b/src/main/java/com/huoran/iasf/mapper/SysColumnMapper.java @@ -38,4 +38,6 @@ public interface SysColumnMapper extends BaseMapper { Integer oneLevelChecksThemAll(@Param("theChildId")Integer theChildId); + + List queryByColumnType(@Param("ids")String ids); } \ No newline at end of file diff --git a/src/main/java/com/huoran/iasf/mapper/SysContentMapper.java b/src/main/java/com/huoran/iasf/mapper/SysContentMapper.java index 1cd243f..59c6a37 100644 --- a/src/main/java/com/huoran/iasf/mapper/SysContentMapper.java +++ b/src/main/java/com/huoran/iasf/mapper/SysContentMapper.java @@ -28,4 +28,7 @@ public interface SysContentMapper extends BaseMapper { List useTheColumnToGetTagsForTheFullArticle(String ids); IPage siteSearchArticles(Page page, @Param("req") PageContentReqVO req); + + + List columnConditionsFilterArticles(@Param("columnId")String columnId); } \ No newline at end of file diff --git a/src/main/java/com/huoran/iasf/mapper/xml/SysColumnMapper.xml b/src/main/java/com/huoran/iasf/mapper/xml/SysColumnMapper.xml index 9c900c6..12609e7 100644 --- a/src/main/java/com/huoran/iasf/mapper/xml/SysColumnMapper.xml +++ b/src/main/java/com/huoran/iasf/mapper/xml/SysColumnMapper.xml @@ -185,6 +185,18 @@ ORDER BY T1.lvl DESC limit 0,1 + \ No newline at end of file diff --git a/src/main/java/com/huoran/iasf/mapper/xml/SysContentMapper.xml b/src/main/java/com/huoran/iasf/mapper/xml/SysContentMapper.xml index ab2b11c..448149b 100644 --- a/src/main/java/com/huoran/iasf/mapper/xml/SysContentMapper.xml +++ b/src/main/java/com/huoran/iasf/mapper/xml/SysContentMapper.xml @@ -137,6 +137,26 @@ CONCAT('%',#{req.title},'%') + \ No newline at end of file diff --git a/src/main/java/com/huoran/iasf/service/SysColumnService.java b/src/main/java/com/huoran/iasf/service/SysColumnService.java index 0212418..0579830 100644 --- a/src/main/java/com/huoran/iasf/service/SysColumnService.java +++ b/src/main/java/com/huoran/iasf/service/SysColumnService.java @@ -40,5 +40,7 @@ public interface SysColumnService extends IService { R getSubColumn(Integer parentId,String ids); + R queryArticlesByColumnType(String ids,Integer id); + } \ No newline at end of file diff --git a/src/main/java/com/huoran/iasf/service/impl/SysColumnServiceImpl.java b/src/main/java/com/huoran/iasf/service/impl/SysColumnServiceImpl.java index dfbfadd..14d2888 100644 --- a/src/main/java/com/huoran/iasf/service/impl/SysColumnServiceImpl.java +++ b/src/main/java/com/huoran/iasf/service/impl/SysColumnServiceImpl.java @@ -8,6 +8,7 @@ import com.huoran.iasf.common.utils.R; import com.huoran.iasf.common.utils.TreeStructureUtils; import com.huoran.iasf.entity.SysColumn; import com.huoran.iasf.mapper.SysColumnMapper; +import com.huoran.iasf.mapper.SysContentMapper; import com.huoran.iasf.service.SysColumnService; import com.huoran.iasf.vo.FatherContentRespVO; import com.huoran.iasf.vo.req.ColumnWeightReqVO; @@ -33,6 +34,9 @@ public class SysColumnServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); @@ -160,6 +164,26 @@ public class SysColumnServiceImpl extends ServiceImpl queryByColumnType = baseMapper.queryByColumnType(ids); + //为1表示该层级下以及它本身列表样式模板一直则查询全部的 + if (count > 1) { + if (queryByColumnType.size() == 1) { + return R.success(contentMapper.columnConditionsFilterArticles(ids)); + } + } + //表示该层级下的全部层级不一致只查本身 + return R.success(contentMapper.columnConditionsFilterArticles(id + "")); + } + }