Browse Source

opc完善

hfxc226 2 years ago
parent
commit
6036686bc9

+ 4 - 4
platform-rest/src/main/java/com/platform/rest/controller/remote/RemoteOpcController.java

@@ -51,9 +51,9 @@ public class RemoteOpcController {
      * @param positionNum 主键
      * @return R
      */
-    @GetMapping("/positionNum/{positionNum}")
-    public R<RemoteOpc> getByPositionNum(@PathVariable("positionNum") String positionNum) {
-        return new R<>(remoteMeasureService.getModelByPositionNum(positionNum));
+    @GetMapping("/positionNum/{positionNum}/{line}")
+    public R<RemoteOpc> getByPositionNum(@PathVariable("positionNum") String positionNum, @PathVariable("line") String line) {
+        return new R<>(remoteMeasureService.getModelByPositionNumAndLine(positionNum, line));
     }
 
     /**
@@ -92,7 +92,7 @@ public class RemoteOpcController {
     @SysLog("批量删除opc点位对应表")
     @PutMapping("/update/batch/{updateType}/{value}")
     @PreAuthorize("@pms.hasPermission('remote-opcs-del')")
-    public R updateIds(@RequestBody List<String> ids, @PathVariable("updateType") Integer updateType,@PathVariable("value") Integer value) {
+    public R updateIds(@RequestBody List<String> ids, @PathVariable("updateType") Integer updateType, @PathVariable("value") Integer value) {
         remoteMeasureService.updateIds(ids, updateType, value);
         return new R<>();
     }

+ 1 - 1
platform-service/src/main/java/com/platform/service/remote/RemoteOpcService.java

@@ -56,5 +56,5 @@ public interface RemoteOpcService extends IBaseService<RemoteOpc, RemoteOpcDTO>
 
     void updateIds(List<String> ids, Integer updateType, Integer value);
 
-    RemoteOpc getModelByPositionNum(String positionNum);
+    RemoteOpc getModelByPositionNumAndLine(String positionNum, String line);
 }

+ 4 - 4
platform-service/src/main/java/com/platform/service/remote/impl/RemoteOpcServiceImpl.java

@@ -58,7 +58,7 @@ public class RemoteOpcServiceImpl extends BaseServiceImpl<RemoteOpcMapper, Remot
         // 新增判断点位是否已经存在了
         Weekend<RemoteOpc> weekend = new Weekend<>(RemoteOpc.class);
         WeekendCriteria<RemoteOpc, Object> weekendCriteria = weekend.weekendCriteria();
-        weekendCriteria.andEqualTo(RemoteOpc::getDescription, model.getDescription());
+        weekendCriteria.andEqualTo(RemoteOpc::getDescription, model.getDescription()).andEqualTo(RemoteOpc::getLine, model.getLine());
         int count = mapper.selectCountByExample(weekend);
         // 不存在在设置点位信息
         if (count > 0) {
@@ -92,7 +92,7 @@ public class RemoteOpcServiceImpl extends BaseServiceImpl<RemoteOpcMapper, Remot
         // 新增判断点位是否已经存在了
         Weekend<RemoteOpc> weekend = new Weekend<>(RemoteOpc.class);
         WeekendCriteria<RemoteOpc, Object> weekendCriteria = weekend.weekendCriteria();
-        weekendCriteria.andEqualTo(RemoteOpc::getDescription, model.getDescription());
+        weekendCriteria.andEqualTo(RemoteOpc::getDescription, model.getDescription()).andEqualTo(RemoteOpc::getLine, model.getLine());
         List<RemoteOpc> list = mapper.selectByExample(weekend);
         // 不存在在设置点位信息
         if (!CollectionUtils.isEmpty(list)) {
@@ -223,10 +223,10 @@ public class RemoteOpcServiceImpl extends BaseServiceImpl<RemoteOpcMapper, Remot
     }
 
     @Override
-    public RemoteOpc getModelByPositionNum(String positionNum) {
+    public RemoteOpc getModelByPositionNumAndLine(String positionNum, String line) {
         Weekend<RemoteOpc> weekend = new Weekend<>(RemoteOpc.class);
         WeekendCriteria<RemoteOpc, Object> weekendCriteria = weekend.weekendCriteria();
-        weekendCriteria.andEqualTo(RemoteOpc::getDescription, positionNum);
+        weekendCriteria.andEqualTo(RemoteOpc::getDescription, positionNum).andEqualTo(RemoteOpc::getLine, line);
         return mapper.selectOneByExample(weekend);
     }