You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.7 KiB
Java
45 lines
1.7 KiB
Java
package com.bsd.cases.controller;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.bsd.cases.service.CaseContentCommentsService;
|
|
import com.bsd.cases.util.AjaxRequest;
|
|
import com.bsd.cases.util.AjaxResult;
|
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
@CrossOrigin
|
|
@RestController
|
|
@RequestMapping("/case-content-comments")
|
|
public class CaseContentCommentsController {
|
|
|
|
@Resource
|
|
private CaseContentCommentsService caseContentCommentsService;
|
|
|
|
@RequestMapping("/get-comments-by-content-id")
|
|
public AjaxResult getCaseContentCommentsByContentId(@RequestBody AjaxRequest ajaxRequest, HttpServletRequest request) {
|
|
AjaxResult ajaxResult = new AjaxResult();
|
|
JSONObject data = ajaxRequest.getData();
|
|
if (null == data){
|
|
ajaxResult.setRetcode(AjaxResult.FAILED);
|
|
ajaxResult.setRetmsg("data missing");
|
|
}else {
|
|
Integer pageNum = data.getInteger("pageNum");
|
|
Integer pageSize = data.getInteger("pageSize");
|
|
if (null==pageNum|| null == pageSize){
|
|
ajaxResult.setRetcode(AjaxResult.FAILED);
|
|
ajaxResult.setRetmsg("分页参数不可为空");
|
|
}else {
|
|
Long contentId = data.getLong("contentId");
|
|
ajaxResult.setRetcode(AjaxResult.SUCCESS);
|
|
ajaxResult.setData(caseContentCommentsService.getCaseContentCommentsByContentId(contentId,pageNum,pageSize));
|
|
}
|
|
}
|
|
return ajaxResult;
|
|
}
|
|
}
|