diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/DoorController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/DoorController.java index 2ae383c..250bcee 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/DoorController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/DoorController.java @@ -8,8 +8,10 @@ import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.sign.Base64; import com.ruoyi.system.domain.XysArticle; +import com.ruoyi.system.domain.XysCategory; import com.ruoyi.system.domain.XysImg; import com.ruoyi.system.service.IXysArticleService; +import com.ruoyi.system.service.IXysCategoryService; import com.ruoyi.system.service.IXysImgService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; @@ -32,6 +34,8 @@ public class DoorController extends BaseController private IXysArticleService xysArticleService; @Autowired private IXysImgService xysImgService; + @Autowired + private IXysCategoryService categoryService; /** @@ -45,7 +49,7 @@ public class DoorController extends BaseController } /** - * 查询新闻动态文章列表 + * 查询文章列表 */ @GetMapping("/getArticleList") public TableDataInfo getArticleList(XysArticle xysArticle) @@ -75,4 +79,15 @@ public class DoorController extends BaseController return success(xysArticleService.selectXysArticleById(id)); } + /** + * 获取文章管理详细信息 + */ + @GetMapping(value = "/getCategory/{parentId}") + public AjaxResult getCategory(@PathVariable("parentId") Long parentId) + { + XysCategory category = new XysCategory(); + category.setParentId(parentId); + return success(categoryService.selectXysCategoryList(category)); + } + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/XysCategory.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/XysCategory.java index a364b5d..9d36a0f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/XysCategory.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/XysCategory.java @@ -22,6 +22,16 @@ public class XysCategory extends BaseEntity @Excel(name = "上级分类") private Long parentId; + public String getParentName() { + return parentName; + } + + public void setParentName(String parentName) { + this.parentName = parentName; + } + + private String parentName; + /** 分类名称 */ @Excel(name = "分类名称") private String title; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/XysCategoryServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/XysCategoryServiceImpl.java index 5a35973..7949ba0 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/XysCategoryServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/XysCategoryServiceImpl.java @@ -41,7 +41,14 @@ public class XysCategoryServiceImpl implements IXysCategoryService @Override public List selectXysCategoryList(XysCategory xysCategory) { - return xysCategoryMapper.selectXysCategoryList(xysCategory); + List list = xysCategoryMapper.selectXysCategoryList(xysCategory); + for(XysCategory category:list){ + if(category.getParentId() != null){ + XysCategory cg = xysCategoryMapper.selectXysCategoryById(category.getParentId()); + category.setParentName(cg.getTitle()); + } + } + return list; } /**