From 6977fa5c5012e2f436defa8b64cb28e63d1c752b Mon Sep 17 00:00:00 2001 From: lee <332870766@qq.com> Date: Fri, 26 Jul 2024 15:42:38 +0800 Subject: [PATCH] =?UTF-8?q?2024.7.10=20=E6=96=B0=E5=85=83=E7=B4=A0?= =?UTF-8?q?=E5=AE=98=E7=BD=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/system/DoorController.java | 15 +- .../system/XysCategoryController.java | 104 + .../framework/config/SecurityConfig.java | 8 +- .../com/ruoyi/system/domain/XysArticle.java | 38 +- .../com/ruoyi/system/domain/XysCategory.java | 111 + .../ruoyi/system/mapper/XysArticleMapper.java | 23 +- .../system/mapper/XysCategoryMapper.java | 61 + .../system/service/IXysArticleService.java | 23 +- .../system/service/IXysCategoryService.java | 61 + .../service/impl/XysArticleServiceImpl.java | 21 +- .../service/impl/XysCategoryServiceImpl.java | 96 + .../mapper/system/XysArticleMapper.xml | 32 +- .../mapper/system/XysCategoryMapper.xml | 97 + ruoyi-ui/src/api/system/category.js | 44 + ruoyi-ui/src/views/index.vue | 2096 ++++++++--------- ruoyi-ui/src/views/system/article/index.vue | 7 +- ruoyi-ui/src/views/system/category/index.vue | 288 +++ 17 files changed, 2025 insertions(+), 1100 deletions(-) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/XysCategoryController.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/XysCategory.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/XysCategoryMapper.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/IXysCategoryService.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/XysCategoryServiceImpl.java create mode 100644 ruoyi-system/src/main/resources/mapper/system/XysCategoryMapper.xml create mode 100644 ruoyi-ui/src/api/system/category.js create mode 100644 ruoyi-ui/src/views/system/category/index.vue 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 b5a1b4e..2ae383c 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 @@ -33,8 +33,19 @@ public class DoorController extends BaseController @Autowired private IXysImgService xysImgService; + /** - * 查询文章列表 + * 首页文章 + */ + @GetMapping("/getHomeArticleList") + public TableDataInfo getHomeArticleList(XysArticle xysArticle) + { + List list = xysArticleService.selectHomeArticleList(xysArticle); + return getDataTable(list); + } + + /** + * 查询新闻动态文章列表 */ @GetMapping("/getArticleList") public TableDataInfo getArticleList(XysArticle xysArticle) @@ -58,7 +69,7 @@ public class DoorController extends BaseController /** * 获取文章管理详细信息 */ - @GetMapping(value = "/{id}") + @GetMapping(value = "/getArticle/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return success(xysArticleService.selectXysArticleById(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 new file mode 100644 index 0000000..7f5dbe1 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/XysCategoryController.java @@ -0,0 +1,104 @@ +package com.ruoyi.system.controller; + +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.XysCategory; +import com.ruoyi.system.service.IXysCategoryService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 文章分类Controller + * + * @author libao + * @date 2024-07-25 + */ +@RestController +@RequestMapping("/system/category") +public class XysCategoryController extends BaseController +{ + @Autowired + private IXysCategoryService xysCategoryService; + + /** + * 查询文章分类列表 + */ + @PreAuthorize("@ss.hasPermi('system:category:list')") + @GetMapping("/list") + public TableDataInfo list(XysCategory xysCategory) + { + startPage(); + List list = xysCategoryService.selectXysCategoryList(xysCategory); + return getDataTable(list); + } + + /** + * 导出文章分类列表 + */ + @PreAuthorize("@ss.hasPermi('system:category:export')") + @Log(title = "文章分类", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, XysCategory xysCategory) + { + List list = xysCategoryService.selectXysCategoryList(xysCategory); + ExcelUtil util = new ExcelUtil(XysCategory.class); + util.exportExcel(response, list, "文章分类数据"); + } + + /** + * 获取文章分类详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:category:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(xysCategoryService.selectXysCategoryById(id)); + } + + /** + * 新增文章分类 + */ + @PreAuthorize("@ss.hasPermi('system:category:add')") + @Log(title = "文章分类", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody XysCategory xysCategory) + { + return toAjax(xysCategoryService.insertXysCategory(xysCategory)); + } + + /** + * 修改文章分类 + */ + @PreAuthorize("@ss.hasPermi('system:category:edit')") + @Log(title = "文章分类", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody XysCategory xysCategory) + { + return toAjax(xysCategoryService.updateXysCategory(xysCategory)); + } + + /** + * 删除文章分类 + */ + @PreAuthorize("@ss.hasPermi('system:category:remove')") + @Log(title = "文章分类", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(xysCategoryService.deleteXysCategoryByIds(ids)); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java index 2125853..f4304f0 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java @@ -22,7 +22,7 @@ import com.ruoyi.framework.security.handle.LogoutSuccessHandlerImpl; /** * spring security配置 - * + * * @author ruoyi */ @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) @@ -33,7 +33,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter */ @Autowired private UserDetailsService userDetailsService; - + /** * 认证失败处理类 */ @@ -51,7 +51,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter */ @Autowired private JwtAuthenticationTokenFilter authenticationTokenFilter; - + /** * 跨域过滤器 */ @@ -111,7 +111,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter // 过滤请求 .authorizeRequests() // 对于登录login 注册register 验证码captchaImage 允许匿名访问 - .antMatchers("/login", "/register", "/captchaImage").permitAll() + .antMatchers("/login", "/register", "/captchaImage","/door/**").permitAll() // 静态资源,可匿名访问 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() 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 0c92536..575f964 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 @@ -7,7 +7,7 @@ import com.ruoyi.common.core.domain.BaseEntity; /** * 文章管理对象 xys_article - * + * * @author libao * @date 2024-07-08 */ @@ -26,6 +26,18 @@ public class XysArticle extends BaseEntity @Excel(name = "封面图") private String coverImg; + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + /** 简介 */ + @Excel(name = "简介") + private String description; + /** 内容 */ @Excel(name = "内容") private String content; @@ -37,57 +49,57 @@ public class XysArticle extends BaseEntity /** $column.columnComment */ private String delFlag; - public void setId(Long id) + public void setId(Long id) { this.id = id; } - public Long getId() + public Long getId() { return id; } - public void setTitle(String title) + public void setTitle(String title) { this.title = title; } - public String getTitle() + public String getTitle() { return title; } - public void setCoverImg(String coverImg) + public void setCoverImg(String coverImg) { this.coverImg = coverImg; } - public String getCoverImg() + public String getCoverImg() { return coverImg; } - public void setContent(String content) + public void setContent(String content) { this.content = content; } - public String getContent() + public String getContent() { return content; } - public void setArticleCat(Long articleCat) + public void setArticleCat(Long articleCat) { this.articleCat = articleCat; } - public Long getArticleCat() + public Long getArticleCat() { return articleCat; } - public void setDelFlag(String delFlag) + public void setDelFlag(String delFlag) { this.delFlag = delFlag; } - public String getDelFlag() + public String getDelFlag() { return delFlag; } 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 new file mode 100644 index 0000000..a364b5d --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/XysCategory.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; + +/** + * 文章分类对象 xys_category + * + * @author libao + * @date 2024-07-25 + */ +public class XysCategory extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 文章分类 */ + private Long id; + + /** 上级分类 */ + @Excel(name = "上级分类") + private Long parentId; + + /** 分类名称 */ + @Excel(name = "分类名称") + private String title; + + /** 封面图 */ + @Excel(name = "封面图") + private String coverImg; + + /** 简介 */ + @Excel(name = "简介") + private String description; + + /** */ + 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 setTitle(String title) + { + this.title = title; + } + + public String getTitle() + { + return title; + } + public void setCoverImg(String coverImg) + { + this.coverImg = coverImg; + } + + public String getCoverImg() + { + return coverImg; + } + public void setDescription(String description) + { + this.description = description; + } + + public String getDescription() + { + return description; + } + 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("title", getTitle()) + .append("coverImg", getCoverImg()) + .append("description", getDescription()) + .append("createTime", getCreateTime()) + .append("createBy", getCreateBy()) + .append("updateTime", getUpdateTime()) + .append("updateBy", getUpdateBy()) + .append("remark", getRemark()) + .append("delFlag", getDelFlag()) + .toString(); + } +} 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 3f9b488..55ea76d 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 @@ -5,15 +5,15 @@ import com.ruoyi.system.domain.XysArticle; /** * 文章管理Mapper接口 - * + * * @author libao * @date 2024-07-08 */ -public interface XysArticleMapper +public interface XysArticleMapper { /** * 查询文章管理 - * + * * @param id 文章管理主键 * @return 文章管理 */ @@ -21,15 +21,22 @@ public interface XysArticleMapper /** * 查询文章管理列表 - * + * * @param xysArticle 文章管理 * @return 文章管理集合 */ public List selectXysArticleList(XysArticle xysArticle); + /** + * 首页文章 + * @param xysArticle + * @return + */ + public List selectHomeArticleList(XysArticle xysArticle); + /** * 新增文章管理 - * + * * @param xysArticle 文章管理 * @return 结果 */ @@ -37,7 +44,7 @@ public interface XysArticleMapper /** * 修改文章管理 - * + * * @param xysArticle 文章管理 * @return 结果 */ @@ -45,7 +52,7 @@ public interface XysArticleMapper /** * 删除文章管理 - * + * * @param id 文章管理主键 * @return 结果 */ @@ -53,7 +60,7 @@ public interface XysArticleMapper /** * 批量删除文章管理 - * + * * @param ids 需要删除的数据主键集合 * @return 结果 */ 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 new file mode 100644 index 0000000..81edd53 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/XysCategoryMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.system.domain.XysCategory; + +/** + * 文章分类Mapper接口 + * + * @author libao + * @date 2024-07-25 + */ +public interface XysCategoryMapper +{ + /** + * 查询文章分类 + * + * @param id 文章分类主键 + * @return 文章分类 + */ + public XysCategory selectXysCategoryById(Long id); + + /** + * 查询文章分类列表 + * + * @param xysCategory 文章分类 + * @return 文章分类集合 + */ + public List selectXysCategoryList(XysCategory xysCategory); + + /** + * 新增文章分类 + * + * @param xysCategory 文章分类 + * @return 结果 + */ + public int insertXysCategory(XysCategory xysCategory); + + /** + * 修改文章分类 + * + * @param xysCategory 文章分类 + * @return 结果 + */ + public int updateXysCategory(XysCategory xysCategory); + + /** + * 删除文章分类 + * + * @param id 文章分类主键 + * @return 结果 + */ + public int deleteXysCategoryById(Long id); + + /** + * 批量删除文章分类 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteXysCategoryByIds(Long[] ids); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IXysArticleService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IXysArticleService.java index 0e1c55e..d7b948b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/IXysArticleService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IXysArticleService.java @@ -5,15 +5,15 @@ import com.ruoyi.system.domain.XysArticle; /** * 文章管理Service接口 - * + * * @author libao * @date 2024-07-08 */ -public interface IXysArticleService +public interface IXysArticleService { /** * 查询文章管理 - * + * * @param id 文章管理主键 * @return 文章管理 */ @@ -21,15 +21,22 @@ public interface IXysArticleService /** * 查询文章管理列表 - * + * * @param xysArticle 文章管理 * @return 文章管理集合 */ public List selectXysArticleList(XysArticle xysArticle); + /** + * 首页文章 + * @param xysArticle + * @return + */ + public List selectHomeArticleList(XysArticle xysArticle); + /** * 新增文章管理 - * + * * @param xysArticle 文章管理 * @return 结果 */ @@ -37,7 +44,7 @@ public interface IXysArticleService /** * 修改文章管理 - * + * * @param xysArticle 文章管理 * @return 结果 */ @@ -45,7 +52,7 @@ public interface IXysArticleService /** * 批量删除文章管理 - * + * * @param ids 需要删除的文章管理主键集合 * @return 结果 */ @@ -53,7 +60,7 @@ public interface IXysArticleService /** * 删除文章管理信息 - * + * * @param id 文章管理主键 * @return 结果 */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IXysCategoryService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IXysCategoryService.java new file mode 100644 index 0000000..6654846 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IXysCategoryService.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.ruoyi.system.domain.XysCategory; + +/** + * 文章分类Service接口 + * + * @author libao + * @date 2024-07-25 + */ +public interface IXysCategoryService +{ + /** + * 查询文章分类 + * + * @param id 文章分类主键 + * @return 文章分类 + */ + public XysCategory selectXysCategoryById(Long id); + + /** + * 查询文章分类列表 + * + * @param xysCategory 文章分类 + * @return 文章分类集合 + */ + public List selectXysCategoryList(XysCategory xysCategory); + + /** + * 新增文章分类 + * + * @param xysCategory 文章分类 + * @return 结果 + */ + public int insertXysCategory(XysCategory xysCategory); + + /** + * 修改文章分类 + * + * @param xysCategory 文章分类 + * @return 结果 + */ + public int updateXysCategory(XysCategory xysCategory); + + /** + * 批量删除文章分类 + * + * @param ids 需要删除的文章分类主键集合 + * @return 结果 + */ + public int deleteXysCategoryByIds(Long[] ids); + + /** + * 删除文章分类信息 + * + * @param id 文章分类主键 + * @return 结果 + */ + public int deleteXysCategoryById(Long id); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/XysArticleServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/XysArticleServiceImpl.java index 578013d..8dbb0fa 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/XysArticleServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/XysArticleServiceImpl.java @@ -10,19 +10,19 @@ import com.ruoyi.system.service.IXysArticleService; /** * 文章管理Service业务层处理 - * + * * @author libao * @date 2024-07-08 */ @Service -public class XysArticleServiceImpl implements IXysArticleService +public class XysArticleServiceImpl implements IXysArticleService { @Autowired private XysArticleMapper xysArticleMapper; /** * 查询文章管理 - * + * * @param id 文章管理主键 * @return 文章管理 */ @@ -34,7 +34,7 @@ public class XysArticleServiceImpl implements IXysArticleService /** * 查询文章管理列表 - * + * * @param xysArticle 文章管理 * @return 文章管理 */ @@ -44,9 +44,14 @@ public class XysArticleServiceImpl implements IXysArticleService return xysArticleMapper.selectXysArticleList(xysArticle); } + @Override + public List selectHomeArticleList(XysArticle xysArticle) { + return xysArticleMapper.selectHomeArticleList(xysArticle); + } + /** * 新增文章管理 - * + * * @param xysArticle 文章管理 * @return 结果 */ @@ -59,7 +64,7 @@ public class XysArticleServiceImpl implements IXysArticleService /** * 修改文章管理 - * + * * @param xysArticle 文章管理 * @return 结果 */ @@ -72,7 +77,7 @@ public class XysArticleServiceImpl implements IXysArticleService /** * 批量删除文章管理 - * + * * @param ids 需要删除的文章管理主键 * @return 结果 */ @@ -84,7 +89,7 @@ public class XysArticleServiceImpl implements IXysArticleService /** * 删除文章管理信息 - * + * * @param id 文章管理主键 * @return 结果 */ 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 new file mode 100644 index 0000000..5a35973 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/XysCategoryServiceImpl.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.XysCategoryMapper; +import com.ruoyi.system.domain.XysCategory; +import com.ruoyi.system.service.IXysCategoryService; + +/** + * 文章分类Service业务层处理 + * + * @author libao + * @date 2024-07-25 + */ +@Service +public class XysCategoryServiceImpl implements IXysCategoryService +{ + @Autowired + private XysCategoryMapper xysCategoryMapper; + + /** + * 查询文章分类 + * + * @param id 文章分类主键 + * @return 文章分类 + */ + @Override + public XysCategory selectXysCategoryById(Long id) + { + return xysCategoryMapper.selectXysCategoryById(id); + } + + /** + * 查询文章分类列表 + * + * @param xysCategory 文章分类 + * @return 文章分类 + */ + @Override + public List selectXysCategoryList(XysCategory xysCategory) + { + return xysCategoryMapper.selectXysCategoryList(xysCategory); + } + + /** + * 新增文章分类 + * + * @param xysCategory 文章分类 + * @return 结果 + */ + @Override + public int insertXysCategory(XysCategory xysCategory) + { + xysCategory.setCreateTime(DateUtils.getNowDate()); + return xysCategoryMapper.insertXysCategory(xysCategory); + } + + /** + * 修改文章分类 + * + * @param xysCategory 文章分类 + * @return 结果 + */ + @Override + public int updateXysCategory(XysCategory xysCategory) + { + xysCategory.setUpdateTime(DateUtils.getNowDate()); + return xysCategoryMapper.updateXysCategory(xysCategory); + } + + /** + * 批量删除文章分类 + * + * @param ids 需要删除的文章分类主键 + * @return 结果 + */ + @Override + public int deleteXysCategoryByIds(Long[] ids) + { + return xysCategoryMapper.deleteXysCategoryByIds(ids); + } + + /** + * 删除文章分类信息 + * + * @param id 文章分类主键 + * @return 结果 + */ + @Override + public int deleteXysCategoryById(Long id) + { + return xysCategoryMapper.deleteXysCategoryById(id); + } +} diff --git a/ruoyi-system/src/main/resources/mapper/system/XysArticleMapper.xml b/ruoyi-system/src/main/resources/mapper/system/XysArticleMapper.xml index 34e546e..4dba8d7 100644 --- a/ruoyi-system/src/main/resources/mapper/system/XysArticleMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/XysArticleMapper.xml @@ -3,11 +3,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + + @@ -19,17 +20,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select id, title, cover_img, content, article_cat, create_time, create_by, update_time, update_by, remark, del_flag from xys_article + 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,description,create_time from xys_article + + 1=1 and article_cat = 7 and title = #{title} and article_cat = #{articleCat} + order by create_time desc + limit 3 - + + + + + + and parent_id = #{parentId} + and title = #{title} + and cover_img = #{coverImg} + and description = #{description} + + + + + + + insert into xys_category + + id, + parent_id, + title, + cover_img, + description, + create_time, + create_by, + update_time, + update_by, + remark, + del_flag, + + + #{id}, + #{parentId}, + #{title}, + #{coverImg}, + #{description}, + #{createTime}, + #{createBy}, + #{updateTime}, + #{updateBy}, + #{remark}, + #{delFlag}, + + + + + update xys_category + + parent_id = #{parentId}, + title = #{title}, + cover_img = #{coverImg}, + description = #{description}, + create_time = #{createTime}, + create_by = #{createBy}, + update_time = #{updateTime}, + update_by = #{updateBy}, + remark = #{remark}, + del_flag = #{delFlag}, + + where id = #{id} + + + + delete from xys_category where id = #{id} + + + + delete from xys_category where id in + + #{id} + + + diff --git a/ruoyi-ui/src/api/system/category.js b/ruoyi-ui/src/api/system/category.js new file mode 100644 index 0000000..1b406bc --- /dev/null +++ b/ruoyi-ui/src/api/system/category.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询文章分类列表 +export function listCategory(query) { + return request({ + url: '/system/category/list', + method: 'get', + params: query + }) +} + +// 查询文章分类详细 +export function getCategory(id) { + return request({ + url: '/system/category/' + id, + method: 'get' + }) +} + +// 新增文章分类 +export function addCategory(data) { + return request({ + url: '/system/category', + method: 'post', + data: data + }) +} + +// 修改文章分类 +export function updateCategory(data) { + return request({ + url: '/system/category', + method: 'put', + data: data + }) +} + +// 删除文章分类 +export function delCategory(id) { + return request({ + url: '/system/category/' + id, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/views/index.vue b/ruoyi-ui/src/views/index.vue index f1b4a01..7287d54 100644 --- a/ruoyi-ui/src/views/index.vue +++ b/ruoyi-ui/src/views/index.vue @@ -1,1067 +1,1067 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + diff --git a/ruoyi-ui/src/views/system/article/index.vue b/ruoyi-ui/src/views/system/article/index.vue index a257f06..71622c4 100644 --- a/ruoyi-ui/src/views/system/article/index.vue +++ b/ruoyi-ui/src/views/system/article/index.vue @@ -75,6 +75,7 @@ +