|
@@ -3,6 +3,8 @@ package com.kexun.controller;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
import com.kexun.common.JsonFile;
|
|
|
import com.kexun.common.utils.Result;
|
|
|
import com.kexun.entity.*;
|
|
@@ -11,7 +13,9 @@ import com.kexun.service.*;
|
|
|
import org.apache.commons.io.FileUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
-
|
|
|
+import java.util.Collections;
|
|
|
+import java.util.Comparator;
|
|
|
+import java.util.Date;
|
|
|
import java.io.*;
|
|
|
import java.util.*;
|
|
|
|
|
@@ -48,7 +52,6 @@ public class ModelController {
|
|
|
|
|
|
|
|
|
private JsonFile jsonFile = new JsonFile();
|
|
|
-
|
|
|
@GetMapping("getModelNo")
|
|
|
public Result getModelNo(){
|
|
|
JSONObject resJson = new JSONObject();
|
|
@@ -451,12 +454,27 @@ public class ModelController {
|
|
|
}
|
|
|
|
|
|
//列举usermodel
|
|
|
- @GetMapping("getUserModel")
|
|
|
- public Result getUserModel(SysUser sysUser) {
|
|
|
+ @RequestMapping("getUserModel")
|
|
|
+ public Result getUserModel(@RequestBody String json) {
|
|
|
+ JSONObject req = JSON.parseObject(json);
|
|
|
+ int pageNum = req.getIntValue("pageNum");
|
|
|
+ int pageSize = req.getIntValue("pageSize");
|
|
|
+// System.out.println(pageNum);
|
|
|
+// System.out.println(pageSize);
|
|
|
+ PageHelper.startPage(pageNum, pageSize);//设置分页信息
|
|
|
JSONObject resJson = new JSONObject();
|
|
|
- List<ModelEntity> model_list = userModelService.findAll();
|
|
|
-// List<ModelEntity> model_Entity_list = userModelService.findByUserName(sysUser.getUserName());
|
|
|
- resJson.put("modelData", model_list);
|
|
|
+
|
|
|
+ //List<ModelEntity> model_Entity_list = userModelService.findByUserName(sysUser.getUserName());
|
|
|
+ //写死
|
|
|
+// List<ModelEntity> model_Entity_list = userModelService.findByUserName("1");
|
|
|
+// System.out.println(model_Entity_list);
|
|
|
+ List<ModelEntity> model_Entity_list = userModelService.getUserModel();
|
|
|
+// System.out.println(model_Entity_list.get(0).getCreateTime());
|
|
|
+
|
|
|
+ PageInfo pageInfo=new PageInfo(model_Entity_list);
|
|
|
+// System.out.println(pageInfo);
|
|
|
+ resJson.put("modelData",pageInfo);
|
|
|
+
|
|
|
return Result.success("ok", resJson);
|
|
|
}
|
|
|
|
|
@@ -481,8 +499,8 @@ public class ModelController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- @PostMapping("changeModelByID")
|
|
|
- public Result changeModelByID(@RequestBody String json, SysUser sysUser) throws IOException {
|
|
|
+ @PostMapping("changeModelByID")
|
|
|
+ public Result changeModelByID(@RequestBody String json, SysUser sysUser) throws IOException {
|
|
|
//获取参数
|
|
|
JSONObject resJson = new JSONObject();
|
|
|
JSONObject req = JSON.parseObject(json);
|
|
@@ -582,8 +600,12 @@ public class ModelController {
|
|
|
String state = req.getString("modelstate");
|
|
|
|
|
|
System.out.println(id);
|
|
|
+ System.out.println(state);
|
|
|
ModelEntity modelEntity = userModelService.findByID(id);
|
|
|
|
|
|
+ System.out.println(modelEntity);
|
|
|
+
|
|
|
+
|
|
|
modelEntity.setStatus(state);
|
|
|
|
|
|
userModelService.updateById(modelEntity);
|