|
|
|
|
@ -62,17 +62,32 @@ public class MemoryToolServiceImpl implements MemoryToolService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 🟩 如果是 equ_base,则单独处理为更新型实体
|
|
|
|
|
// if ("equ_base".equalsIgnoreCase(param)) {
|
|
|
|
|
// if (value instanceof Map) {
|
|
|
|
|
// Map<String, Object> row = (Map<String, Object>) value;
|
|
|
|
|
// Object entity = createEntityForTable("equ_base", row);
|
|
|
|
|
// if (entity != null) {
|
|
|
|
|
// // 填入设备ID(更新时使用)
|
|
|
|
|
// fillField(entity, "equ_base", "id", device.getId());
|
|
|
|
|
// updateEntities.put("equ_base", entity);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// continue; // 跳过普通插入逻辑
|
|
|
|
|
// }
|
|
|
|
|
if ("equ_base".equalsIgnoreCase(param)) { |
|
|
|
|
if (value instanceof Map) { |
|
|
|
|
Map<String, Object> row = (Map<String, Object>) value; |
|
|
|
|
Object entity = createEntityForTable("equ_base", row); |
|
|
|
|
if (value instanceof String) { |
|
|
|
|
String version = (String) value; |
|
|
|
|
// 创建一个实体对象
|
|
|
|
|
Object entity = createEntityForTable("equ_base", new HashMap<>()); |
|
|
|
|
if (entity != null) { |
|
|
|
|
// 填入设备ID(更新时使用)
|
|
|
|
|
// 填上设备ID
|
|
|
|
|
fillField(entity, "equ_base", "id", device.getId()); |
|
|
|
|
// 填上版本号(假设数据库字段叫 soft_version)
|
|
|
|
|
fillField(entity, "equ_base", "version", version); |
|
|
|
|
updateEntities.put("equ_base", entity); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
continue; // 跳过普通插入逻辑
|
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//插入行实体
|
|
|
|
|
@ -209,7 +224,10 @@ public class MemoryToolServiceImpl implements MemoryToolService { |
|
|
|
|
switch (tableName) { |
|
|
|
|
case "equ_interface": |
|
|
|
|
EquInterface equInterface=new EquInterface(); |
|
|
|
|
rowData.forEach((k, v) -> fillField(equInterface, tableName, k, v != null ? v.toString() : null)); |
|
|
|
|
rowData.forEach((k, v) -> fillField(equInterface, tableName, k, v != null ? v.toString() :null)); |
|
|
|
|
if (equInterface.getLossRate() == null) equInterface.setLossRate(BigDecimal.ZERO); |
|
|
|
|
if (equInterface.getErrorRate() == null) equInterface.setErrorRate(BigDecimal.ZERO); |
|
|
|
|
if (equInterface.getRate() == null) equInterface.setRate(0L); |
|
|
|
|
return equInterface; |
|
|
|
|
case "equ_routing": |
|
|
|
|
|
|
|
|
|
|