|
@@ -3,6 +3,9 @@ package com.ruoyi.uniapp.controller;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
|
|
+import com.ruoyi.common.core.web.page.TableDataInfo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.http.MediaType;
|
|
import org.springframework.http.MediaType;
|
|
@@ -28,24 +31,26 @@ public class KnowledgeController extends BaseController {
|
|
|
* 获取农技知识列表
|
|
* 获取农技知识列表
|
|
|
*/
|
|
*/
|
|
|
@GetMapping("/tech")
|
|
@GetMapping("/tech")
|
|
|
- public AjaxResult getTechList(@RequestParam(required = false, defaultValue = "1") Integer pageNum,
|
|
|
|
|
- @RequestParam(required = false, defaultValue = "10") Integer pageSize) {
|
|
|
|
|
|
|
+ public TableDataInfo getTechList(@RequestParam(required = false, defaultValue = "1") Integer pageNum,
|
|
|
|
|
+ @RequestParam(required = false, defaultValue = "10") Integer pageSize) {
|
|
|
Integer userId = null;
|
|
Integer userId = null;
|
|
|
try {
|
|
try {
|
|
|
userId = SecurityUtils.getUserId().intValue();
|
|
userId = SecurityUtils.getUserId().intValue();
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
// 未登录或token无效
|
|
// 未登录或token无效
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ PageHelper.startPage(ObjectUtil.defaultIfNull(pageNum, 1), ObjectUtil.defaultIfNull(pageSize, 10));
|
|
|
|
|
+
|
|
|
List<KnowledgeArticleVO> list = knowledgeService.getTechList(pageNum, pageSize, userId);
|
|
List<KnowledgeArticleVO> list = knowledgeService.getTechList(pageNum, pageSize, userId);
|
|
|
- return AjaxResult.success(list);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ return getDataTable(list);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 获取政策解读列表
|
|
* 获取政策解读列表
|
|
|
*/
|
|
*/
|
|
|
@GetMapping("/policy")
|
|
@GetMapping("/policy")
|
|
|
- public AjaxResult getPolicyList(@RequestParam(required = false, defaultValue = "1") Integer pageNum,
|
|
|
|
|
|
|
+ public TableDataInfo getPolicyList(@RequestParam(required = false, defaultValue = "1") Integer pageNum,
|
|
|
@RequestParam(required = false, defaultValue = "10") Integer pageSize) {
|
|
@RequestParam(required = false, defaultValue = "10") Integer pageSize) {
|
|
|
Integer userId = null;
|
|
Integer userId = null;
|
|
|
try {
|
|
try {
|
|
@@ -53,9 +58,10 @@ public class KnowledgeController extends BaseController {
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
// 未登录或token无效
|
|
// 未登录或token无效
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ PageHelper.startPage(ObjectUtil.defaultIfNull(pageNum, 1), ObjectUtil.defaultIfNull(pageSize, 10));
|
|
|
|
|
+
|
|
|
List<KnowledgeArticleVO> list = knowledgeService.getPolicyList(pageNum, pageSize, userId);
|
|
List<KnowledgeArticleVO> list = knowledgeService.getPolicyList(pageNum, pageSize, userId);
|
|
|
- return AjaxResult.success(list);
|
|
|
|
|
|
|
+ return getDataTable(list);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|