contentDetail
parent
e1519a22a4
commit
f941271019
@ -0,0 +1,44 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,10 @@
|
|||||||
package com.bsd.cases.service;
|
package com.bsd.cases.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface CaseContentCommentsService<CaseContentComments> extends BaseService<CaseContentComments> {
|
public interface CaseContentCommentsService<CaseContentComments> extends BaseService<CaseContentComments> {
|
||||||
|
|
||||||
|
JSONObject getCaseContentCommentsByContentId(Long contentId, Integer pageNum, Integer pageSize);
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,35 @@
|
|||||||
package com.bsd.cases.service.impl;
|
package com.bsd.cases.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.bsd.cases.constants.Constants;
|
||||||
import com.bsd.cases.mapper.CaseContentCommentsMapper;
|
import com.bsd.cases.mapper.CaseContentCommentsMapper;
|
||||||
import com.bsd.cases.model.CaseContentComments;
|
import com.bsd.cases.model.CaseContentComments;
|
||||||
import com.bsd.cases.service.CaseContentCommentsService;
|
import com.bsd.cases.service.CaseContentCommentsService;
|
||||||
|
import com.bsd.cases.util.PageUtils;
|
||||||
|
import com.bsd.cases.vo.CaseContentCommentsVo;
|
||||||
|
import com.sun.org.apache.bcel.internal.generic.NEW;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.yaml.snakeyaml.scanner.Constant;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Service("caseContentCommentsService")
|
@Service("caseContentCommentsService")
|
||||||
@Transactional
|
@Transactional
|
||||||
public class CaseContentCommentsServiceImpl extends BaseServiceImpl<CaseContentCommentsMapper, CaseContentComments>
|
public class CaseContentCommentsServiceImpl extends BaseServiceImpl<CaseContentCommentsMapper, CaseContentComments>
|
||||||
implements CaseContentCommentsService<CaseContentComments> {
|
implements CaseContentCommentsService<CaseContentComments> {
|
||||||
|
@Resource
|
||||||
|
private CaseContentCommentsMapper caseContentCommentsMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject getCaseContentCommentsByContentId(Long contentId, Integer pageNum, Integer pageSize) {
|
||||||
|
CaseContentComments findCaseContentComments = new CaseContentComments();
|
||||||
|
findCaseContentComments.setState(Constants.STATE_VALID);
|
||||||
|
findCaseContentComments.setContentId(contentId);
|
||||||
|
List<CaseContentComments> caseContentCommentsList = caseContentCommentsMapper.select(findCaseContentComments);
|
||||||
|
JSONObject jsonObject = PageUtils.page(caseContentCommentsList,pageNum,pageSize);
|
||||||
|
return jsonObject;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.bsd.cases.vo;
|
||||||
|
|
||||||
|
import com.bsd.cases.model.CaseContentComments;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CaseContentCommentsVo extends CaseContentComments {
|
||||||
|
|
||||||
|
private String userName;
|
||||||
|
}
|
Loading…
Reference in New Issue