fix: 修改数据记录,需要先通知 engine进行删除。

feihu wang
This commit is contained in:
feihu.wang
2020-12-17 16:35:39 +08:00
parent dd45383fdd
commit 3237b16500
2 changed files with 9 additions and 2 deletions

View File

@@ -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(), "");

View File

@@ -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);