feat:增加查询个人朋友圈接口
This commit is contained in:
@@ -37,10 +37,16 @@ public class MomentController {
|
||||
return momentService.deleteMoment(id);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询朋友圈")
|
||||
@Operation(summary = "查询所有朋友圈")
|
||||
@GetMapping("")
|
||||
public @JsonView(ReadView.class) List<MomentDto> queryMoment() {
|
||||
return momentService.queryMoment();
|
||||
public @JsonView(ReadView.class) List<MomentDto> queryMomentList() {
|
||||
return momentService.queryMomentList();
|
||||
}
|
||||
|
||||
@Operation(summary = "查询朋友圈")
|
||||
@GetMapping("/{id}")
|
||||
public @JsonView(ReadView.class) List<MomentDto> queryMomentById(@PathVariable("id") long id) {
|
||||
return momentService.queryMomentById(id);
|
||||
}
|
||||
|
||||
@Operation(summary = "新增评论")
|
||||
|
||||
@@ -8,7 +8,9 @@ import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface MomentDao {
|
||||
List<MomentDto> queryMoment();
|
||||
List<MomentDto> queryMomentList();
|
||||
|
||||
List<MomentDto> queryMomentById(@Param("id") Long id);
|
||||
|
||||
void insertMomentImage(@Param("momentId") Long momentId,
|
||||
@Param("list") List<String> imageFiles);
|
||||
|
||||
@@ -12,7 +12,9 @@ public interface MomentService {
|
||||
|
||||
Boolean deleteMoment(Long id);
|
||||
|
||||
List<MomentDto> queryMoment();
|
||||
List<MomentDto> queryMomentList();
|
||||
|
||||
List<MomentDto> queryMomentById(Long id);
|
||||
|
||||
Boolean addComment(Long momentId, String content);
|
||||
|
||||
|
||||
@@ -70,9 +70,14 @@ public class MomentServiceImpl implements MomentService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MomentDto> queryMoment() {
|
||||
public List<MomentDto> queryMomentList() {
|
||||
// TODO 只能查询好友的朋友圈
|
||||
return momentDao.queryMoment();
|
||||
return momentDao.queryMomentList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MomentDto> queryMomentById(Long id) {
|
||||
return momentDao.queryMomentById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
WHERE moment_id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="queryMoment" resultMap="momentResultMap">
|
||||
<select id="queryMomentList" resultMap="momentResultMap">
|
||||
SELECT a.id AS id,
|
||||
b.id AS userId,
|
||||
b.username AS username,
|
||||
@@ -56,6 +56,19 @@
|
||||
ORDER BY a.update_time DESC
|
||||
</select>
|
||||
|
||||
<select id="queryMomentById" resultMap="momentResultMap">
|
||||
SELECT a.id AS id,
|
||||
b.id AS userId,
|
||||
b.username AS username,
|
||||
b.avatar AS avatar,
|
||||
a.content AS content,
|
||||
a.create_time AS date
|
||||
FROM moment AS a
|
||||
LEFT JOIN user AS b ON a.create_by = b.id
|
||||
WHERE a.create_by = #{id}
|
||||
ORDER BY a.update_time DESC
|
||||
</select>
|
||||
|
||||
<select id="queryMomentImage" resultType="java.lang.String">
|
||||
SELECT image_url AS imageUrl
|
||||
FROM moment_image
|
||||
|
||||
Reference in New Issue
Block a user