blob: ca5376b390244ffc5e97072b0d91ce018324b8d3 [file] [log] [blame]
wuchimedese5722e32025-04-13 17:38:50 +08001package com.example.g8backend.service;
2
夜雨声烦368e3562025-04-24 01:49:46 +08003import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
wuchimedese5722e32025-04-13 17:38:50 +08004import com.example.g8backend.entity.Post;
5import com.baomidou.mybatisplus.extension.service.IService;
夜雨声烦368e3562025-04-24 01:49:46 +08006import org.springframework.scheduling.annotation.Scheduled;
夜雨声烦f4b8b6f2025-04-24 00:58:36 +08007import org.springframework.transaction.annotation.Transactional;
wuchimedes5a842b22025-04-21 22:01:39 +08008
wuchimedese5722e32025-04-13 17:38:50 +08009import java.util.List;
10
11public interface IPostService extends IService<Post> {
12 List<Post> getPostsByUserId(Long userId);
wuchimedes5a842b22025-04-21 22:01:39 +080013 void createPost(Post post);
14 void createPost(Post post, Long[] tagIds);
223010711f457dc2025-04-15 17:35:55 +080015 Post updatePost(Post post);
16 List<Post> getPostsByType(String postType);
17 Long getPostLikeCount(Long postId);
18 void likePost(Long userId, Long postId);
19 void unlikePost(Long userId, Long postId);
夜雨声烦4527a722025-04-23 17:04:25 +080020
21 List<Post> searchPosts(String keyword, List<Long> tagIds, String author); // 更新为支持多个标签
夜雨声烦f4b8b6f2025-04-24 00:58:36 +080022
23 @Transactional
24 void recordViewHistory(Long userId, Long postId);
夜雨声烦368e3562025-04-24 01:49:46 +080025
26 @Scheduled(cron = "0 */10 * * * *") // 每10分钟执行一次
27 @Transactional
28 void calculateHotScores();
29
30 Page<Post> getRecommendedPosts(int page, int size, Long userId);
wuchimedese5722e32025-04-13 17:38:50 +080031}