src/main/java/studio/baxia/fo/controller/BCategoryController.java
(开头部分) 5KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
package studio.baxia.fo.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.annotation.*;
import studio.baxia.fo.common.CommonConstant;
import studio.baxia.fo.common.CommonResult;
import studio.baxia.fo.pojo.Article;
import studio.baxia.fo.pojo.Category;
import studio.baxia.fo.service.IBArticleService;
import studio.baxia.fo.service.IBCategoryService;
import studio.baxia.fo.vo.CategoryVo;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* Created by Pan on 2016/12/4.
*/
@RequestMapping(value = "")
@Controller
public class BCategoryController {
@Autowired
private IBCategoryService categoryService;
@Autowired
private IBArticleService articleService;
@ResponseBody
@RequestMapping(value = "/blog/category/{code:.+}",method = RequestMethod.GET)
public CommonResult listCategoryArticle(@PathVariable("code")String code){
Map<String,Object> resultData = articleService.getAllByCategoryCode(code, CommonConstant.CATEGORY_ALL);
return new CommonResult(CommonConstant.SUCCESS_CODE,"",resultData);
}
@ResponseBody
@RequestMapping(value = "/blog/category",method = RequestMethod.GET)
public CommonResult listCategorys(){
List<CategoryVo> listCategorys = categoryService.getAllVoBy(CommonConstant.ACTICLE_STATUS_BLOG,CommonConstant.CATEGORY_SHOW);
return new CommonResult(CommonConstant.SUCCESS_CODE,"",listCategorys);
}
/*管理url开始*/
@ResponseBody
@RequestMapping(value = "/manage/category", method = RequestMethod.GET)
public CommonResult listMCategorys() {
List<CategoryVo> listCategorys = categoryService.getAllVoBy(null,CommonConstant.CATEGORY_ALL);
return new CommonResult(CommonConstant.SUCCESS_CODE, "", listCategorys);
}
@ResponseBody
@RequestMapping(value = "/manage/category/{categoryId}", method = RequestMethod.GET)
public CommonResult listCategoryArticles(@PathVariable("categoryId") Integer categoryId) {
List<Article> listCategoryArticles = articleService.getAllByCategoryId(categoryId, null);
return new CommonResult(CommonConstant.SUCCESS_CODE, "", listCategoryArticles);
后面还有 78 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
