From 2d6c0d1cffe663b3b37ef7e0575cfe6e11d8fd85 Mon Sep 17 00:00:00 2001
From: xyc <jc_xiong@hotmail.com>
Date: 星期一, 18 十一月 2024 09:13:56 +0800
Subject: [PATCH] 修复bug:点击一键排版会自动保存

---
 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/sysPictureBase/controller/SysPictureBaseController.java |   28 ++++++----------------------
 1 files changed, 6 insertions(+), 22 deletions(-)

diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/sysPictureBase/controller/SysPictureBaseController.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/sysPictureBase/controller/SysPictureBaseController.java
index 6bc2ac5..29e7de6 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/sysPictureBase/controller/SysPictureBaseController.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/sysPictureBase/controller/SysPictureBaseController.java
@@ -73,16 +73,9 @@
         } else {
             sysPictureBaseService.insert(sysPictureBase);
         }
-        if (sysPictureBase.getIsDefault()==1){
-            if (sysPictureBase.getId()==null){
-                sysPictureBaseService.updateByDefault(sysPictureBase.getId(),sysPictureBase.getProductType());
-                sysPictureBaseService.updateProdeuctImg(sysPictureBase.getId(),sysPictureBase.getProductType(),null);
-            }else{
-                if (!sysPictureBase.getId().equals(sysPictureBase.getId())){
-                    sysPictureBaseService.updateByDefault(sysPictureBase.getId(),sysPictureBase.getProductType());
-                    sysPictureBaseService.updateProdeuctImg(sysPictureBase.getId(),sysPictureBase.getProductType(),sysPictureBase.getId());
-                }
-            }
+        if (sysPictureBase.getIsDefault() == 1 && sysPictureBase.getProductType()!=20) {
+            sysPictureBaseService.updateByDefault(sysPictureBase.getId(), sysPictureBase.getProductType());
+            sysPictureBaseService.updateProdeuctImg(sysPictureBase.getId(), sysPictureBase.getProductType(), null);
         }
         return Result.ok();
     }
@@ -111,24 +104,14 @@
             //鍏虫祦
             outputStream.close();
             in.close();
-        }  catch (IOException e) {
+        } catch (IOException e) {
             e.printStackTrace();
         }
     }
 
     @RequestMapping("/getSvgImage")
     public void getSvgImage(HttpServletResponse response, Long id) {
-        try {
-            SysPictureBase data = sysPictureBaseService.get(id);
-            String svgContent = data.getSvgContent();
-            response.setContentType("image/svg+xml");
-            response.getWriter().write(svgContent);
-            response.getWriter().flush();
-            response.getWriter().close();
-
-        }  catch (IOException e) {
-            e.printStackTrace();
-        }
+        sysPictureBaseService.getSvgImage(response,id);
     }
 
     @GetMapping("/getDefaultImg")
@@ -136,6 +119,7 @@
         SysPictureBase data = sysPictureBaseService.getDefaultImg(productType);
         return Result.ok(data);
     }
+
     @DeleteMapping
     @ApiOperation("鍒犻櫎")
     @LogOperation("鍒犻櫎")

--
Gitblit v1.9.1