Bläddra i källkod

Merge branch 'dev-2.2.0' of depot-qinghai/depot-storage-qinghai into dev

fanxw 1 år sedan
förälder
incheckning
173e260c43

+ 21 - 5
src/main/java/com/chinaitop/depot/warningAndAlarm/controller/YjBjController.java

@@ -5,6 +5,7 @@ import java.util.List;
5
 import javax.annotation.Resource;
5
 import javax.annotation.Resource;
6
 
6
 
7
 import org.apache.commons.lang.StringUtils;
7
 import org.apache.commons.lang.StringUtils;
8
+import org.springframework.http.MediaType;
8
 import org.springframework.web.bind.annotation.RequestMapping;
9
 import org.springframework.web.bind.annotation.RequestMapping;
9
 import org.springframework.web.bind.annotation.RequestMethod;
10
 import org.springframework.web.bind.annotation.RequestMethod;
10
 import org.springframework.web.bind.annotation.RestController;
11
 import org.springframework.web.bind.annotation.RestController;
@@ -81,13 +82,29 @@ public class YjBjController {
81
 		return ResponseEntity.ok(pageInfo);
82
 		return ResponseEntity.ok(pageInfo);
82
 	}
83
 	}
83
 
84
 
85
+	@RequestMapping(value = "queryById", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET)
86
+    @ApiOperation(value = "根据id加载对应数据", notes = "根据id加载对应数据")
87
+    @ApiImplicitParams({
88
+            @ApiImplicitParam(name = "id", value = "主键id", paramType = "query"),
89
+    })
90
+    public ResponseEntity<StorageRotationWarningWithBLOBs> queryById(String id) {
91
+        try {
92
+            if (id == null) {
93
+                return ResponseEntity.failed("数据ID不能为空!");
94
+            }
95
+            return ResponseEntity.ok(yjbjService.queryById(id));
96
+        } catch (Exception e) {
97
+            e.printStackTrace();
98
+            return ResponseEntity.failed(e.getMessage());
99
+        }
100
+    }
101
+
84
 	@RequestMapping(value="/editLhyj", method = RequestMethod.GET)
102
 	@RequestMapping(value="/editLhyj", method = RequestMethod.GET)
85
 	@ApiOperation(value="预警报警数据更新", notes = "")
103
 	@ApiOperation(value="预警报警数据更新", notes = "")
86
 	@ApiImplicitParams({
104
 	@ApiImplicitParams({
87
-        @ApiImplicitParam(name = "lhyjJson", value = "数据对象", paramType = "query")
105
+        @ApiImplicitParam(name = "lhyjJson", value = "数据对象", paramType = "form")
88
 	})
106
 	})
89
 	public ResponseEntity editLhyj(String lhyjJson) {
107
 	public ResponseEntity editLhyj(String lhyjJson) {
90
-		PageInfo<StorageRotationWarning> pageInfo = null;
91
 		try {
108
 		try {
92
 			if (StringUtils.isNotBlank(lhyjJson)) {
109
 			if (StringUtils.isNotBlank(lhyjJson)) {
93
 				StorageRotationWarningWithBLOBs storageRotationWarningWithBLOBs = JSONObject.parseObject(lhyjJson, StorageRotationWarningWithBLOBs.class);
110
 				StorageRotationWarningWithBLOBs storageRotationWarningWithBLOBs = JSONObject.parseObject(lhyjJson, StorageRotationWarningWithBLOBs.class);
@@ -96,12 +113,11 @@ public class YjBjController {
96
                 }
113
                 }
97
 
114
 
98
                 yjbjService.updateDate(storageRotationWarningWithBLOBs);
115
                 yjbjService.updateDate(storageRotationWarningWithBLOBs);
99
-
100
-                return ResponseEntity.ok();
101
             }
116
             }
102
 		} catch (Exception e) {
117
 		} catch (Exception e) {
103
 			log.error(e.getMessage(), e);
118
 			log.error(e.getMessage(), e);
119
+			return ResponseEntity.ok(e.getMessage(), lhyjJson);
104
 		}
120
 		}
105
-		return ResponseEntity.ok(pageInfo);
121
+		return ResponseEntity.ok();
106
 	}
122
 	}
107
 }
123
 }

+ 8 - 0
src/main/java/com/chinaitop/depot/warningAndAlarm/service/YjbjService.java

@@ -35,4 +35,12 @@ public interface YjbjService {
35
 	 * @throws Exception
35
 	 * @throws Exception
36
 	 */
36
 	 */
37
 	public void updateDate(StorageRotationWarningWithBLOBs storageRotationWarningWithBLOBs) throws Exception;
37
 	public void updateDate(StorageRotationWarningWithBLOBs storageRotationWarningWithBLOBs) throws Exception;
38
+
39
+	/**
40
+	 * 按主键ID查询一条数据
41
+	 * @param id
42
+	 * @return
43
+	 * @throws Exception 
44
+	 */
45
+	public StorageRotationWarningWithBLOBs queryById(String id) throws Exception;
38
 }
46
 }

+ 5 - 0
src/main/java/com/chinaitop/depot/warningAndAlarm/service/impl/YjbjServiceImpl.java

@@ -85,4 +85,9 @@ public class YjbjServiceImpl implements YjbjService {
85
 		storageRotationWarningMapper.updateByPrimaryKeyWithBLOBs(storageRotationWarningWithBLOBs);
85
 		storageRotationWarningMapper.updateByPrimaryKeyWithBLOBs(storageRotationWarningWithBLOBs);
86
 	}
86
 	}
87
 
87
 
88
+	@Override
89
+	public StorageRotationWarningWithBLOBs queryById(String id) throws Exception {
90
+		return storageRotationWarningMapper.selectByPrimaryKey(id);
91
+	}
92
+
88
 }
93
 }