dzx 1 سال پیش
والد
کامیت
6b87e7ef97
1فایلهای تغییر یافته به همراه15 افزوده شده و 4 حذف شده
  1. 15 4
      src/main/java/com/xjrsoft/module/form/service/impl/FormExecuteServiceImpl.java

+ 15 - 4
src/main/java/com/xjrsoft/module/form/service/impl/FormExecuteServiceImpl.java

@@ -102,6 +102,7 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Optional;
 import java.util.Set;
 import java.util.stream.Collectors;
@@ -1294,11 +1295,21 @@ public class FormExecuteServiceImpl implements IFormExecuteService {
 
                 //主表如果有审计字段  默认填充值
                 putAuditEntityUpdateData(entity, columns);
-
-                Boolean result = SqlRunnerAdapter.db().dynamicUpdate(tableName, entity, where);
-                if (!result) {
-                    throw new MyException("更新数据失败");
+                Map<String, Object> objectMap = SqlRunnerAdapter.db().dynamicSelectOne(tableName, where);
+                Boolean isUpdate = false;
+                for (String key : entity.getFieldNames()) {
+                    if(!Objects.equals(entity.get(key), objectMap.get(key))){
+                        isUpdate = true;
+                    };
                 }
+                Boolean result = null;
+                if(isUpdate){
+                    result = SqlRunnerAdapter.db().dynamicUpdate(tableName, entity, where);
+                    if (!result) {
+                        throw new MyException("更新数据失败");
+                    }
+                }
+
 
                 // 遍历数据 根据 表名 保存子表数据
                 for (Map.Entry<String, List<Entity>> tableMap : childMaps.entrySet()) {