ArticleController.java 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package com.caimei.www.controller.unlimited;
  2. import com.caimei.www.controller.BaseController;
  3. import com.caimei.www.pojo.JsonModel;
  4. import com.caimei.www.pojo.page.BaseLink;
  5. import com.caimei.www.service.ArticleService;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.stereotype.Controller;
  8. import org.springframework.web.bind.annotation.GetMapping;
  9. import org.springframework.web.bind.annotation.ResponseBody;
  10. import java.util.List;
  11. /**
  12. * Description
  13. *
  14. * @author : Charles
  15. * @date : 2020/7/31
  16. */
  17. @Controller
  18. public class ArticleController extends BaseController {
  19. private static final String ARTICLE_LIST_PATH = "article/list";
  20. private static final String ARTICLE_DETAIL_PATH = "article/detail";
  21. private ArticleService articleService;
  22. @Autowired
  23. public void setArticleService(ArticleService articleService) {
  24. this.articleService = articleService;
  25. }
  26. /**
  27. * 文章列表页
  28. */
  29. @GetMapping("/article/list.html")
  30. public String articleList() {
  31. return ARTICLE_LIST_PATH;
  32. }
  33. /**
  34. * 文章详情页
  35. */
  36. @GetMapping("/article/detail.html")
  37. public String articleDetail() {
  38. return ARTICLE_DETAIL_PATH;
  39. }
  40. /**
  41. * 获取文章热门标签
  42. */
  43. @GetMapping("/article/labels")
  44. @ResponseBody
  45. public JsonModel<List<BaseLink>> getArticleLabels() {
  46. return articleService.getArticleLabels();
  47. }
  48. }