|
@@ -26,57 +26,63 @@ import java.util.List;
|
|
|
@Controller
|
|
|
public class ArticleController extends BaseController {
|
|
|
|
|
|
- private static final String ARTICLE_LIST_PATH = "article/list";
|
|
|
- private static final String ARTICLE_DETAIL_PATH = "article/detail";
|
|
|
+ private static final String ARTICLE_LIST_PATH = "article/list";
|
|
|
+ private static final String ARTICLE_DETAIL_PATH = "article/detail";
|
|
|
private ArticleService articleService;
|
|
|
+
|
|
|
@Autowired
|
|
|
public void setArticleService(ArticleService articleService) {
|
|
|
this.articleService = articleService;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 文章列表【旧center】
|
|
|
- */
|
|
|
- @GetMapping("/info/center-{id}-1.html")
|
|
|
- public String toArticleList(@PathVariable("id") Integer id, final Model model) {
|
|
|
- List<BaseLink> typeList = articleService.getArticleTypes();
|
|
|
- model.addAttribute("articleType", typeList);
|
|
|
- model.addAttribute("typeId", id);
|
|
|
- model.addAttribute("labelId", 0);
|
|
|
- return ARTICLE_LIST_PATH;
|
|
|
- }
|
|
|
- /**
|
|
|
- * 文章列表【旧label】
|
|
|
- */
|
|
|
- @GetMapping("/info/label-{id}-1.html")
|
|
|
- public String toArticleLabel(@PathVariable("id") Integer id, final Model model) {
|
|
|
- List<BaseLink> typeList = articleService.getArticleTypes();
|
|
|
- model.addAttribute("articleType", typeList);
|
|
|
- model.addAttribute("typeId", 0);
|
|
|
- model.addAttribute("labelId", id);
|
|
|
- return ARTICLE_LIST_PATH;
|
|
|
- }
|
|
|
- /**
|
|
|
- * 文章搜索结果
|
|
|
- */
|
|
|
- @GetMapping("/info/search.html")
|
|
|
- public String toArticleSearch(final Model model) {
|
|
|
- List<BaseLink> typeList = articleService.getArticleTypes();
|
|
|
- model.addAttribute("articleType", typeList);
|
|
|
- model.addAttribute("typeId", 0);
|
|
|
- model.addAttribute("labelId", 0);
|
|
|
- return ARTICLE_LIST_PATH;
|
|
|
- }
|
|
|
- /**
|
|
|
- * 文章详情【旧】
|
|
|
- */
|
|
|
- @GetMapping("/info/detail-{id}-1.html")
|
|
|
- public String toArticleDetail(@PathVariable("id") Integer id, final Model model) {
|
|
|
- List<BaseLink> typeList = articleService.getArticleTypes();
|
|
|
- model.addAttribute("articleType", typeList);
|
|
|
- model.addAttribute("articleId", id);
|
|
|
- return ARTICLE_DETAIL_PATH;
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 文章列表【旧center】
|
|
|
+ */
|
|
|
+ @GetMapping("/info/center-{id}-1.html")
|
|
|
+ public String toArticleList(@PathVariable("id") Integer id, final Model model) {
|
|
|
+ List<BaseLink> typeList = articleService.getArticleTypes();
|
|
|
+ model.addAttribute("articleType", typeList);
|
|
|
+ model.addAttribute("typeId", id);
|
|
|
+ model.addAttribute("labelId", 0);
|
|
|
+ return ARTICLE_LIST_PATH;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 文章列表【旧label】
|
|
|
+ */
|
|
|
+ @GetMapping("/info/label-{id}-1.html")
|
|
|
+ public String toArticleLabel(@PathVariable("id") Integer id, final Model model) {
|
|
|
+ List<BaseLink> typeList = articleService.getArticleTypes();
|
|
|
+ model.addAttribute("articleType", typeList);
|
|
|
+ model.addAttribute("typeId", 0);
|
|
|
+ model.addAttribute("labelId", id);
|
|
|
+ return ARTICLE_LIST_PATH;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 文章搜索结果
|
|
|
+ */
|
|
|
+ @GetMapping("/info/search.html")
|
|
|
+ public String toArticleSearch(final Model model) {
|
|
|
+ List<BaseLink> typeList = articleService.getArticleTypes();
|
|
|
+ model.addAttribute("articleType", typeList);
|
|
|
+ model.addAttribute("typeId", 0);
|
|
|
+ model.addAttribute("labelId", 0);
|
|
|
+ return ARTICLE_LIST_PATH;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 文章详情【旧】
|
|
|
+ */
|
|
|
+ @GetMapping("/info/detail-{id}-1.html")
|
|
|
+ public String toArticleDetail(@PathVariable("id") Integer id, final Model model) {
|
|
|
+ List<BaseLink> typeList = articleService.getArticleTypes();
|
|
|
+ Article article = articleService.getArticleInfo(id);
|
|
|
+ model.addAttribute("article", article);
|
|
|
+ model.addAttribute("articleType", typeList);
|
|
|
+ model.addAttribute("articleId", id);
|
|
|
+ return ARTICLE_DETAIL_PATH;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 获取文章热门标签
|
|
@@ -104,8 +110,8 @@ public class ArticleController extends BaseController {
|
|
|
@GetMapping("/article/related")
|
|
|
@ResponseBody
|
|
|
public JsonModel<PageInfo<Article>> getArticleRelated(Integer id, String labels,
|
|
|
- @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
|
|
|
- @RequestParam(value = "pageSize", defaultValue = "3") int pageSize) {
|
|
|
+ @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "3") int pageSize) {
|
|
|
return articleService.getArticleRelated(id, labels, pageNum, pageSize);
|
|
|
}
|
|
|
|
|
@@ -123,8 +129,8 @@ public class ArticleController extends BaseController {
|
|
|
*/
|
|
|
@GetMapping("/article/label/click")
|
|
|
@ResponseBody
|
|
|
- public JsonModel clickArticleLabel(Integer id){
|
|
|
- return articleService.clickArticleLabel(id);
|
|
|
+ public JsonModel clickArticleLabel(Integer id) {
|
|
|
+ return articleService.clickArticleLabel(id);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -132,8 +138,8 @@ public class ArticleController extends BaseController {
|
|
|
*/
|
|
|
@GetMapping("/article/ad/click")
|
|
|
@ResponseBody
|
|
|
- public JsonModel clickArticleAd(Integer id){
|
|
|
- return articleService.clickArticleAd(id);
|
|
|
+ public JsonModel clickArticleAd(Integer id) {
|
|
|
+ return articleService.clickArticleAd(id);
|
|
|
}
|
|
|
|
|
|
}
|