增加接口文章可查询全部父级栏目

master
rong.liu 1 year ago
parent cf290c52c5
commit 9be8912160
  1. 12
      src/main/java/com/huoran/iasf/controller/SysContentController.java
  2. 4
      src/main/java/com/huoran/iasf/mapper/SysContentMapper.java
  3. 15
      src/main/java/com/huoran/iasf/mapper/xml/SysContentMapper.xml
  4. 2
      src/main/java/com/huoran/iasf/service/SysContentService.java
  5. 7
      src/main/java/com/huoran/iasf/service/impl/SysContentServiceImpl.java

@ -164,11 +164,11 @@ public class SysContentController {
/*查询已发布的、启用了的文章列表接口*/ /*查询已发布的、启用了的文章列表接口*/
@PostMapping("/publishedEnabledArticles") /* @PostMapping("/publishedEnabledArticles")
@ApiOperation(value = "查询已发布的、启用了的文章列表", response = PageContentReqVO.class) @ApiOperation(value = "查询已发布的、启用了的文章列表", response = PageContentReqVO.class)
public R publishedEnabledArticles() { public R publishedEnabledArticles() {
return service.publishedEnabledArticles(); return service.publishedEnabledArticles();
} }*/
/** /**
@ -242,5 +242,13 @@ public class SysContentController {
} }
@PostMapping("/queryArticleColumnParent")
@ApiOperation(value = "查询文章的栏目父级", response = PageContentReqVO.class)
public R queryArticleColumnParent(@ApiParam(name = "articleId", value = "文章id", required = true) @RequestParam Integer articleId) {
return service.queryArticleColumnParent(articleId);
}
} }

@ -3,6 +3,7 @@ package com.huoran.iasf.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.huoran.iasf.common.utils.R; import com.huoran.iasf.common.utils.R;
import com.huoran.iasf.entity.SysColumn;
import com.huoran.iasf.entity.SysContent; import com.huoran.iasf.entity.SysContent;
import com.huoran.iasf.entity.SysContentClassification; import com.huoran.iasf.entity.SysContentClassification;
import com.huoran.iasf.entity.SysContentLabel; import com.huoran.iasf.entity.SysContentLabel;
@ -39,4 +40,7 @@ public interface SysContentMapper extends BaseMapper<SysContent> {
Integer selectPreviousId(@Param("content")SysContent sysContent);*/ Integer selectPreviousId(@Param("content")SysContent sysContent);*/
List<SysColumn> queryArticleColumnParent(@Param("columnId")Integer columnId);
} }

@ -255,6 +255,21 @@
release_time DESC, release_time DESC,
create_time DESC create_time DESC
</select> </select>
<select id="queryArticleColumnParent" resultType="com.huoran.iasf.entity.SysColumn">
SELECT t2.*
FROM (
SELECT
@r AS _id,
(SELECT @r := father_id FROM sys_column WHERE id = _id) AS father_id,
@l := @l + 1 AS lvl
FROM
(SELECT @r := #{columnId}, @l := 0) vars,
sys_column h
WHERE @r != 0) T1
JOIN sys_column T2
ON T1._id = T2.id and deleted = 1
ORDER BY T1.lvl DESC
</select>
</mapper> </mapper>

@ -39,6 +39,8 @@ public interface SysContentService extends IService<SysContent> {
R siteSearchArticles(PageContentReqVO req); R siteSearchArticles(PageContentReqVO req);
R queryArticleColumnParent(Integer articleId);
// R modifiedSort(List<ArticleModifiedSortReq> reqList); // R modifiedSort(List<ArticleModifiedSortReq> reqList);
// R modifiedSort(Integer sequenceNumber, Integer articleId); // R modifiedSort(Integer sequenceNumber, Integer articleId);

@ -147,6 +147,13 @@ public class SysContentServiceImpl extends ServiceImpl<SysContentMapper, SysCont
return R.success(pageList); return R.success(pageList);
} }
@Override
public R queryArticleColumnParent(Integer articleId) {
SysContent sysContent = baseMapper.selectById(articleId);
return R.success(baseMapper.queryArticleColumnParent(sysContent.getColumnId()));
}
/*@Override /*@Override
public R modifiedSort(List<ArticleModifiedSortReq> reqList) { public R modifiedSort(List<ArticleModifiedSortReq> reqList) {
for (ArticleModifiedSortReq req : reqList) { for (ArticleModifiedSortReq req : reqList) {

Loading…
Cancel
Save