This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package com.corewing.app.controller;
|
||||
package com.corewing.app.modules.app;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@@ -10,10 +10,9 @@ import com.corewing.app.service.TutorialCategoryService;
|
||||
import com.corewing.app.service.TutorialService;
|
||||
import com.corewing.app.util.I18nUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -21,7 +20,7 @@ import java.util.List;
|
||||
* 教程接口
|
||||
*/
|
||||
@RequestMapping("/tutorial")
|
||||
@RestController
|
||||
@Controller
|
||||
@Slf4j
|
||||
public class TutorialController {
|
||||
|
||||
@@ -33,12 +32,27 @@ public class TutorialController {
|
||||
this.tutorialCategoryService = tutorialCategoryService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到界面查看教程详情
|
||||
* @param tutorialId 教程id
|
||||
* @param model 数据模型
|
||||
* @return 详情页
|
||||
*/
|
||||
@GetMapping("/viewDetail/{tutorialId}")
|
||||
public String viewDetail(@PathVariable Long tutorialId, ModelMap model) {
|
||||
Tutorial tutorial = tutorialService.getById(tutorialId);
|
||||
model.put("tutorial", tutorial);
|
||||
return "/app/tutorial/viewDetail";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加查看次数
|
||||
* @param tutorialId 教程id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/addViewCount")
|
||||
@ResponseBody
|
||||
public Result<String> addViewCount(@RequestParam Long tutorialId) {
|
||||
Tutorial tutorial = tutorialService.getById(tutorialId);
|
||||
if(tutorial == null) {
|
||||
@@ -56,6 +70,7 @@ public class TutorialController {
|
||||
*
|
||||
*/
|
||||
@GetMapping("/category")
|
||||
@ResponseBody
|
||||
public Result<List<TutorialCategory>> category(
|
||||
@RequestParam(required = false, defaultValue = "0") Integer firstStatus
|
||||
) {
|
||||
@@ -77,6 +92,7 @@ public class TutorialController {
|
||||
*
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
@ResponseBody
|
||||
public Result<IPage<Tutorial>> getPageList(
|
||||
@RequestParam(defaultValue = "1") Long current,
|
||||
@RequestParam(defaultValue = "10") Long size,
|
||||
10
src/main/resources/templates/app/tutorial/viewDetail.html
Normal file
10
src/main/resources/templates/app/tutorial/viewDetail.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title th:text="${tutorial?.tutorialTitle}"></title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user