From 2fd13b6779b9a8b2bc44e0198870f2886c0b4c4b Mon Sep 17 00:00:00 2001 From: lee <332870766@qq.com> Date: Fri, 2 Aug 2024 14:56:00 +0800 Subject: [PATCH] 2024.8.2 --- .../web/controller/system/DoorController.java | 51 ++++++++++ .../system/XysCategoryController.java | 11 +++ .../com/ruoyi/system/domain/XysArticle.java | 32 +++++++ .../com/ruoyi/system/domain/XysCategory.java | 20 ++++ .../ruoyi/system/mapper/XysArticleMapper.java | 4 + .../system/mapper/XysCategoryMapper.java | 4 + .../mapper/system/XysArticleMapper.xml | 92 ++++++++++++++----- .../mapper/system/XysCategoryMapper.xml | 33 ++++++- ruoyi-ui/src/api/system/category.js | 9 ++ ruoyi-ui/src/components/Editor/index.vue | 2 +- ruoyi-ui/src/views/system/article/index.vue | 23 ++++- ruoyi-ui/src/views/system/category/index.vue | 22 ++++- 12 files changed, 268 insertions(+), 35 deletions(-) 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 250bcee..b33bae2 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 @@ -10,6 +10,8 @@ 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.mapper.XysArticleMapper; +import com.ruoyi.system.mapper.XysCategoryMapper; import com.ruoyi.system.service.IXysArticleService; import com.ruoyi.system.service.IXysCategoryService; import com.ruoyi.system.service.IXysImgService; @@ -36,6 +38,10 @@ public class DoorController extends BaseController private IXysImgService xysImgService; @Autowired private IXysCategoryService categoryService; + @Autowired + private XysArticleMapper articleMapper; + @Autowired + private XysCategoryMapper categoryMapper; /** @@ -90,4 +96,49 @@ public class DoorController extends BaseController return success(categoryService.selectXysCategoryList(category)); } + /** + * 下一篇 + */ + @GetMapping(value = "/getNext") + public AjaxResult getNext(XysArticle xysArticle) + { + return success(articleMapper.getNext(xysArticle)); + } + + /** + * 上一篇 + */ + @GetMapping(value = "/getUp") + public AjaxResult getUp(XysArticle xysArticle) + { + return success(articleMapper.getUp(xysArticle)); + } + + /** + * 下一篇 + */ + @GetMapping(value = "/getNextCat") + public AjaxResult getNextCat(XysCategory xysCategory) + { + return success(categoryMapper.getNextCat(xysCategory)); + } + + /** + * 上一篇 + */ + @GetMapping(value = "/getUpCat") + public AjaxResult getUpCat(XysCategory xysCategory) + { + return success(categoryMapper.getUpCat(xysCategory)); + } + + + /** + * + */ + @GetMapping(value = "/getCategoryById/{id}") + public AjaxResult getCategoryById(@PathVariable("id") Long Id) + { + return success(categoryService.selectXysCategoryById(Id)); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/XysCategoryController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/XysCategoryController.java index 7f5dbe1..a972612 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/XysCategoryController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/XysCategoryController.java @@ -46,6 +46,17 @@ public class XysCategoryController extends BaseController return getDataTable(list); } + /** + * 查询文章分类列表 + */ + @PreAuthorize("@ss.hasPermi('system:category:list')") + @GetMapping("/catList") + public TableDataInfo catList(XysCategory xysCategory) + { + List list = xysCategoryService.selectXysCategoryList(xysCategory); + return getDataTable(list); + } + /** * 导出文章分类列表 */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/XysArticle.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/XysArticle.java index 575f964..2ff2dc5 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/XysArticle.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/XysArticle.java @@ -26,6 +26,18 @@ public class XysArticle extends BaseEntity @Excel(name = "封面图") private String coverImg; + public String getContentImg() { + return contentImg; + } + + public void setContentImg(String contentImg) { + this.contentImg = contentImg; + } + + /** 封面图 */ + @Excel(name = "内容图片") + private String contentImg; + public String getDescription() { return description; } @@ -46,9 +58,29 @@ public class XysArticle extends BaseEntity @Excel(name = "文章所属分类") private Long articleCat; + public String getCatName() { + return catName; + } + + public void setCatName(String catName) { + this.catName = catName; + } + + private String catName; + /** $column.columnComment */ private String delFlag; + public Integer getSort() { + return sort; + } + + public void setSort(Integer sort) { + this.sort = sort; + } + + private Integer sort; + public void setId(Long id) { this.id = id; 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 9d36a0f..376ec83 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 @@ -40,6 +40,16 @@ public class XysCategory extends BaseEntity @Excel(name = "封面图") private String coverImg; + public String getContentImg() { + return contentImg; + } + + public void setContentImg(String contentImg) { + this.contentImg = contentImg; + } + + private String contentImg; + /** 简介 */ @Excel(name = "简介") private String description; @@ -47,6 +57,16 @@ public class XysCategory extends BaseEntity /** */ private String delFlag; + public Integer getSort() { + return sort; + } + + public void setSort(Integer sort) { + this.sort = sort; + } + + private Integer sort; + public void setId(Long id) { this.id = id; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/XysArticleMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/XysArticleMapper.java index 55ea76d..c04b7ec 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/XysArticleMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/XysArticleMapper.java @@ -65,4 +65,8 @@ public interface XysArticleMapper * @return 结果 */ public int deleteXysArticleByIds(Long[] ids); + + XysArticle getNext(XysArticle xysArticle); + + XysArticle getUp(XysArticle xysArticle); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/XysCategoryMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/XysCategoryMapper.java index 81edd53..07a58ea 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/XysCategoryMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/XysCategoryMapper.java @@ -58,4 +58,8 @@ public interface XysCategoryMapper * @return 结果 */ public int deleteXysCategoryByIds(Long[] ids); + + XysCategory getNextCat(XysCategory xysCategory); + + XysCategory getUpCat(XysCategory xysCategory); } diff --git a/ruoyi-system/src/main/resources/mapper/system/XysArticleMapper.xml b/ruoyi-system/src/main/resources/mapper/system/XysArticleMapper.xml index 4dba8d7..1522ca2 100644 --- a/ruoyi-system/src/main/resources/mapper/system/XysArticleMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/XysArticleMapper.xml @@ -1,46 +1,62 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - - - - - - - - - - - + + + + + + + + + + + + + + - select id, title, cover_img, description,content, article_cat, create_time, create_by, update_time, update_by, remark, del_flag from xys_article + select id, + title, + cover_img, + content_img, + description, + content, + article_cat, + sort, + create_time, + create_by, + update_time, + update_by, + remark, + del_flag + from xys_article + select id,title from xys_article + + and id > #{id} + and article_cat = #{articleCat} + + limit 1 + + + + diff --git a/ruoyi-system/src/main/resources/mapper/system/XysCategoryMapper.xml b/ruoyi-system/src/main/resources/mapper/system/XysCategoryMapper.xml index 647ffdc..5863978 100644 --- a/ruoyi-system/src/main/resources/mapper/system/XysCategoryMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/XysCategoryMapper.xml @@ -9,7 +9,9 @@ + + @@ -19,7 +21,8 @@ - select id, parent_id, title, cover_img, description, create_time, create_by, update_time, update_by, remark, del_flag from xys_category + select id, parent_id, title, cover_img,content_img, description, + sort, create_time, create_by, update_time, update_by, remark, del_flag from xys_category + select id,title from xys_category + + and id > #{id} + and parent_id = #{parentId} + + limit 1 + + + + diff --git a/ruoyi-ui/src/api/system/category.js b/ruoyi-ui/src/api/system/category.js index 1b406bc..601a1f1 100644 --- a/ruoyi-ui/src/api/system/category.js +++ b/ruoyi-ui/src/api/system/category.js @@ -9,6 +9,15 @@ export function listCategory(query) { }) } +// 查询文章分类列表 +export function catList(query) { + return request({ + url: '/system/category/catList', + method: 'get', + params: query + }) +} + // 查询文章分类详细 export function getCategory(id) { return request({ diff --git a/ruoyi-ui/src/components/Editor/index.vue b/ruoyi-ui/src/components/Editor/index.vue index 8981d76..54df44d 100644 --- a/ruoyi-ui/src/components/Editor/index.vue +++ b/ruoyi-ui/src/components/Editor/index.vue @@ -182,7 +182,7 @@ export default { // 获取光标所在位置 let length = quill.getSelection().index; // 插入图片 res.url为服务器返回的图片地址 - quill.insertEmbed(length, "image", process.env.VUE_APP_BASE_API + res.fileName); + quill.insertEmbed(length, "image", res.url); // 调整光标到最后 quill.setSelection(length + 1); } else { diff --git a/ruoyi-ui/src/views/system/article/index.vue b/ruoyi-ui/src/views/system/article/index.vue index 2e81bfa..e915ff0 100644 --- a/ruoyi-ui/src/views/system/article/index.vue +++ b/ruoyi-ui/src/views/system/article/index.vue @@ -45,12 +45,17 @@ - - + + + + + + +