package com.mzl.flower.web.film;
|
|
import com.github.pagehelper.PageInfo;
|
import com.mzl.flower.base.BaseController;
|
import com.mzl.flower.base.R;
|
import com.mzl.flower.base.ReturnDataDTO;
|
import com.mzl.flower.dto.request.film.CommentSearchDTO;
|
import com.mzl.flower.dto.response.film.CommentDTO;
|
import com.mzl.flower.service.film.CommentService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.http.ResponseEntity;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.annotation.Resource;
|
import java.util.List;
|
|
|
/**
|
* @author fanghaowei
|
* @date 2025/6/3 14:28
|
*/
|
@Slf4j
|
@RestController
|
@RequestMapping("/api/comment/")
|
@Api(tags = "评论管理")
|
public class CommentController extends BaseController {
|
@Resource
|
private CommentService commentService;
|
|
@GetMapping("getCommentByFilmId")
|
@ApiOperation(value = "获取文章的评论信息")
|
public ResponseEntity<ReturnDataDTO<List<CommentDTO>>> getCommentByFilmId(CommentSearchDTO commentSearchDTO) {
|
return returnData(R.SUCCESS.getCode(), commentService.getCommentByFilmId(commentSearchDTO));
|
}
|
|
@GetMapping("getLatestComment")
|
@ApiOperation(value = "获取最新评论信息")
|
public ResponseEntity<PageInfo<CommentDTO>> getLatestComment(CommentSearchDTO commentSearchDTO) {
|
return returnData(R.SUCCESS.getCode(),commentService.getLatestComment(commentSearchDTO));
|
}
|
|
@PostMapping("create")
|
@ApiOperation(value = "创建评论")
|
public ResponseEntity<Boolean> create(@RequestBody CommentDTO commentDTO) {
|
return returnData(R.SUCCESS.getCode(),commentService.create(commentDTO));
|
}
|
|
@PostMapping("delete/{commentId}")
|
@ApiOperation(value = "删除评论")
|
public ResponseEntity<Boolean> delete(@PathVariable Integer commentId) {
|
return returnData(R.SUCCESS.getCode(),commentService.delete(commentId));
|
}
|
|
}
|