From 53e7dce8d55487cbac64e4374ec9aa1b52a6c6ed Mon Sep 17 00:00:00 2001
From: SZH <szh_hello@163.com>
Date: Thu, 09 Mar 2023 21:16:43 +0800
Subject: [PATCH] 解决npe问题
---
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/MaterialClassifyController.java | 32 +++++++++++++++++++++++++++-----
1 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/MaterialClassifyController.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/MaterialClassifyController.java
index 8b13294..91a9ab1 100644
--- a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/MaterialClassifyController.java
+++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/MaterialClassifyController.java
@@ -3,10 +3,11 @@
import com.alibaba.fastjson.JSONObject;
import com.gkhy.safePlatform.commons.co.ContextCacheUser;
import com.gkhy.safePlatform.commons.enums.ResultCodes;
+import com.gkhy.safePlatform.commons.query.PageQuery;
+import com.gkhy.safePlatform.commons.utils.PageUtils;
import com.gkhy.safePlatform.commons.vo.ResultVO;
-import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialClassifyAddReq;
-import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialClassifyModReq;
-import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialClassifyQuery;
+import com.gkhy.safePlatform.commons.vo.SearchResultVO;
+import com.gkhy.safePlatform.equipment.model.dto.req.*;
import com.gkhy.safePlatform.equipment.model.dto.resp.SafeMaterialClassifyDto;
import com.gkhy.safePlatform.equipment.service.MaterialClassifyService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -32,6 +33,17 @@
public ResultVO<List<SafeMaterialClassifyDto>> list(Authentication authentication){
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
return new ResultVO<>(ResultCodes.OK,materialClassifyService.list());
+
+ }
+ /**
+ * 列表
+ * @return
+ */
+ @PostMapping(value = "page/list")
+ public SearchResultVO<List<SafeMaterialClassifyDto>> listByPage(Authentication authentication,@RequestBody PageQuery<MaterialClassifyQuery> pageQuery){
+ ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
+ PageUtils.checkCheck(pageQuery);
+ return materialClassifyService.listByPage(currentUser,pageQuery);
}
@@ -63,15 +75,25 @@
public ResultVO delete(Authentication authentication, @RequestBody JSONObject jsonObject){
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
Long id = jsonObject.getLong("id");
- return materialClassifyService.delete(id);
+ return materialClassifyService.delete(currentUser,id);
}
+ /**
+ * 逻辑删除-批量
+ * @return
+ */
+// @PostMapping(value = "batch/delete")
+// public ResultVO batchDelete(Authentication authentication, @Validated @RequestBody ParamForm paramForm){
+// ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
+// return materialClassifyService.batchDelete(currentUser,paramForm);
+// }
/**
* 查询单条数据
*/
@PostMapping(value = "queryById")
public ResultVO<SafeMaterialClassifyDto> queryById(Authentication authentication, @RequestBody JSONObject jsonObject){
+ ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
Long id = jsonObject.getLong("id");
- return new ResultVO<>(ResultCodes.OK,materialClassifyService.queryById(id));
+ return new ResultVO<>(ResultCodes.OK,materialClassifyService.queryById(currentUser,id));
}
}
--
Gitblit v1.9.2