diff --git a/src/main/java/com/dd/admin/business/api/AuthApi.java b/src/main/java/com/dd/admin/business/api/AuthApi.java index 750f56e..1e7b3ce 100644 --- a/src/main/java/com/dd/admin/business/api/AuthApi.java +++ b/src/main/java/com/dd/admin/business/api/AuthApi.java @@ -19,6 +19,8 @@ import com.dd.admin.business.follow.entity.Follow; import com.dd.admin.business.follow.service.FollowService; import com.dd.admin.business.note.domain.NoteDto; import com.dd.admin.business.note.domain.NoteVo; +import com.dd.admin.business.note.domain.ReplayMeVo; +import com.dd.admin.business.note.domain.UpMeVo; import com.dd.admin.business.note.entity.Note; import com.dd.admin.business.note.service.NoteService; import com.dd.admin.business.noteImg.entity.NoteImg; @@ -617,6 +619,23 @@ public class AuthApi { replyDto.setAuthorReplay(TRUE); } + //如果上级pid不为空 设置 上级作者名和id + if(StringUtil.isNotEmpty(replyDto.getParentId())){ + Reply parentReply = replyService.getById(replyDto.getParentId()); + replyDto.setParentAuthorName(parentReply.getAuthorName()); + replyDto.setParentAuthorId(parentReply.getAuthorId()); + //如果top不为空 设置第二级回复的 上级作者名和id + }else if(StringUtil.isNotEmpty(replyDto.getTopParentId())){ + Reply parentReply = replyService.getById(replyDto.getTopParentId()); + replyDto.setParentAuthorName(parentReply.getAuthorName()); + replyDto.setParentAuthorId(parentReply.getAuthorId()); + //如果评论没有上级id和顶级id则回复的是笔记的作者 + }else if(StringUtil.isEmpty(replyDto.getParentId())&&StringUtil.isEmpty(replyDto.getTopParentId())){ + replyDto.setParentAuthorName(note.getAuthorName()); + replyDto.setParentAuthorId(note.getAuthorId()); + } + + List replyList = replyService.selectReplyList(new ReplyDto().setNoteId(replyDto.getNoteId())); if (CollectionUtil.isEmpty(replyList)) { replyDto.setFirstReplay(TRUE); @@ -709,4 +728,26 @@ public class AuthApi { Integer unReadCount = chatService.selectUnReadCount(loginId); return ResultBean.success(unReadCount); }; + + + @ApiOperation(value = "获取所有收藏点赞我的笔记记录") + @ApiOperationSupport(order = 1) + @GetMapping("/api/auth/getUpMeNotes") + @OperLog(operModule = "获取所有收藏点赞我的笔记记录",operType = OperType.QUERY,operDesc = "获取所有收藏点赞我的笔记记录") + public ResultBean> getUpMeNotes() { + String authorId = String.valueOf(request.getAttribute("authorId")); + IPage upMeVoIPage = noteService.selectUpMeNotes(authorId); + return ResultBean.success(upMeVoIPage); + } + + + @ApiOperation(value = "获取所有评论我的笔记记录") + @ApiOperationSupport(order = 1) + @GetMapping("/api/auth/getReplayMes") + @OperLog(operModule = "获取所有评论我的笔记记录",operType = OperType.QUERY,operDesc = "获取所有评论我的笔记记录") + public ResultBean> getReplayMes() { + String authorId = String.valueOf(request.getAttribute("authorId")); + IPage replyMeNotes = noteService.selectReplyMeNotes(authorId); + return ResultBean.success(replyMeNotes); + } } diff --git a/src/main/java/com/dd/admin/business/note/domain/ReplayMeVo.java b/src/main/java/com/dd/admin/business/note/domain/ReplayMeVo.java new file mode 100644 index 0000000..6a3160d --- /dev/null +++ b/src/main/java/com/dd/admin/business/note/domain/ReplayMeVo.java @@ -0,0 +1,29 @@ +package com.dd.admin.business.note.domain; + +import io.swagger.annotations.ApiModel; +import lombok.Data; + +@Data +@ApiModel(value="笔记表返回对象") +public class ReplayMeVo { + private String replyId; + // 对应r.note_id,假设在数据库中为字符串类型,如果是其他类型可自行调整 + private String noteId; + // 对应b.note_title,假设为字符串类型存储笔记标题 + private String noteTitle; + // 对应a.author_id,假设为字符串类型的作者ID + private String authorId; + // 对应a.author_name,字符串类型的作者姓名 + private String authorName; + // 对应a.AVATAR_URL,字符串类型的作者头像链接 + private String avatarUrl; + // 对应r.create_time,这里使用Java的Date类型表示创建时间,根据实际数据库字段类型可能需要调整,比如使用LocalDateTime等更合适的时间类型 + private String createTime; + // 对应r.REPLAY_CONTENT,回复内容,假设为字符串类型 + private String replayContent; + private String parentReplayContent; + // 对应b.FIRST_PICTURE,笔记首张图片相关信息,假设为字符串类型,比如图片路径或者URL等,根据实际业务存储情况调整 + private String firstPicture; + private String type; // 1回复笔记: 2回复评论: + +} diff --git a/src/main/java/com/dd/admin/business/note/domain/UpMeVo.java b/src/main/java/com/dd/admin/business/note/domain/UpMeVo.java new file mode 100644 index 0000000..c97c1c1 --- /dev/null +++ b/src/main/java/com/dd/admin/business/note/domain/UpMeVo.java @@ -0,0 +1,17 @@ +package com.dd.admin.business.note.domain; + +import io.swagger.annotations.ApiModel; +import lombok.Data; + +@Data +@ApiModel(value="笔记表返回对象") +public class UpMeVo { + private String noteId; + private String noteTitle; + private String followId; + private String followName; + private String avatarUrl; + private String createTime; + private String firstPicture; + private String type; // 1点赞: 2收藏: +} diff --git a/src/main/java/com/dd/admin/business/note/mapper/NoteMapper.java b/src/main/java/com/dd/admin/business/note/mapper/NoteMapper.java index f88f45a..a13da88 100644 --- a/src/main/java/com/dd/admin/business/note/mapper/NoteMapper.java +++ b/src/main/java/com/dd/admin/business/note/mapper/NoteMapper.java @@ -1,7 +1,10 @@ package com.dd.admin.business.note.mapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.dd.admin.business.note.domain.ReplayMeVo; +import com.dd.admin.business.note.domain.UpMeVo; import com.dd.admin.business.noteImg.domain.NoteImgVo; +import com.sun.org.apache.regexp.internal.RE; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -31,4 +34,8 @@ public interface NoteMapper extends BaseMapper { IPage selectMineUpNotes(Page page, @Param("followId")String followId); IPage selectMineStarNotes(Page page, @Param("followId")String followId); + + IPage selectUpMeNotes(Page page, @Param("authorId")String authorId); + IPage selectReplyMeNotes(Page page, @Param("authorId")String authorId); + } diff --git a/src/main/java/com/dd/admin/business/note/mapper/xml/NoteMapper.xml b/src/main/java/com/dd/admin/business/note/mapper/xml/NoteMapper.xml index 7486d59..7d78320 100644 --- a/src/main/java/com/dd/admin/business/note/mapper/xml/NoteMapper.xml +++ b/src/main/java/com/dd/admin/business/note/mapper/xml/NoteMapper.xml @@ -117,6 +117,7 @@ where b.follow_id = #{followId} order by b.create_time desc + + + + diff --git a/src/main/java/com/dd/admin/business/note/service/NoteService.java b/src/main/java/com/dd/admin/business/note/service/NoteService.java index e6d9cca..868d293 100644 --- a/src/main/java/com/dd/admin/business/note/service/NoteService.java +++ b/src/main/java/com/dd/admin/business/note/service/NoteService.java @@ -2,6 +2,8 @@ package com.dd.admin.business.note.service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.dd.admin.business.note.domain.ReplayMeVo; +import com.dd.admin.business.note.domain.UpMeVo; import com.dd.admin.business.note.entity.Note; import com.baomidou.mybatisplus.extension.service.IService; import com.dd.admin.business.note.domain.NoteVo; @@ -31,5 +33,8 @@ public interface NoteService extends IService { IPage selectMineStarNotes( String followId); + IPage selectUpMeNotes(String authorId); + + IPage selectReplyMeNotes(String authorId); } diff --git a/src/main/java/com/dd/admin/business/note/service/impl/NoteServiceImpl.java b/src/main/java/com/dd/admin/business/note/service/impl/NoteServiceImpl.java index 2b183e6..43a77c9 100644 --- a/src/main/java/com/dd/admin/business/note/service/impl/NoteServiceImpl.java +++ b/src/main/java/com/dd/admin/business/note/service/impl/NoteServiceImpl.java @@ -2,6 +2,8 @@ package com.dd.admin.business.note.service.impl; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.dd.admin.business.note.domain.ReplayMeVo; +import com.dd.admin.business.note.domain.UpMeVo; import com.dd.admin.common.model.PageFactory; import com.dd.admin.business.note.entity.Note; import com.dd.admin.business.note.mapper.NoteMapper; @@ -50,4 +52,16 @@ public class NoteServiceImpl extends ServiceImpl implements No Page page = PageFactory.defaultPage(); return baseMapper.selectMineStarNotes(page,followId); } + + @Override + public IPage selectUpMeNotes(String authorId) { + Page page = PageFactory.defaultPage(); + return baseMapper.selectUpMeNotes(page,authorId); + } + + @Override + public IPage selectReplyMeNotes(String authorId) { + Page page = PageFactory.defaultPage(); + return baseMapper.selectReplyMeNotes(page,authorId); + } } diff --git a/src/main/java/com/dd/admin/business/reply/mapper/ReplyMapper.java b/src/main/java/com/dd/admin/business/reply/mapper/ReplyMapper.java index 49b892c..0085077 100644 --- a/src/main/java/com/dd/admin/business/reply/mapper/ReplyMapper.java +++ b/src/main/java/com/dd/admin/business/reply/mapper/ReplyMapper.java @@ -25,4 +25,5 @@ public interface ReplyMapper extends BaseMapper { IPage selectReplyPage(Page page, @Param("replyDto") ReplyDto replyDto); List selectReplyList(@Param("replyDto") ReplyDto replyDto); + } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 90d8ff2..10ad328 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -63,7 +63,7 @@ tio: websocket: server: port: 9326 - heartbeat-timeout: 6000 + heartbeat-timeout: 10000 # 集群配置 默认关闭 cluster: enabled: false