refactor(service): 重构服务接口和实现类结构

将服务接口从service包移动到service.imp包
修复ArticleRepository中viewCount的COALESCE处理
添加getPublishedArticles方法获取已发布文章
优化incrementViewCount方法使用仓库直接更新
修正HelpController中README_API.md路径
This commit is contained in:
qingfeng1121
2025-10-26 20:18:35 +08:00
parent 46be613f28
commit 9132feb870
15 changed files with 87 additions and 54 deletions

View File

@@ -1,81 +0,0 @@
package com.qf.myafterprojecy.service;
import com.qf.myafterprojecy.pojo.Article;
import com.qf.myafterprojecy.pojo.ResponseMessage;
import com.qf.myafterprojecy.pojo.dto.ArticleDto;
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);
/**
* 创建新文章
* 仅限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);
}