|
|
|
|
package com.youlai.boot.mini.controller;
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import com.youlai.boot.common.annotation.Log;
|
|
|
|
|
import com.youlai.boot.common.annotation.RepeatSubmit;
|
|
|
|
|
import com.youlai.boot.common.enums.ActionTypeEnum;
|
|
|
|
|
import com.youlai.boot.common.enums.LogModuleEnum;
|
|
|
|
|
import com.youlai.boot.common.result.Result;
|
|
|
|
|
import com.youlai.boot.framework.security.util.SecurityUtils;
|
|
|
|
|
import com.youlai.boot.mini.model.form.DeleteStrayAnimalNoteCommentForm;
|
|
|
|
|
import com.youlai.boot.mini.model.form.StrayAnimalNoteCommentForm;
|
|
|
|
|
import com.youlai.boot.mini.model.query.AnimalNoteFirstLevelCommentQueryParam;
|
|
|
|
|
import com.youlai.boot.mini.model.query.AnimalNoteSecondLevelCommentQueryParam;
|
|
|
|
|
import com.youlai.boot.mini.model.vo.AnimalNoteFirstLevelCommentVO;
|
|
|
|
|
import com.youlai.boot.mini.model.vo.AnimalNoteSecondLevelCommentVO;
|
|
|
|
|
import com.youlai.boot.mini.model.vo.StrayAnimalNoteCommentVO;
|
|
|
|
|
import com.youlai.boot.mini.service.StrayAnimalNoteCommentService;
|
|
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
|
|
import jakarta.validation.Valid;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
@Tag(name = "流浪动物笔记评论相关接口")
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/api/v1/mini/noteComment")
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
|
public class StrayAnimalNoteCommentController {
|
|
|
|
|
|
|
|
|
|
private final StrayAnimalNoteCommentService strayAnimalNoteCommentService;
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "笔记评论接口")
|
|
|
|
|
@PostMapping(value = "add")
|
|
|
|
|
@RepeatSubmit
|
|
|
|
|
@Log(module = LogModuleEnum.STRAY_ANIMAL_NOTE_COMMENT, value = ActionTypeEnum.INSERT)
|
|
|
|
|
public Result<?> addNoteComment(
|
|
|
|
|
@Valid @RequestBody StrayAnimalNoteCommentForm formData
|
|
|
|
|
) {
|
|
|
|
|
StrayAnimalNoteCommentVO vo = strayAnimalNoteCommentService.addNoteComment(formData);
|
|
|
|
|
return Result.success(vo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "删除笔记评论接口")
|
|
|
|
|
@PostMapping(value = "delete")
|
|
|
|
|
@PreAuthorize("isAuthenticated()")
|
|
|
|
|
@RepeatSubmit
|
|
|
|
|
@Log(module = LogModuleEnum.STRAY_ANIMAL_NOTE_COMMENT, value = ActionTypeEnum.DELETE)
|
|
|
|
|
public Result<?> deleteNoteComment(
|
|
|
|
|
@Valid @RequestBody DeleteStrayAnimalNoteCommentForm formData
|
|
|
|
|
) {
|
|
|
|
|
Long userId = SecurityUtils.getUserId();
|
|
|
|
|
strayAnimalNoteCommentService.deleteNoteComment(formData, userId);
|
|
|
|
|
return Result.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "分页查询笔记一级评论列表接口")
|
|
|
|
|
@PostMapping(value = "firstLevel/list")
|
|
|
|
|
@Log(module = LogModuleEnum.STRAY_ANIMAL_NOTE_COMMENT, value = ActionTypeEnum.LIST)
|
|
|
|
|
public Result<IPage<AnimalNoteFirstLevelCommentVO>> getFirstLevelCommentList(
|
|
|
|
|
@Valid @RequestBody AnimalNoteFirstLevelCommentQueryParam queryParam
|
|
|
|
|
) {
|
|
|
|
|
Long userId = SecurityUtils.getUserId();
|
|
|
|
|
IPage<AnimalNoteFirstLevelCommentVO> result = strayAnimalNoteCommentService.getFirstLevelCommentList(queryParam, userId);
|
|
|
|
|
return Result.success(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "分页查询笔记二级评论列表接口")
|
|
|
|
|
@PostMapping(value = "secondLevel/list")
|
|
|
|
|
@Log(module = LogModuleEnum.STRAY_ANIMAL_NOTE_COMMENT, value = ActionTypeEnum.LIST)
|
|
|
|
|
public Result<IPage<AnimalNoteSecondLevelCommentVO>> getSecondLevelCommentList(
|
|
|
|
|
@Valid @RequestBody AnimalNoteSecondLevelCommentQueryParam queryParam
|
|
|
|
|
) {
|
|
|
|
|
Long userId = SecurityUtils.getUserId();
|
|
|
|
|
IPage<AnimalNoteSecondLevelCommentVO> result = strayAnimalNoteCommentService.getSecondLevelCommentList(queryParam, userId);
|
|
|
|
|
return Result.success(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|