refactor(项目结构): 重构项目包结构和异常处理
- 将ResponseMessage和GlobalExceptionHandler移动到exceptopn包 - 重构服务接口包结构,将接口从service.imp移动到service包 - 更新所有控制器中ResponseMessage的引用路径 - 统一服务接口命名规范,去除I前缀 - 调整application.properties配置,统一服务端口 - 优化SecurityConfig权限配置,简化API访问控制 - 清理旧的日志文件 - 更新开发环境配置,添加前端开发端口支持
This commit is contained in:
102
src/main/java/com/qf/myafterprojecy/service/IArticleService.java
Normal file
102
src/main/java/com/qf/myafterprojecy/service/IArticleService.java
Normal file
@@ -0,0 +1,102 @@
|
||||
package com.qf.myafterprojecy.service;
|
||||
|
||||
import com.qf.myafterprojecy.exceptopn.ResponseMessage;
|
||||
import com.qf.myafterprojecy.pojo.Article;
|
||||
import com.qf.myafterprojecy.pojo.dto.ArticleDto;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IArticleService {
|
||||
ResponseMessage<Article> getArticleById(String id);
|
||||
|
||||
ResponseMessage<List<Article>> getAllArticles();
|
||||
|
||||
/**
|
||||
* 根据标题查询文章列表
|
||||
*
|
||||
* @param title 文章标题的一部分,用于模糊查询
|
||||
* @return 返回符合查询条件的文章列表
|
||||
*/
|
||||
ResponseMessage<List<Article>> getArticlesByTitle(String title);
|
||||
/**
|
||||
* 根据状态获取文章列表
|
||||
* @param status 文章状态(0:未发表 1:已发表 2:已删除)
|
||||
* @return 返回包含文章列表的ResponseMessage对象
|
||||
*/
|
||||
ResponseMessage<List<Article>> getArticlesByStatus(Integer status);
|
||||
|
||||
/**
|
||||
* 创建新文章
|
||||
* 仅限AUTHOR角色用户访问
|
||||
*
|
||||
* @param articleDto 包含文章数据的DTO对象
|
||||
* @return 返回包含新创建文章信息的ResponseMessage对象
|
||||
*/
|
||||
ResponseMessage<Article> saveArticle(ArticleDto articleDto);
|
||||
|
||||
/**
|
||||
* 更新指定ID的文章
|
||||
*
|
||||
* @param id 文章ID
|
||||
* @param articleDto 包含更新信息的ArticleDto对象
|
||||
* @return 返回包含操作结果的ResponseMessage对象
|
||||
*/
|
||||
ResponseMessage<Article> updateArticle(Integer id, ArticleDto articleDto);
|
||||
|
||||
/**
|
||||
* 删除指定ID的文章
|
||||
*
|
||||
* @param id 文章ID
|
||||
* @return 返回包含操作结果的ResponseMessage对象
|
||||
*/
|
||||
ResponseMessage<Article> deleteArticle(Integer id);
|
||||
|
||||
/**
|
||||
* 根据分类ID查询文章列表(兼容旧接口)
|
||||
*
|
||||
* @param typeid 分类ID
|
||||
* @return 返回符合查询条件的文章列表
|
||||
*/
|
||||
ResponseMessage<List<Article>> getArticlesByCategory(Integer typeid);
|
||||
|
||||
/**
|
||||
* 根据属性ID查询文章列表
|
||||
*
|
||||
* @param attributeid 属性ID
|
||||
* @return 返回符合查询条件的文章列表
|
||||
*/
|
||||
ResponseMessage<List<Article>> getArticlesByAttribute(Integer attributeid);
|
||||
|
||||
/**
|
||||
* 根据属性ID查询最新文章列表
|
||||
*
|
||||
* @param attributeid 属性ID
|
||||
* @return 返回符合查询条件的最新文章列表
|
||||
*/
|
||||
ResponseMessage<List<Article>> getLatestArticlesByAttribute(Integer attributeid);
|
||||
|
||||
ResponseMessage<List<Article>> getMostViewedArticles();
|
||||
|
||||
/**
|
||||
* 增加文章浏览量
|
||||
*
|
||||
* @param id 文章ID
|
||||
* @return 返回包含更新后文章信息的ResponseMessage对象
|
||||
*/
|
||||
ResponseMessage<Article> incrementViewCount(Integer id);
|
||||
/**
|
||||
* 获取已发布的文章列表
|
||||
* @return 返回包含已发布文章列表的ResponseMessage对象
|
||||
*/
|
||||
ResponseMessage<List<Article>> getPublishedArticles();
|
||||
|
||||
/**
|
||||
* 根据状态分页查询文章列表
|
||||
* @param status 文章状态(0:未发表 1:已发表 2:已删除)
|
||||
* @param page 页码,从0开始
|
||||
* @param size 每页大小
|
||||
* @return 返回包含分页文章列表的ResponseMessage对象
|
||||
*/
|
||||
ResponseMessage<Page<Article>> getArticlesByStatusWithPagination(Integer status, Integer page, Integer size);
|
||||
}
|
||||
Reference in New Issue
Block a user