|
@@ -0,0 +1,62 @@
|
|
|
+package com.gqy.web.controller.document;
|
|
|
+
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
+import com.gqy.common.core.domain.AjaxResult;
|
|
|
+import com.gqy.common.core.domain.AjaxResultCQY;
|
|
|
+import com.gqy.common.utils.StringUtils;
|
|
|
+import com.gqy.document.domain.DocumentCategory;
|
|
|
+import com.gqy.document.domain.Formula;
|
|
|
+import com.gqy.document.domain.vo.PageResult;
|
|
|
+import com.gqy.document.service.IFormulaService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 公式管理Controller
|
|
|
+ *
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/formula")
|
|
|
+public class FormulaController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IFormulaService iFormulaService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询公式列表
|
|
|
+ */
|
|
|
+ @PostMapping("/search")
|
|
|
+ public @ResponseBody AjaxResultCQY search(HttpServletRequest request) {
|
|
|
+ // 获取表单参数
|
|
|
+ String page = request.getParameter("page");
|
|
|
+ String page_size = request.getParameter("pageSize");
|
|
|
+
|
|
|
+ Integer pageNum = StringUtils.isNotEmpty(page) ? Integer.valueOf(page) : 1;
|
|
|
+ Integer pageSize = StringUtils.isNotEmpty(page_size) ? Integer.valueOf(page_size) : 10;
|
|
|
+
|
|
|
+ // 分页查询
|
|
|
+ PageHelper.startPage(pageNum, pageSize);
|
|
|
+ Formula formulaQuery = new Formula();
|
|
|
+ List<Formula> listFormula = iFormulaService.search(formulaQuery);
|
|
|
+
|
|
|
+ PageInfo<Formula> pageInfo = new PageInfo<>(listFormula);
|
|
|
+
|
|
|
+ // 4. 封装并返回结果
|
|
|
+ PageResult PageResult= new PageResult(
|
|
|
+ pageInfo.getPageNum(),
|
|
|
+ pageInfo.getPageSize(),
|
|
|
+ pageInfo.getPages(),
|
|
|
+ pageInfo.getTotal(),
|
|
|
+ pageInfo.getList());
|
|
|
+
|
|
|
+ return AjaxResultCQY.success("查询成功", PageResult);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|