mirror of
https://gitee.com/freshday/radar.git
synced 2026-03-22 04:37:16 +08:00
fix: 修改数据记录,需要先通知 engine进行删除。
feihu wang
This commit is contained in:
@@ -40,7 +40,7 @@ public class DataListRecordServiceImpl implements DataListRecordService,
|
||||
Map<String, String> dataListRecords = (Map<String, String>) listRecordMap
|
||||
.get(dataListVO.getName());
|
||||
String opt = record.getOpt();
|
||||
if (opt.equals("delete")) {
|
||||
if (("delete").equals(opt)) {
|
||||
dataListRecords.remove(record.getDataRecord());
|
||||
} else {
|
||||
dataListRecords.put(record.getDataRecord(), "");
|
||||
|
||||
@@ -177,12 +177,19 @@ public class DataListsServiceImpl implements DataListsService, SubscribeHandle {
|
||||
@Override
|
||||
public CommonResult saveRecord(DataListRecordVO dataListRecord) {
|
||||
CommonResult result = new CommonResult();
|
||||
DataListsVO dataListVO = dataListDal.get(dataListRecord.getDataListId());
|
||||
if (dataListRecord.getId() != null) {
|
||||
// 通知engine 先删除已经存在的,再update.
|
||||
DataListRecordVO oldRecord = dataListDal.getRecord(dataListRecord.getId());
|
||||
oldRecord.setModelId(dataListVO.getModelId());
|
||||
oldRecord.setOpt("delete");
|
||||
cacheService.publishDataListRecord(oldRecord);
|
||||
}
|
||||
int count = dataListDal.saveRecord(dataListRecord);
|
||||
if (count > 0) {
|
||||
result.getData().put("id", dataListRecord.getId());
|
||||
result.setSuccess(true);
|
||||
// 通知更新
|
||||
DataListsVO dataListVO = dataListDal.get(dataListRecord.getDataListId());
|
||||
dataListRecord.setModelId(dataListVO.getModelId());
|
||||
dataListRecord.setOpt("update");
|
||||
cacheService.publishDataListRecord(dataListRecord);
|
||||
|
||||
Reference in New Issue
Block a user