|
@@ -133,8 +133,8 @@ public class RelationSyEqController {
|
|
|
public AdmResponse createDistinctEq(@RequestBody JSONObject param) throws Exception {
|
|
|
String equipId = param.getString("equipId");
|
|
|
JSONArray sysIdList = param.getJSONArray("sysIdList");
|
|
|
- if(StringUtils.isEmpty(equipId) || CollUtil.isEmpty(sysIdList)) {
|
|
|
- return AdmResponse.failure("必填项:EquipId(设备id)、sysIdList(系统id列表)");
|
|
|
+ if(StringUtils.isEmpty(equipId)) {
|
|
|
+ return AdmResponse.failure("必填项:EquipId(设备id)");
|
|
|
}
|
|
|
InstanceUrlParam context = AdmContextUtil.toDmpContext();
|
|
|
QueryCriteria queryRequest = new QueryCriteria();
|
|
@@ -142,15 +142,19 @@ public class RelationSyEqController {
|
|
|
node.put("graphCode", "MechSubset");
|
|
|
node.put("relCode", "Sy2Eq");
|
|
|
node.put("objTo", equipId);
|
|
|
+ //删除关系
|
|
|
queryRequest.setCriteria(node);
|
|
|
service.doDelete(context,queryRequest);
|
|
|
- // 创建关系对象
|
|
|
- List<RelationDTO> voList = new ArrayList<>();
|
|
|
- sysIdList.forEach(item->{
|
|
|
- voList.add(new RelationDTO(null, "MechSubset", "Sy2Eq", null, item.toString() , equipId));
|
|
|
- });
|
|
|
- // 组装上下文条件
|
|
|
- service.doSave(context, voList);
|
|
|
+ if(!CollUtil.isEmpty(sysIdList)){
|
|
|
+ // 创建关系对象
|
|
|
+ List<RelationDTO> voList = new ArrayList<>();
|
|
|
+ sysIdList.forEach(item->{
|
|
|
+ voList.add(new RelationDTO(null, "MechSubset", "Sy2Eq", null, item.toString() , equipId));
|
|
|
+ });
|
|
|
+ // 组装上下文条件
|
|
|
+ service.doSave(context, voList);
|
|
|
+ }
|
|
|
+
|
|
|
return AdmResponse.success();
|
|
|
}
|
|
|
|