liaoyitao 6 місяців тому
батько
коміт
95cb626a5f

+ 7 - 1
src/main/java/com/lqkj/link/module/zone/service/ZoneInfoService.java

@@ -83,9 +83,15 @@ public class ZoneInfoService {
83 83
             zoneInfo.setViewCount(0);
84 84
             zoneInfo.setTemplateUse(0);
85 85
         }
86
+        Boolean isUpdated = true;
87
+        if (Objects.nonNull(zoneInfo.getZoneId())){
88
+            ZoneInfo oldZoneInfo = zoneInfoRepository.findById(zoneInfo.getZoneId()).get();
89
+            isUpdated = !oldZoneInfo.getTemplateFilePath().equals(zoneInfo.getTemplateFilePath());
90
+
91
+        }
86 92
         ZoneInfo zoneInfo1 = zoneInfoRepository.save(zoneInfo);
87 93
 
88
-        if (StringUtils.isNotBlank(zoneInfo.getTemplateFilePath())) {
94
+        if (StringUtils.isNotBlank(zoneInfo.getTemplateFilePath()) && isUpdated) {
89 95
             // 清除元素与模型
90 96
             geomInfoRepository.deleteAllByZoneId(zoneInfo1.getZoneId());
91 97
             modelInfoRepository.deleteAllByTemplateIds(Collections.singletonList(zoneInfo1.getZoneId()));