feat: 增强情绪博物馆项目功能 - 新增用户评论和帖子功能,优化前端架构和WebSocket通信 - 更新文档和部署配置
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
package com.emotionmuseum.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.emotionmuseum.entity.DiaryPost;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* 日记Mapper接口
|
||||
*
|
||||
* @author emotion-museum
|
||||
* @version 1.0.0
|
||||
* @since 2024-01-01
|
||||
*/
|
||||
@Mapper
|
||||
public interface DiaryPostMapper extends BaseMapper<DiaryPost> {
|
||||
|
||||
/**
|
||||
* 分页查询用户的日记
|
||||
*/
|
||||
@Select("SELECT * FROM diary_post WHERE user_id = #{userId} AND deleted = 0 ORDER BY create_time DESC")
|
||||
IPage<DiaryPost> selectUserDiaries(Page<DiaryPost> page, @Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* 分页查询公开的日记
|
||||
*/
|
||||
@Select("SELECT * FROM diary_post WHERE is_public = 1 AND status = 1 AND deleted = 0 ORDER BY create_time DESC")
|
||||
IPage<DiaryPost> selectPublicDiaries(Page<DiaryPost> page);
|
||||
|
||||
/**
|
||||
* 根据情绪标签查询日记
|
||||
*/
|
||||
@Select("SELECT * FROM diary_post WHERE emotion_tags LIKE CONCAT('%', #{emotionTag}, '%') AND is_public = 1 AND status = 1 AND deleted = 0 ORDER BY create_time DESC")
|
||||
IPage<DiaryPost> selectDiariesByEmotionTag(Page<DiaryPost> page, @Param("emotionTag") String emotionTag);
|
||||
|
||||
/**
|
||||
* 统计用户的日记数量
|
||||
*/
|
||||
@Select("SELECT COUNT(*) FROM diary_post WHERE user_id = #{userId} AND deleted = 0")
|
||||
int countByUserId(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* 统计公开日记数量
|
||||
*/
|
||||
@Select("SELECT COUNT(*) FROM diary_post WHERE is_public = 1 AND status = 1 AND deleted = 0")
|
||||
int countPublicDiaries();
|
||||
}
|
||||
Reference in New Issue
Block a user