parent
dcc14f9190
commit
97211e90ba
@ -0,0 +1,90 @@
|
||||
package com.luoo.comment.controller;
|
||||
|
||||
|
||||
import api.PageResult;
|
||||
import api.Result;
|
||||
import api.StatusCode;
|
||||
import com.luoo.comment.pojo.Comment;
|
||||
import com.luoo.comment.pojo.CommentVo;
|
||||
import com.luoo.comment.service.CommentService;
|
||||
import constants.Constants;
|
||||
import controller.BaseController;
|
||||
import dto.UserLoginDto;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping("/commentCms")
|
||||
@Api(tags = "评论后台管理")
|
||||
public class CmsCommentController extends BaseController {
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private CommentService commentService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate redisTemplate;
|
||||
|
||||
|
||||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
|
||||
|
||||
|
||||
@GetMapping
|
||||
public Result findAll(){
|
||||
return Result.success(commentService.findAll());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@GetMapping("/{page}/{size}")
|
||||
public Result search(@PathVariable int page,@PathVariable int size){
|
||||
Page<Comment> pageData = commentService.search(page,size);
|
||||
return Result.success(new PageResult<Comment>(pageData.getTotalElements(),pageData.getContent()));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/{commentId}")
|
||||
public Result findById(@PathVariable String commentId){
|
||||
return Result.success(commentService.findById(commentId));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@PutMapping("/{commentId}")
|
||||
public Result update(@PathVariable String commentId,@RequestBody Comment comment) {
|
||||
|
||||
comment.set_id(commentId);
|
||||
commentService.update(comment);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{commentId}")
|
||||
public Result delete(@PathVariable String commentId) {
|
||||
commentService.deleteById(commentId);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in new issue