From c2e4fb6163583e08d8555cb2d0d96edc1df99940 Mon Sep 17 00:00:00 2001 From: libao <15050590816@163.com> Date: Tue, 30 Apr 2024 09:08:16 +0800 Subject: [PATCH] =?UTF-8?q?2024.4.30=20=E6=B7=BB=E5=8A=A0=E5=AE=98?= =?UTF-8?q?=E7=BD=91=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/gw/GwArticleController.java | 104 ++++++++++++++++ .../controller/gw/GwCategoryController.java | 104 ++++++++++++++++ .../com/ruoyi/system/domain/GwArticle.java | 111 ++++++++++++++++++ .../com/ruoyi/system/domain/GwCategory.java | 97 +++++++++++++++ .../ruoyi/system/mapper/GwArticleMapper.java | 61 ++++++++++ .../ruoyi/system/mapper/GwCategoryMapper.java | 61 ++++++++++ .../system/service/IGwArticleService.java | 61 ++++++++++ .../system/service/IGwCategoryService.java | 61 ++++++++++ .../service/impl/GwArticleServiceImpl.java | 96 +++++++++++++++ .../service/impl/GwCategoryServiceImpl.java | 96 +++++++++++++++ .../mapper/system/GwArticleMapper.xml | 93 +++++++++++++++ .../mapper/system/GwCategoryMapper.xml | 90 ++++++++++++++ 12 files changed, 1035 insertions(+) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/gw/GwArticleController.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/gw/GwCategoryController.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/GwArticle.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/GwCategory.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/GwArticleMapper.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/GwCategoryMapper.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/IGwArticleService.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/IGwCategoryService.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/GwArticleServiceImpl.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/GwCategoryServiceImpl.java create mode 100644 ruoyi-system/src/main/resources/mapper/system/GwArticleMapper.xml create mode 100644 ruoyi-system/src/main/resources/mapper/system/GwCategoryMapper.xml diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/gw/GwArticleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/gw/GwArticleController.java new file mode 100644 index 0000000..29e04eb --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/gw/GwArticleController.java @@ -0,0 +1,104 @@ +package com.ruoyi.web.controller.gw; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.system.domain.GwArticle; +import com.ruoyi.system.service.IGwArticleService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 官网文章列表Controller + * + * @author libao + * @date 2024-04-28 + */ +@RestController +@RequestMapping("/system/article") +public class GwArticleController extends BaseController +{ + @Autowired + private IGwArticleService gwArticleService; + + /** + * 查询官网文章列表列表 + */ + @PreAuthorize("@ss.hasPermi('system:article:list')") + @GetMapping("/list") + public TableDataInfo list(GwArticle gwArticle) + { + startPage(); + List list = gwArticleService.selectGwArticleList(gwArticle); + return getDataTable(list); + } + + /** + * 导出官网文章列表列表 + */ + @PreAuthorize("@ss.hasPermi('system:article:export')") + @Log(title = "官网文章列表", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, GwArticle gwArticle) + { + List list = gwArticleService.selectGwArticleList(gwArticle); + ExcelUtil util = new ExcelUtil(GwArticle.class); + util.exportExcel(response, list, "官网文章列表数据"); + } + + /** + * 获取官网文章列表详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:article:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(gwArticleService.selectGwArticleById(id)); + } + + /** + * 新增官网文章列表 + */ + @PreAuthorize("@ss.hasPermi('system:article:add')") + @Log(title = "官网文章列表", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody GwArticle gwArticle) + { + return toAjax(gwArticleService.insertGwArticle(gwArticle)); + } + + /** + * 修改官网文章列表 + */ + @PreAuthorize("@ss.hasPermi('system:article:edit')") + @Log(title = "官网文章列表", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody GwArticle gwArticle) + { + return toAjax(gwArticleService.updateGwArticle(gwArticle)); + } + + /** + * 删除官网文章列表 + */ + @PreAuthorize("@ss.hasPermi('system:article:remove')") + @Log(title = "官网文章列表", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(gwArticleService.deleteGwArticleByIds(ids)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/gw/GwCategoryController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/gw/GwCategoryController.java new file mode 100644 index 0000000..cc8085f --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/gw/GwCategoryController.java @@ -0,0 +1,104 @@ +package com.ruoyi.web.controller.gw; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.system.domain.GwCategory; +import com.ruoyi.system.service.IGwCategoryService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 文章分类Controller + * + * @author lb + * @date 2024-04-28 + */ +@RestController +@RequestMapping("/system/category") +public class GwCategoryController extends BaseController +{ + @Autowired + private IGwCategoryService gwCategoryService; + + /** + * 查询文章分类列表 + */ + @PreAuthorize("@ss.hasPermi('system:category:list')") + @GetMapping("/list") + public TableDataInfo list(GwCategory gwCategory) + { + startPage(); + List list = gwCategoryService.selectGwCategoryList(gwCategory); + return getDataTable(list); + } + + /** + * 导出文章分类列表 + */ + @PreAuthorize("@ss.hasPermi('system:category:export')") + @Log(title = "文章分类", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, GwCategory gwCategory) + { + List list = gwCategoryService.selectGwCategoryList(gwCategory); + ExcelUtil util = new ExcelUtil(GwCategory.class); + util.exportExcel(response, list, "文章分类数据"); + } + + /** + * 获取文章分类详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:category:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(gwCategoryService.selectGwCategoryById(id)); + } + + /** + * 新增文章分类 + */ + @PreAuthorize("@ss.hasPermi('system:category:add')") + @Log(title = "文章分类", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody GwCategory gwCategory) + { + return toAjax(gwCategoryService.insertGwCategory(gwCategory)); + } + + /** + * 修改文章分类 + */ + @PreAuthorize("@ss.hasPermi('system:category:edit')") + @Log(title = "文章分类", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody GwCategory gwCategory) + { + return toAjax(gwCategoryService.updateGwCategory(gwCategory)); + } + + /** + * 删除文章分类 + */ + @PreAuthorize("@ss.hasPermi('system:category:remove')") + @Log(title = "文章分类", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(gwCategoryService.deleteGwCategoryByIds(ids)); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/GwArticle.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/GwArticle.java new file mode 100644 index 0000000..8c0b3d1 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/GwArticle.java @@ -0,0 +1,111 @@ +package com.ruoyi.system.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 官网文章列表对象 gw_article + * + * @author libao + * @date 2024-04-28 + */ +public class GwArticle extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 官网文章列表 */ + private Long id; + + /** 文章所属分类 */ + @Excel(name = "文章所属分类") + private Long categoryId; + + /** 标题 */ + @Excel(name = "标题") + private String title; + + /** 内容 */ + @Excel(name = "内容") + private String content; + + /** 封面图片 */ + @Excel(name = "封面图片") + private String coverImg; + + /** 0否1是 */ + private String delFlag; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setCategoryId(Long categoryId) + { + this.categoryId = categoryId; + } + + public Long getCategoryId() + { + return categoryId; + } + public void setTitle(String title) + { + this.title = title; + } + + public String getTitle() + { + return title; + } + public void setContent(String content) + { + this.content = content; + } + + public String getContent() + { + return content; + } + public void setCoverImg(String coverImg) + { + this.coverImg = coverImg; + } + + public String getCoverImg() + { + return coverImg; + } + public void setDelFlag(String delFlag) + { + this.delFlag = delFlag; + } + + public String getDelFlag() + { + return delFlag; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("categoryId", getCategoryId()) + .append("title", getTitle()) + .append("content", getContent()) + .append("coverImg", getCoverImg()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .append("delFlag", getDelFlag()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/GwCategory.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/GwCategory.java new file mode 100644 index 0000000..2f00e88 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/GwCategory.java @@ -0,0 +1,97 @@ +package com.ruoyi.system.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 文章分类对象 gw_category + * + * @author lb + * @date 2024-04-28 + */ +public class GwCategory extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 官网文章分类表 */ + private Long id; + + /** 上级分类 */ + @Excel(name = "上级分类") + private Long parentId; + + /** 分类名称 */ + @Excel(name = "分类名称") + private String categoryName; + + /** 排序 */ + @Excel(name = "排序") + private Long sort; + + /** 0否1是 */ + private String delFlag; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setParentId(Long parentId) + { + this.parentId = parentId; + } + + public Long getParentId() + { + return parentId; + } + public void setCategoryName(String categoryName) + { + this.categoryName = categoryName; + } + + public String getCategoryName() + { + return categoryName; + } + public void setSort(Long sort) + { + this.sort = sort; + } + + public Long getSort() + { + return sort; + } + public void setDelFlag(String delFlag) + { + this.delFlag = delFlag; + } + + public String getDelFlag() + { + return delFlag; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("parentId", getParentId()) + .append("categoryName", getCategoryName()) + .append("sort", getSort()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .append("delFlag", getDelFlag()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/GwArticleMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/GwArticleMapper.java new file mode 100644 index 0000000..c8fc0af --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/GwArticleMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.system.domain.GwArticle; + +/** + * 官网文章列表Mapper接口 + * + * @author libao + * @date 2024-04-28 + */ +public interface GwArticleMapper +{ + /** + * 查询官网文章列表 + * + * @param id 官网文章列表主键 + * @return 官网文章列表 + */ + public GwArticle selectGwArticleById(Long id); + + /** + * 查询官网文章列表列表 + * + * @param gwArticle 官网文章列表 + * @return 官网文章列表集合 + */ + public List selectGwArticleList(GwArticle gwArticle); + + /** + * 新增官网文章列表 + * + * @param gwArticle 官网文章列表 + * @return 结果 + */ + public int insertGwArticle(GwArticle gwArticle); + + /** + * 修改官网文章列表 + * + * @param gwArticle 官网文章列表 + * @return 结果 + */ + public int updateGwArticle(GwArticle gwArticle); + + /** + * 删除官网文章列表 + * + * @param id 官网文章列表主键 + * @return 结果 + */ + public int deleteGwArticleById(Long id); + + /** + * 批量删除官网文章列表 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteGwArticleByIds(Long[] ids); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/GwCategoryMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/GwCategoryMapper.java new file mode 100644 index 0000000..dd773be --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/GwCategoryMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.system.domain.GwCategory; + +/** + * 文章分类Mapper接口 + * + * @author lb + * @date 2024-04-28 + */ +public interface GwCategoryMapper +{ + /** + * 查询文章分类 + * + * @param id 文章分类主键 + * @return 文章分类 + */ + public GwCategory selectGwCategoryById(Long id); + + /** + * 查询文章分类列表 + * + * @param gwCategory 文章分类 + * @return 文章分类集合 + */ + public List selectGwCategoryList(GwCategory gwCategory); + + /** + * 新增文章分类 + * + * @param gwCategory 文章分类 + * @return 结果 + */ + public int insertGwCategory(GwCategory gwCategory); + + /** + * 修改文章分类 + * + * @param gwCategory 文章分类 + * @return 结果 + */ + public int updateGwCategory(GwCategory gwCategory); + + /** + * 删除文章分类 + * + * @param id 文章分类主键 + * @return 结果 + */ + public int deleteGwCategoryById(Long id); + + /** + * 批量删除文章分类 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteGwCategoryByIds(Long[] ids); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IGwArticleService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IGwArticleService.java new file mode 100644 index 0000000..39e6168 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IGwArticleService.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.ruoyi.system.domain.GwArticle; + +/** + * 官网文章列表Service接口 + * + * @author libao + * @date 2024-04-28 + */ +public interface IGwArticleService +{ + /** + * 查询官网文章列表 + * + * @param id 官网文章列表主键 + * @return 官网文章列表 + */ + public GwArticle selectGwArticleById(Long id); + + /** + * 查询官网文章列表列表 + * + * @param gwArticle 官网文章列表 + * @return 官网文章列表集合 + */ + public List selectGwArticleList(GwArticle gwArticle); + + /** + * 新增官网文章列表 + * + * @param gwArticle 官网文章列表 + * @return 结果 + */ + public int insertGwArticle(GwArticle gwArticle); + + /** + * 修改官网文章列表 + * + * @param gwArticle 官网文章列表 + * @return 结果 + */ + public int updateGwArticle(GwArticle gwArticle); + + /** + * 批量删除官网文章列表 + * + * @param ids 需要删除的官网文章列表主键集合 + * @return 结果 + */ + public int deleteGwArticleByIds(Long[] ids); + + /** + * 删除官网文章列表信息 + * + * @param id 官网文章列表主键 + * @return 结果 + */ + public int deleteGwArticleById(Long id); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IGwCategoryService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IGwCategoryService.java new file mode 100644 index 0000000..203d760 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IGwCategoryService.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.ruoyi.system.domain.GwCategory; + +/** + * 文章分类Service接口 + * + * @author lb + * @date 2024-04-28 + */ +public interface IGwCategoryService +{ + /** + * 查询文章分类 + * + * @param id 文章分类主键 + * @return 文章分类 + */ + public GwCategory selectGwCategoryById(Long id); + + /** + * 查询文章分类列表 + * + * @param gwCategory 文章分类 + * @return 文章分类集合 + */ + public List selectGwCategoryList(GwCategory gwCategory); + + /** + * 新增文章分类 + * + * @param gwCategory 文章分类 + * @return 结果 + */ + public int insertGwCategory(GwCategory gwCategory); + + /** + * 修改文章分类 + * + * @param gwCategory 文章分类 + * @return 结果 + */ + public int updateGwCategory(GwCategory gwCategory); + + /** + * 批量删除文章分类 + * + * @param ids 需要删除的文章分类主键集合 + * @return 结果 + */ + public int deleteGwCategoryByIds(Long[] ids); + + /** + * 删除文章分类信息 + * + * @param id 文章分类主键 + * @return 结果 + */ + public int deleteGwCategoryById(Long id); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/GwArticleServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/GwArticleServiceImpl.java new file mode 100644 index 0000000..6f096b1 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/GwArticleServiceImpl.java @@ -0,0 +1,96 @@ +package com.ruoyi.system.service.impl; + +import java.util.List; +import com.ruoyi.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.system.mapper.GwArticleMapper; +import com.ruoyi.system.domain.GwArticle; +import com.ruoyi.system.service.IGwArticleService; + +/** + * 官网文章列表Service业务层处理 + * + * @author libao + * @date 2024-04-28 + */ +@Service +public class GwArticleServiceImpl implements IGwArticleService +{ + @Autowired + private GwArticleMapper gwArticleMapper; + + /** + * 查询官网文章列表 + * + * @param id 官网文章列表主键 + * @return 官网文章列表 + */ + @Override + public GwArticle selectGwArticleById(Long id) + { + return gwArticleMapper.selectGwArticleById(id); + } + + /** + * 查询官网文章列表列表 + * + * @param gwArticle 官网文章列表 + * @return 官网文章列表 + */ + @Override + public List selectGwArticleList(GwArticle gwArticle) + { + return gwArticleMapper.selectGwArticleList(gwArticle); + } + + /** + * 新增官网文章列表 + * + * @param gwArticle 官网文章列表 + * @return 结果 + */ + @Override + public int insertGwArticle(GwArticle gwArticle) + { + gwArticle.setCreateTime(DateUtils.getNowDate()); + return gwArticleMapper.insertGwArticle(gwArticle); + } + + /** + * 修改官网文章列表 + * + * @param gwArticle 官网文章列表 + * @return 结果 + */ + @Override + public int updateGwArticle(GwArticle gwArticle) + { + gwArticle.setUpdateTime(DateUtils.getNowDate()); + return gwArticleMapper.updateGwArticle(gwArticle); + } + + /** + * 批量删除官网文章列表 + * + * @param ids 需要删除的官网文章列表主键 + * @return 结果 + */ + @Override + public int deleteGwArticleByIds(Long[] ids) + { + return gwArticleMapper.deleteGwArticleByIds(ids); + } + + /** + * 删除官网文章列表信息 + * + * @param id 官网文章列表主键 + * @return 结果 + */ + @Override + public int deleteGwArticleById(Long id) + { + return gwArticleMapper.deleteGwArticleById(id); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/GwCategoryServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/GwCategoryServiceImpl.java new file mode 100644 index 0000000..3c17c70 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/GwCategoryServiceImpl.java @@ -0,0 +1,96 @@ +package com.ruoyi.system.service.impl; + +import java.util.List; +import com.ruoyi.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.system.mapper.GwCategoryMapper; +import com.ruoyi.system.domain.GwCategory; +import com.ruoyi.system.service.IGwCategoryService; + +/** + * 文章分类Service业务层处理 + * + * @author lb + * @date 2024-04-28 + */ +@Service +public class GwCategoryServiceImpl implements IGwCategoryService +{ + @Autowired + private GwCategoryMapper gwCategoryMapper; + + /** + * 查询文章分类 + * + * @param id 文章分类主键 + * @return 文章分类 + */ + @Override + public GwCategory selectGwCategoryById(Long id) + { + return gwCategoryMapper.selectGwCategoryById(id); + } + + /** + * 查询文章分类列表 + * + * @param gwCategory 文章分类 + * @return 文章分类 + */ + @Override + public List selectGwCategoryList(GwCategory gwCategory) + { + return gwCategoryMapper.selectGwCategoryList(gwCategory); + } + + /** + * 新增文章分类 + * + * @param gwCategory 文章分类 + * @return 结果 + */ + @Override + public int insertGwCategory(GwCategory gwCategory) + { + gwCategory.setCreateTime(DateUtils.getNowDate()); + return gwCategoryMapper.insertGwCategory(gwCategory); + } + + /** + * 修改文章分类 + * + * @param gwCategory 文章分类 + * @return 结果 + */ + @Override + public int updateGwCategory(GwCategory gwCategory) + { + gwCategory.setUpdateTime(DateUtils.getNowDate()); + return gwCategoryMapper.updateGwCategory(gwCategory); + } + + /** + * 批量删除文章分类 + * + * @param ids 需要删除的文章分类主键 + * @return 结果 + */ + @Override + public int deleteGwCategoryByIds(Long[] ids) + { + return gwCategoryMapper.deleteGwCategoryByIds(ids); + } + + /** + * 删除文章分类信息 + * + * @param id 文章分类主键 + * @return 结果 + */ + @Override + public int deleteGwCategoryById(Long id) + { + return gwCategoryMapper.deleteGwCategoryById(id); + } +} diff --git a/ruoyi-system/src/main/resources/mapper/system/GwArticleMapper.xml b/ruoyi-system/src/main/resources/mapper/system/GwArticleMapper.xml new file mode 100644 index 0000000..c0a1735 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/GwArticleMapper.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + select id, category_id, title, content, cover_img, create_by, create_time, update_by, update_time, remark, del_flag from gw_article + + + + + + + + insert into gw_article + + category_id, + title, + content, + cover_img, + create_by, + create_time, + update_by, + update_time, + remark, + del_flag, + + + #{categoryId}, + #{title}, + #{content}, + #{coverImg}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{remark}, + #{delFlag}, + + + + + update gw_article + + category_id = #{categoryId}, + title = #{title}, + content = #{content}, + cover_img = #{coverImg}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + remark = #{remark}, + del_flag = #{delFlag}, + + where id = #{id} + + + + delete from gw_article where id = #{id} + + + + delete from gw_article where id in + + #{id} + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/GwCategoryMapper.xml b/ruoyi-system/src/main/resources/mapper/system/GwCategoryMapper.xml new file mode 100644 index 0000000..8000cad --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/GwCategoryMapper.xml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + select id, parent_id, category_name, sort, create_by, create_time, update_by, update_time, remark, del_flag from gw_category + + + + + + + + insert into gw_category + + parent_id, + category_name, + sort, + create_by, + create_time, + update_by, + update_time, + remark, + del_flag, + + + #{parentId}, + #{categoryName}, + #{sort}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{remark}, + #{delFlag}, + + + + + update gw_category + + parent_id = #{parentId}, + category_name = #{categoryName}, + sort = #{sort}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + remark = #{remark}, + del_flag = #{delFlag}, + + where id = #{id} + + + + delete from gw_category where id = #{id} + + + + delete from gw_category where id in + + #{id} + + + \ No newline at end of file