master
parent
9fa6b81d33
commit
f7f3323a6f
@ -0,0 +1,47 @@
|
||||
package com.bsd.cases.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bsd.cases.service.CaseContentService;
|
||||
import com.bsd.cases.util.AjaxRequest;
|
||||
import com.bsd.cases.util.AjaxResult;
|
||||
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;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/case-content")
|
||||
public class CaseContentController {
|
||||
|
||||
@Resource
|
||||
private CaseContentService contentService;
|
||||
|
||||
@RequestMapping("/get-content-list-by-category-id")
|
||||
public AjaxResult getContentListByCategoryId(@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 categoryId = data.getLong("categoryId");
|
||||
if (null == categoryId){
|
||||
ajaxResult.setRetcode(AjaxResult.FAILED);
|
||||
ajaxResult.setRetmsg("分级id不可为空");
|
||||
}else {
|
||||
ajaxResult.setRetcode(AjaxResult.SUCCESS);
|
||||
ajaxResult.setData(contentService.getContentListByCategoryId(categoryId,pageNum,pageSize));
|
||||
}
|
||||
}
|
||||
}
|
||||
return ajaxResult;
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bsd.cases.mapper.CaseContentMapper">
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue