完成回复点赞功能
This commit is contained in:
parent
fe5db963b5
commit
7f80c71c5a
@ -28,6 +28,8 @@ import com.dd.admin.business.upNotes.domain.UpNotesDto;
|
|||||||
import com.dd.admin.business.upNotes.domain.UpNotesVo;
|
import com.dd.admin.business.upNotes.domain.UpNotesVo;
|
||||||
import com.dd.admin.business.upNotes.entity.UpNotes;
|
import com.dd.admin.business.upNotes.entity.UpNotes;
|
||||||
import com.dd.admin.business.upNotes.service.UpNotesService;
|
import com.dd.admin.business.upNotes.service.UpNotesService;
|
||||||
|
import com.dd.admin.business.upReplys.entity.UpReplys;
|
||||||
|
import com.dd.admin.business.upReplys.service.UpReplysService;
|
||||||
import com.dd.admin.common.aop.operationLog.aop.OperLog;
|
import com.dd.admin.common.aop.operationLog.aop.OperLog;
|
||||||
import com.dd.admin.common.aop.operationLog.aop.OperType;
|
import com.dd.admin.common.aop.operationLog.aop.OperType;
|
||||||
import com.dd.admin.common.model.result.ResultBean;
|
import com.dd.admin.common.model.result.ResultBean;
|
||||||
@ -45,10 +47,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.dd.admin.common.consts.XhsConst.TRUE;
|
import static com.dd.admin.common.consts.XhsConst.TRUE;
|
||||||
@ -75,6 +74,8 @@ public class AuthApi {
|
|||||||
FollowService followService;
|
FollowService followService;
|
||||||
@Autowired
|
@Autowired
|
||||||
ReplyService replyService;
|
ReplyService replyService;
|
||||||
|
@Autowired
|
||||||
|
UpReplysService upReplysService;
|
||||||
|
|
||||||
@ApiOperation(value = "获取所有笔记")
|
@ApiOperation(value = "获取所有笔记")
|
||||||
@ApiOperationSupport(order = 1)
|
@ApiOperationSupport(order = 1)
|
||||||
@ -306,9 +307,13 @@ public class AuthApi {
|
|||||||
@ApiOperationSupport(order = 1)
|
@ApiOperationSupport(order = 1)
|
||||||
@GetMapping("/api/auth/getNoteReply")
|
@GetMapping("/api/auth/getNoteReply")
|
||||||
@OperLog(operModule = "获取笔记评论",operType = OperType.QUERY,operDesc = "获取笔记评论")
|
@OperLog(operModule = "获取笔记评论",operType = OperType.QUERY,operDesc = "获取笔记评论")
|
||||||
public ResultBean<Author> getNoteReply( ReplyDto replyDto) {
|
public ResultBean<Map> getNoteReply( ReplyDto replyDto) {
|
||||||
|
String fellowId = String.valueOf(request.getAttribute("authorId"));
|
||||||
|
|
||||||
|
|
||||||
String noteId = replyDto.getNoteId();
|
String noteId = replyDto.getNoteId();
|
||||||
List<ReplyVo> replyList = replyService.selectReplyList(new ReplyDto().setNoteId(noteId));
|
List<ReplyVo> replyList = replyService.selectReplyList(new ReplyDto().setNoteId(noteId).setFollowId(fellowId));
|
||||||
|
Integer totalCount = replyList.size();
|
||||||
// 先构建一个以回复ID为键,回复对象为值的Map,方便后续快速查找回复对象
|
// 先构建一个以回复ID为键,回复对象为值的Map,方便后续快速查找回复对象
|
||||||
// 构建以replyId为键,ReplyVo对象为值的Map,方便后续快速查找回复对象
|
// 构建以replyId为键,ReplyVo对象为值的Map,方便后续快速查找回复对象
|
||||||
Map<String, ReplyVo> replyMap = replyList.stream()
|
Map<String, ReplyVo> replyMap = replyList.stream()
|
||||||
@ -344,7 +349,12 @@ public class AuthApi {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
return ResultBean.success(firstLevelReplies);
|
Map map = new HashMap();
|
||||||
|
map.put("totalCount",totalCount);
|
||||||
|
map.put("replys",firstLevelReplies);
|
||||||
|
|
||||||
|
|
||||||
|
return ResultBean.success(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -409,7 +419,7 @@ public class AuthApi {
|
|||||||
replyDto.setFirstReplay(TRUE);
|
replyDto.setFirstReplay(TRUE);
|
||||||
}
|
}
|
||||||
replyDto.setNoteId(note.getNoteId());
|
replyDto.setNoteId(note.getNoteId());
|
||||||
replyDto.setNoteTitile(note.getNoteTitle());
|
replyDto.setNoteTitle(note.getNoteTitle());
|
||||||
replyDto.setAuthorId(authorId);
|
replyDto.setAuthorId(authorId);
|
||||||
replyDto.setAuthorName(author.getAuthorName());
|
replyDto.setAuthorName(author.getAuthorName());
|
||||||
replyDto.setAvatarUrl(author.getAvatarUrl());
|
replyDto.setAvatarUrl(author.getAvatarUrl());
|
||||||
@ -420,4 +430,33 @@ public class AuthApi {
|
|||||||
return ResultBean.success();
|
return ResultBean.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation(value = "点赞评论")
|
||||||
|
@ApiOperationSupport(order = 1)
|
||||||
|
@PostMapping("/api/auth/upReply")
|
||||||
|
@OperLog(operModule = "点赞评论",operType = OperType.ADD,operDesc = "点赞评论")
|
||||||
|
public ResultBean upReply(@RequestBody ReplyDto replyDto) {
|
||||||
|
String followId = String.valueOf(request.getAttribute("authorId"));
|
||||||
|
Author follow = authorService.getById(followId);
|
||||||
|
Boolean isUp = Boolean.FALSE;
|
||||||
|
//查看在不在点赞列表
|
||||||
|
UpReplys upReplys = upReplysService.selectOneByFollowId(replyDto.getReplyId(),replyDto.getAuthorId(), followId);
|
||||||
|
//不在证明是点赞
|
||||||
|
if(upReplys==null){
|
||||||
|
upReplys = new UpReplys();
|
||||||
|
upReplys.setAuthorId(replyDto.getAuthorId());
|
||||||
|
upReplys.setAuthorName(replyDto.getAuthorName());
|
||||||
|
upReplys.setFollowId(follow.getAuthorId());
|
||||||
|
upReplys.setFollowName(follow.getAuthorName());
|
||||||
|
upReplys.setReplyId(replyDto.getReplyId());
|
||||||
|
upReplys.setReplyContent(replyDto.getReplayContent());
|
||||||
|
isUp = Boolean.TRUE;
|
||||||
|
upReplysService.save(upReplys);
|
||||||
|
}else{
|
||||||
|
//在则表示取消赞删除数据
|
||||||
|
upReplysService.removeById(upReplys);
|
||||||
|
}
|
||||||
|
return ResultBean.success(isUp);
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -71,10 +71,6 @@ public class NoteVo {
|
|||||||
@ApiModelProperty(value = "创建时间")
|
@ApiModelProperty(value = "创建时间")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
@ApiModelProperty(value = "创建时间")
|
|
||||||
@JsonFormat(pattern="MM-dd", timezone = "GMT+8")
|
|
||||||
private Date createTimeStr;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "修改时间")
|
@ApiModelProperty(value = "修改时间")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
|
@ -33,8 +33,7 @@
|
|||||||
SELECT
|
SELECT
|
||||||
a.*,
|
a.*,
|
||||||
COALESCE(COUNT(b.note_id), 0) AS starCount,
|
COALESCE(COUNT(b.note_id), 0) AS starCount,
|
||||||
COALESCE(COUNT(c.note_id), 0) AS upCount,
|
COALESCE(COUNT(c.note_id), 0) AS upCount
|
||||||
a.CREATE_TIME AS createTimeStr
|
|
||||||
<if test="noteDto.followId != null and noteDto.followId != ''">
|
<if test="noteDto.followId != null and noteDto.followId != ''">
|
||||||
,CASE WHEN EXISTS (
|
,CASE WHEN EXISTS (
|
||||||
SELECT 1
|
SELECT 1
|
||||||
@ -98,8 +97,7 @@
|
|||||||
SELECT
|
SELECT
|
||||||
a.*,
|
a.*,
|
||||||
COALESCE(COUNT(b.note_id), 0) AS starCount,
|
COALESCE(COUNT(b.note_id), 0) AS starCount,
|
||||||
COALESCE(COUNT(c.note_id), 0) AS upCount,
|
COALESCE(COUNT(c.note_id), 0) AS upCount
|
||||||
a.CREATE_TIME AS createTimeStr
|
|
||||||
-- 使用 CASE WHEN 语句判断是否存在当前用户(通过传入的 followId)对笔记的收藏记录,有则为 true,否则为 false
|
-- 使用 CASE WHEN 语句判断是否存在当前用户(通过传入的 followId)对笔记的收藏记录,有则为 true,否则为 false
|
||||||
<if test="noteDto.followId != null and noteDto.followId != ''">
|
<if test="noteDto.followId != null and noteDto.followId != ''">
|
||||||
,CASE WHEN EXISTS (
|
,CASE WHEN EXISTS (
|
||||||
|
@ -40,7 +40,7 @@ public class ReplyDto {
|
|||||||
private String noteId;
|
private String noteId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "笔记标题")
|
@ApiModelProperty(value = "笔记标题")
|
||||||
private String noteTitile;
|
private String noteTitle;
|
||||||
|
|
||||||
@ApiModelProperty(value = "作者id")
|
@ApiModelProperty(value = "作者id")
|
||||||
private String authorId;
|
private String authorId;
|
||||||
@ -99,5 +99,8 @@ public class ReplyDto {
|
|||||||
@ApiModelProperty(value = "头像地址")
|
@ApiModelProperty(value = "头像地址")
|
||||||
private String avatarUrl;
|
private String avatarUrl;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "作者ID")
|
||||||
|
//传入此参数 如果你点赞了会显示相应状态
|
||||||
|
private String followId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ public class ReplyVo {
|
|||||||
private String noteId;
|
private String noteId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "笔记标题")
|
@ApiModelProperty(value = "笔记标题")
|
||||||
private String noteTitile;
|
private String noteTitle;
|
||||||
|
|
||||||
@ApiModelProperty(value = "作者id")
|
@ApiModelProperty(value = "作者id")
|
||||||
private String authorId;
|
private String authorId;
|
||||||
@ -74,10 +74,6 @@ public class ReplyVo {
|
|||||||
@ApiModelProperty(value = "创建时间")
|
@ApiModelProperty(value = "创建时间")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
@ApiModelProperty(value = "创建时间")
|
|
||||||
@JsonFormat(pattern="MM-dd", timezone = "GMT+8")
|
|
||||||
private Date createTimeStr;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "ip地址")
|
@ApiModelProperty(value = "ip地址")
|
||||||
private String ipAddress;
|
private String ipAddress;
|
||||||
|
|
||||||
@ -103,4 +99,9 @@ public class ReplyVo {
|
|||||||
private String avatarUrl;
|
private String avatarUrl;
|
||||||
|
|
||||||
private List<ReplyVo> Reply = new ArrayList<>();
|
private List<ReplyVo> Reply = new ArrayList<>();
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "被当前达人点赞")
|
||||||
|
private Boolean isUp = Boolean.FALSE;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ public class Reply implements Serializable {
|
|||||||
|
|
||||||
@ApiModelProperty(value = "笔记标题")
|
@ApiModelProperty(value = "笔记标题")
|
||||||
@TableField("NOTE_TITILE")
|
@TableField("NOTE_TITILE")
|
||||||
private String noteTitile;
|
private String noteTitle;
|
||||||
|
|
||||||
@ApiModelProperty(value = "作者id")
|
@ApiModelProperty(value = "作者id")
|
||||||
@TableField("AUTHOR_ID")
|
@TableField("AUTHOR_ID")
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<resultMap id="BaseResultMap" type="com.dd.admin.business.reply.entity.Reply">
|
<resultMap id="BaseResultMap" type="com.dd.admin.business.reply.entity.Reply">
|
||||||
<id column="REPLY_ID" property="replyId" />
|
<id column="REPLY_ID" property="replyId" />
|
||||||
<result column="NOTE_ID" property="noteId" />
|
<result column="NOTE_ID" property="noteId" />
|
||||||
<result column="NOTE_TITILE" property="noteTitile" />
|
<result column="NOTE_TITLE" property="noteTitle" />
|
||||||
<result column="AUTHOR_ID" property="authorId" />
|
<result column="AUTHOR_ID" property="authorId" />
|
||||||
<result column="AUTHOR_NAME" property="authorName" />
|
<result column="AUTHOR_NAME" property="authorName" />
|
||||||
<result column="PARENT_ID" property="parentId" />
|
<result column="PARENT_ID" property="parentId" />
|
||||||
@ -37,12 +37,32 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectReplyList" resultType="com.dd.admin.business.reply.domain.ReplyVo">
|
<select id="selectReplyList" resultType="com.dd.admin.business.reply.domain.ReplyVo">
|
||||||
select
|
SELECT
|
||||||
*,CREATE_TIME AS createTimeStr
|
r.*,
|
||||||
from business_reply where DELETED = 0
|
COALESCE(COUNT(urp.REPLY_UP_ID), 0) AS upCount
|
||||||
<if test="replyDto.noteId != null and replyDto.noteId != ''">
|
<if test="replyDto.followId!= null and replyDto.followId!= ''">
|
||||||
and NOTE_ID = #{replyDto.noteId}
|
,CASE WHEN EXISTS (
|
||||||
|
SELECT 1
|
||||||
|
FROM business_up_replys sub_urp
|
||||||
|
WHERE sub_urp.REPLY_ID = r.reply_id
|
||||||
|
AND sub_urp.FOLLOW_ID = #{replyDto.followId}
|
||||||
|
) THEN true ELSE false END AS isUp
|
||||||
</if>
|
</if>
|
||||||
order by up_count asc,create_time desc
|
FROM
|
||||||
|
business_reply r
|
||||||
|
LEFT JOIN
|
||||||
|
business_up_replys urp ON r.reply_id = urp.REPLY_ID
|
||||||
|
WHERE
|
||||||
|
r.DELETED = 0
|
||||||
|
<if test="replyDto.noteId!= null and replyDto.noteId!= ''">
|
||||||
|
AND r.NOTE_ID = #{replyDto.noteId}
|
||||||
|
</if>
|
||||||
|
GROUP BY
|
||||||
|
r.reply_id
|
||||||
|
ORDER BY
|
||||||
|
upCount ASC, r.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -0,0 +1,88 @@
|
|||||||
|
package com.dd.admin.business.upReplys.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import com.dd.admin.common.model.UpdateGroup;
|
||||||
|
import com.dd.admin.common.model.result.ResultBean;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import com.dd.admin.business.upReplys.entity.UpReplys;
|
||||||
|
import com.dd.admin.business.upReplys.domain.UpReplysVo;
|
||||||
|
import com.dd.admin.business.upReplys.domain.UpReplysDto;
|
||||||
|
import com.dd.admin.business.upReplys.service.UpReplysService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 笔记点赞表 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author 727869402@qq.com
|
||||||
|
* @since 2024-12-25
|
||||||
|
*/
|
||||||
|
@Api(tags = "笔记点赞表")
|
||||||
|
@RestController
|
||||||
|
public class UpReplysController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
UpReplysService upReplysService;
|
||||||
|
|
||||||
|
@ApiOperation(value = "笔记点赞表-分页列表")
|
||||||
|
@ApiOperationSupport(order = 1)
|
||||||
|
@GetMapping("/admin/upReplys/page")
|
||||||
|
public ResultBean<IPage<UpReplysVo>> page(UpReplysDto upReplysDto) {
|
||||||
|
IPage<UpReplysVo> pageInfo = upReplysService.selectUpReplysPage(upReplysDto);
|
||||||
|
return ResultBean.success(pageInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "笔记点赞表-列表")
|
||||||
|
@ApiOperationSupport(order = 2)
|
||||||
|
@GetMapping("/admin/upReplys/list")
|
||||||
|
public ResultBean<List<UpReplysVo>> list(UpReplysDto upReplysDto) {
|
||||||
|
List<UpReplysVo> list = upReplysService.selectUpReplysList(upReplysDto);
|
||||||
|
return ResultBean.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "笔记点赞表-添加")
|
||||||
|
@ApiOperationSupport(order = 3)
|
||||||
|
@PostMapping("/admin/upReplys/add")
|
||||||
|
public ResultBean<UpReplys> add(@RequestBody @Validated UpReplysDto upReplysDto) {
|
||||||
|
UpReplys upReplys = BeanUtil.copyProperties(upReplysDto, UpReplys.class);
|
||||||
|
upReplysService.save(upReplys);
|
||||||
|
return ResultBean.success(upReplys);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "笔记点赞表-查询")
|
||||||
|
@ApiOperationSupport(order = 4)
|
||||||
|
@GetMapping("/admin/upReplys/{upReplysId}")
|
||||||
|
public ResultBean<UpReplysVo> get(@PathVariable @NotBlank String upReplysId) {
|
||||||
|
UpReplys upReplys = upReplysService.getById(upReplysId);
|
||||||
|
UpReplysVo upReplysVo = BeanUtil.copyProperties(upReplys,UpReplysVo.class);
|
||||||
|
return ResultBean.success(upReplysVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "笔记点赞表-修改")
|
||||||
|
@ApiOperationSupport(order = 5)
|
||||||
|
@PostMapping("/admin/upReplys/update")
|
||||||
|
public ResultBean<UpReplys> update(@RequestBody @Validated(UpdateGroup.class) UpReplysDto upReplysDto) {
|
||||||
|
UpReplys upReplys = BeanUtil.copyProperties(upReplysDto, UpReplys.class);
|
||||||
|
upReplysService.updateById(upReplys);
|
||||||
|
return ResultBean.success(upReplys);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "笔记点赞表-删除")
|
||||||
|
@ApiOperationSupport(order = 6)
|
||||||
|
@GetMapping("/admin/upReplys/delete/{upReplysId}")
|
||||||
|
public ResultBean<UpReplys> delete(@PathVariable @NotBlank String upReplysId) {
|
||||||
|
Boolean b = upReplysService.removeById(upReplysId);
|
||||||
|
return ResultBean.success(b);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
package com.dd.admin.business.upReplys.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.baomidou.mybatisplus.annotation.Version;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import com.dd.admin.common.model.UpdateGroup;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 笔记点赞表返回对象
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author 727869402@qq.com
|
||||||
|
* @since 2024-12-25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel(value="笔记点赞表接收对象")
|
||||||
|
public class UpReplysDto {
|
||||||
|
|
||||||
|
|
||||||
|
@NotBlank(message = "笔记点赞表id不能为空",groups = UpdateGroup.class)
|
||||||
|
private String replyUpId;
|
||||||
|
|
||||||
|
private String replyId;
|
||||||
|
|
||||||
|
private String replyContent;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "被关注id")
|
||||||
|
private String authorId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "被关注名字")
|
||||||
|
private String authorName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "关注者")
|
||||||
|
private String followId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "关注者名字")
|
||||||
|
private String followName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
package com.dd.admin.business.upReplys.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.baomidou.mybatisplus.annotation.Version;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 笔记点赞表返回对象
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author 727869402@qq.com
|
||||||
|
* @since 2024-12-25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel(value="笔记点赞表返回对象")
|
||||||
|
public class UpReplysVo {
|
||||||
|
|
||||||
|
|
||||||
|
private String replyUpId;
|
||||||
|
|
||||||
|
private String replyId;
|
||||||
|
|
||||||
|
private String replyContent;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "被关注id")
|
||||||
|
private String authorId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "被关注名字")
|
||||||
|
private String authorName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "关注者")
|
||||||
|
private String followId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "关注者名字")
|
||||||
|
private String followName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,62 @@
|
|||||||
|
package com.dd.admin.business.upReplys.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.baomidou.mybatisplus.annotation.Version;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 笔记点赞表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author 727869402@qq.com
|
||||||
|
* @since 2024-12-25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@TableName("business_up_replys")
|
||||||
|
@ApiModel(value="UpReplys对象", description="笔记点赞表")
|
||||||
|
public class UpReplys implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "REPLY_UP_ID", type = IdType.ASSIGN_UUID)
|
||||||
|
private String replyUpId;
|
||||||
|
|
||||||
|
@TableField("REPLY_ID")
|
||||||
|
private String replyId;
|
||||||
|
|
||||||
|
@TableField("REPLY_CONTENT")
|
||||||
|
private String replyContent;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "被关注id")
|
||||||
|
@TableField("AUTHOR_ID")
|
||||||
|
private String authorId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "被关注名字")
|
||||||
|
@TableField("AUTHOR_NAME")
|
||||||
|
private String authorName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "关注者")
|
||||||
|
@TableField("FOLLOW_ID")
|
||||||
|
private String followId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "关注者名字")
|
||||||
|
@TableField("FOLLOW_NAME")
|
||||||
|
private String followName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
@TableField(value = "CREATE_TIME", fill = FieldFill.INSERT)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package com.dd.admin.business.upReplys.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.dd.admin.business.upReplys.entity.UpReplys;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.dd.admin.business.upReplys.domain.UpReplysVo;
|
||||||
|
import com.dd.admin.business.upReplys.domain.UpReplysDto;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 笔记点赞表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author 727869402@qq.com
|
||||||
|
* @since 2024-12-25
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface UpReplysMapper extends BaseMapper<UpReplys> {
|
||||||
|
|
||||||
|
IPage<UpReplysVo> selectUpReplysPage(Page<UpReplysVo> page, @Param("upReplysDto") UpReplysDto upReplysDto);
|
||||||
|
|
||||||
|
List<UpReplysVo> selectUpReplysList(@Param("upReplysDto") UpReplysDto upReplysDto);
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.dd.admin.business.upReplys.mapper.UpReplysMapper">
|
||||||
|
|
||||||
|
<!-- 通用查询映射结果 -->
|
||||||
|
<resultMap id="BaseResultMap" type="com.dd.admin.business.upReplys.entity.UpReplys">
|
||||||
|
<id column="REPLY_UP_ID" property="replyUpId" />
|
||||||
|
<result column="REPLY_ID" property="replyId" />
|
||||||
|
<result column="REPLY_CONTENT" property="replyContent" />
|
||||||
|
<result column="AUTHOR_ID" property="authorId" />
|
||||||
|
<result column="AUTHOR_NAME" property="authorName" />
|
||||||
|
<result column="FOLLOW_ID" property="followId" />
|
||||||
|
<result column="FOLLOW_NAME" property="followName" />
|
||||||
|
<result column="CREATE_TIME" property="createTime" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 通用查询结果列 -->
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
REPLY_UP_ID, REPLY_ID, REPLY_CONTENT, AUTHOR_ID, AUTHOR_NAME, FOLLOW_ID, FOLLOW_NAME, CREATE_TIME
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectUpReplysPage" resultType="com.dd.admin.business.upReplys.domain.UpReplysVo">
|
||||||
|
select
|
||||||
|
*
|
||||||
|
from business_up_replys where 1 = 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectUpReplysList" resultType="com.dd.admin.business.upReplys.domain.UpReplysVo">
|
||||||
|
select
|
||||||
|
*
|
||||||
|
from business_up_replys where 1 = 1
|
||||||
|
</select>
|
||||||
|
</mapper>
|
@ -0,0 +1,28 @@
|
|||||||
|
package com.dd.admin.business.upReplys.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.dd.admin.business.upReplys.entity.UpReplys;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.dd.admin.business.upReplys.domain.UpReplysVo;
|
||||||
|
import com.dd.admin.business.upReplys.domain.UpReplysDto;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 笔记点赞表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author 727869402@qq.com
|
||||||
|
* @since 2024-12-25
|
||||||
|
*/
|
||||||
|
public interface UpReplysService extends IService<UpReplys> {
|
||||||
|
|
||||||
|
//笔记点赞表-分页列表
|
||||||
|
IPage<UpReplysVo> selectUpReplysPage(UpReplysDto upReplysDto);
|
||||||
|
|
||||||
|
//笔记点赞表-列表
|
||||||
|
List<UpReplysVo> selectUpReplysList(UpReplysDto upReplysDto);
|
||||||
|
|
||||||
|
UpReplys selectOneByFollowId(String replyId,String authorId,String followId);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
package com.dd.admin.business.upReplys.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.dd.admin.business.upNotes.entity.UpNotes;
|
||||||
|
import com.dd.admin.common.model.PageFactory;
|
||||||
|
import com.dd.admin.business.upReplys.entity.UpReplys;
|
||||||
|
import com.dd.admin.business.upReplys.mapper.UpReplysMapper;
|
||||||
|
import com.dd.admin.business.upReplys.service.UpReplysService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.dd.admin.business.upReplys.domain.UpReplysVo;
|
||||||
|
import com.dd.admin.business.upReplys.domain.UpReplysDto;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 笔记点赞表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author 727869402@qq.com
|
||||||
|
* @since 2024-12-25
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class UpReplysServiceImpl extends ServiceImpl<UpReplysMapper, UpReplys> implements UpReplysService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<UpReplysVo> selectUpReplysPage(UpReplysDto upReplysDto) {
|
||||||
|
Page page = PageFactory.defaultPage();
|
||||||
|
return baseMapper.selectUpReplysPage(page,upReplysDto);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UpReplysVo> selectUpReplysList(UpReplysDto upReplysDto) {
|
||||||
|
return baseMapper.selectUpReplysList(upReplysDto);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UpReplys selectOneByFollowId(String replyId, String authorId, String followId) {
|
||||||
|
LambdaQueryWrapper<UpReplys> queryWrapper = new LambdaQueryWrapper();
|
||||||
|
queryWrapper.eq(UpReplys::getReplyId,replyId);
|
||||||
|
queryWrapper.eq(UpReplys::getAuthorId,authorId);
|
||||||
|
queryWrapper.eq(UpReplys::getFollowId,followId);
|
||||||
|
return this.getOne(queryWrapper);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user