完善回复功能
This commit is contained in:
parent
0e35af0c79
commit
b4663e0b88
@ -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<ReplyVo> 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<IPage<UpMeVo>> getUpMeNotes() {
|
||||
String authorId = String.valueOf(request.getAttribute("authorId"));
|
||||
IPage<UpMeVo> 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<IPage<UpMeVo>> getReplayMes() {
|
||||
String authorId = String.valueOf(request.getAttribute("authorId"));
|
||||
IPage<ReplayMeVo> replyMeNotes = noteService.selectReplyMeNotes(authorId);
|
||||
return ResultBean.success(replyMeNotes);
|
||||
}
|
||||
}
|
||||
|
@ -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回复评论:
|
||||
|
||||
}
|
17
src/main/java/com/dd/admin/business/note/domain/UpMeVo.java
Normal file
17
src/main/java/com/dd/admin/business/note/domain/UpMeVo.java
Normal file
@ -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收藏:
|
||||
}
|
@ -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<Note> {
|
||||
|
||||
IPage<NoteVo> selectMineUpNotes(Page<NoteVo> page, @Param("followId")String followId);
|
||||
IPage<NoteVo> selectMineStarNotes(Page<NoteVo> page, @Param("followId")String followId);
|
||||
|
||||
IPage<UpMeVo> selectUpMeNotes(Page<NoteVo> page, @Param("authorId")String authorId);
|
||||
IPage<ReplayMeVo> selectReplyMeNotes(Page<NoteVo> page, @Param("authorId")String authorId);
|
||||
|
||||
}
|
||||
|
@ -117,6 +117,7 @@
|
||||
where b.follow_id = #{followId}
|
||||
order by b.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectMineStarNotes" resultType="com.dd.admin.business.note.domain.NoteVo">
|
||||
select * from business_note a left join business_star_notes b on a.note_id = b.note_id
|
||||
where b.follow_id = #{followId}
|
||||
@ -186,4 +187,83 @@
|
||||
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectUpMeNotes" resultType="com.dd.admin.business.note.domain.UpMeVo">
|
||||
SELECT
|
||||
n.note_id,
|
||||
n.note_title,
|
||||
n.follow_id,
|
||||
n.follow_name,
|
||||
a.AVATAR_URL,
|
||||
n.create_time,
|
||||
b.FIRST_PICTURE, CASE
|
||||
WHEN n.AUTHOR_ID IN (
|
||||
SELECT
|
||||
AUTHOR_ID
|
||||
FROM
|
||||
business_up_notes
|
||||
) THEN
|
||||
1
|
||||
WHEN n.AUTHOR_ID IN (
|
||||
SELECT
|
||||
AUTHOR_ID
|
||||
FROM
|
||||
business_star_notes
|
||||
) THEN
|
||||
2
|
||||
END AS `type`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
*, 'business_up_notes' AS source_table
|
||||
FROM
|
||||
business_up_notes
|
||||
WHERE
|
||||
AUTHOR_ID = #{authorId}
|
||||
UNION ALL
|
||||
SELECT
|
||||
*, 'business_star_notes' AS source_table
|
||||
FROM
|
||||
business_star_notes
|
||||
WHERE
|
||||
AUTHOR_ID = #{authorId}
|
||||
) AS n
|
||||
LEFT JOIN business_author a ON n.follow_id = a.AUTHOR_ID
|
||||
LEFT JOIN business_note b ON n.note_id = b.note_id
|
||||
ORDER BY
|
||||
n.create_time DESC
|
||||
</select>
|
||||
<select id="selectReplyMeNotes" resultType="com.dd.admin.business.note.domain.ReplayMeVo">
|
||||
SELECT
|
||||
r.reply_id,
|
||||
r.note_id,
|
||||
b.note_title,
|
||||
a.author_id,
|
||||
a.author_name,
|
||||
a.AVATAR_URL,
|
||||
r.create_time,
|
||||
r.REPLAY_CONTENT,
|
||||
b.FIRST_PICTURE,
|
||||
CASE
|
||||
WHEN r.TOP_PARENT_ID IS NULL THEN 1
|
||||
WHEN r.TOP_PARENT_ID IS NOT NULL THEN 2
|
||||
END AS type,
|
||||
r.PARENT_ID,
|
||||
(
|
||||
SELECT
|
||||
REPLAY_CONTENT
|
||||
FROM
|
||||
business_reply
|
||||
WHERE
|
||||
REPLY_ID = r.PARENT_ID
|
||||
LIMIT 1
|
||||
) AS parentReplayContent
|
||||
FROM
|
||||
business_reply r
|
||||
LEFT JOIN business_author a ON r.author_id = a.AUTHOR_ID
|
||||
LEFT JOIN business_note b ON r.note_id = b.note_id
|
||||
where PARENT_AUTHOR_ID = #{authorId} and r.author_id != #{authorId}
|
||||
ORDER BY
|
||||
r.create_time DESC
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -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<Note> {
|
||||
|
||||
IPage<NoteVo> selectMineStarNotes( String followId);
|
||||
|
||||
IPage<UpMeVo> selectUpMeNotes(String authorId);
|
||||
|
||||
IPage<ReplayMeVo> selectReplyMeNotes(String authorId);
|
||||
|
||||
}
|
||||
|
@ -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<NoteMapper, Note> implements No
|
||||
Page page = PageFactory.defaultPage();
|
||||
return baseMapper.selectMineStarNotes(page,followId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<UpMeVo> selectUpMeNotes(String authorId) {
|
||||
Page page = PageFactory.defaultPage();
|
||||
return baseMapper.selectUpMeNotes(page,authorId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<ReplayMeVo> selectReplyMeNotes(String authorId) {
|
||||
Page page = PageFactory.defaultPage();
|
||||
return baseMapper.selectReplyMeNotes(page,authorId);
|
||||
}
|
||||
}
|
||||
|
@ -25,4 +25,5 @@ public interface ReplyMapper extends BaseMapper<Reply> {
|
||||
IPage<ReplyVo> selectReplyPage(Page<ReplyVo> page, @Param("replyDto") ReplyDto replyDto);
|
||||
|
||||
List<ReplyVo> selectReplyList(@Param("replyDto") ReplyDto replyDto);
|
||||
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ tio:
|
||||
websocket:
|
||||
server:
|
||||
port: 9326
|
||||
heartbeat-timeout: 6000
|
||||
heartbeat-timeout: 10000
|
||||
# 集群配置 默认关闭
|
||||
cluster:
|
||||
enabled: false
|
||||
|
Loading…
x
Reference in New Issue
Block a user