TRX vor 1 Jahr
Ursprung
Commit
03a7c9ba54

+ 0 - 3
OneCardIotClient/src/main/java/com/zhongshu/iot/client/model/operLogs/OperationLogsModel.java

@@ -75,7 +75,4 @@ public class OperationLogsModel extends SuperModel {
     @Schema(description = "管理数据ID")
     private String dataId;
 
-    @Schema(description = "关联保存关联信息")
-    private Object backObj;
-
 }

+ 2 - 0
OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/dao/iot/IotTemplateDao.java

@@ -14,6 +14,8 @@ public interface IotTemplateDao extends IotTemplateDaoExtend, org.springframewor
 
     IotTemplate findTopById(String id);
 
+    IotTemplate findTopByProductCode(String productCode);
+
     IotTemplate findTopByNameAndIotDataType(String name, IotDataType iotDataType);
 
     IotTemplate findTopByNameAndDeviceIdAndIotDataType(String name, String deviceId, IotDataType iotDataType);

+ 5 - 0
OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/service/iot/IotServiceImpl.java

@@ -118,8 +118,13 @@ public class IotServiceImpl extends SuperService {
             if (ObjectUtils.isNotEmpty(nameTemp) && !nameTemp.getId().equals(template.getId())) {
                 return ResultContent.buildFail(String.format(ResultMessage.NAME_EXIST, param.getName()));
             }
+            IotTemplate codeTemp = iotTemplateDao.findTopByProductCode(param.getProductCode());
+            if (ObjectUtils.isNotEmpty(codeTemp) && !codeTemp.getId().equals(template.getId())) {
+                return ResultContent.buildFail(String.format("%s已存在", param.getProductCode()));
+            }
             template.setName(param.getName());
             template.setRemark(param.getRemark());
+            template.setProductCode(param.getProductCode());
         } else {
             // 添加
             if (param.getDeviceCategory() == null) {