ErrorCode errorCode = ErrorCode.success;
boolean isSuccess = true;
for(DataAccessEntry<Data> entry : dataStatus.values())
{
if(entry.getAction().equals(DataAccessAction.delete)){
isSuccess = new DataAccessSessionMySQL().remove(new UUID[]{entry.getData().getId()});
updateCache(DataAccessAction.delete, entry.getData().getId().getValue(), entry.getData());//删除可以不用事务
//删除标签中数据
deleteTagData("", new String[]{entry.getData().getId().getValue()});
}else if(entry.getAction().equals(DataAccessAction.insert)){
isSuccess = new DataAccessSessionMySQL().add(entry.getData()); //插入和更新必须等提交成功后才更新缓存
}else if (entry.getAction().equals(DataAccessAction.update)) {
isSuccess =new DataAccessSessionMySQL().modify(entry.getData());
if(isSuccess)
updateCache(DataAccessAction.update, entry.getData().getId().getValue(), entry.getData());
}
if (!isSuccess) {
errorCode = ErrorCode.dbFail;