From 65a79e6ec47a067136f5e9297ca339e8c20747f1 Mon Sep 17 00:00:00 2001
From: wente <329538422@qq.com>
Date: 星期五, 17 五月 2024 10:19:10 +0800
Subject: [PATCH] svgEditor

---
 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/sysPictureBase/controller/SysPictureBaseController.java |   45 ++++++++++++++++++++++-----------------------
 1 files changed, 22 insertions(+), 23 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 d240b5e..8147d2a 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
@@ -67,39 +67,24 @@
     @PostMapping("save")
     @ApiOperation("淇濆瓨")
     @LogOperation("淇濆瓨")
-    public Result save(@RequestBody MultipartFile file, Long id, Integer isDefault,
-                       String name, String contentType, Integer productType,  String remark) {
-        SysPictureBase sysPictureBase;
-        SysPictureBase pictureBase = sysPictureBaseService.getDefaultImg(productType);
-        if (id != 0) {
-            sysPictureBase = sysPictureBaseService.get(id);
-            sysPictureBase.setIsDefault(isDefault);
-            sysPictureBase.setName(name);
-            sysPictureBase.setContentType(contentType);
-            sysPictureBase.setProductType(productType);
-            sysPictureBase.setRemark(remark);
+    public Result save(@RequestBody SysPictureBase sysPictureBase) {
+        if (sysPictureBase.getId() != null) {
             sysPictureBaseService.update(sysPictureBase);
         } else {
-            sysPictureBase = new SysPictureBase();
-            sysPictureBase.setIsDefault(isDefault);
-            sysPictureBase.setName(name);
-            sysPictureBase.setContentType(contentType);
-            sysPictureBase.setProductType(productType);
-            sysPictureBase.setRemark(remark);
             sysPictureBaseService.insert(sysPictureBase);
         }
         if (sysPictureBase.getIsDefault()==1){
-            if (pictureBase.getId()==null){
+            if (sysPictureBase.getId()==null){
                 sysPictureBaseService.updateByDefault(sysPictureBase.getId(),sysPictureBase.getProductType());
                 sysPictureBaseService.updateProdeuctImg(sysPictureBase.getId(),sysPictureBase.getProductType(),null);
             }else{
-                if (!sysPictureBase.getId().equals(pictureBase.getId())){
+                if (!sysPictureBase.getId().equals(sysPictureBase.getId())){
                     sysPictureBaseService.updateByDefault(sysPictureBase.getId(),sysPictureBase.getProductType());
-                    sysPictureBaseService.updateProdeuctImg(sysPictureBase.getId(),sysPictureBase.getProductType(),pictureBase.getId());
+                    sysPictureBaseService.updateProdeuctImg(sysPictureBase.getId(),sysPictureBase.getProductType(),sysPictureBase.getId());
                 }
             }
         }
-        if (file != null) {
+/*        if (file != null) {
             BufferedImage bufferedImage = null;
             try {
                 String fileName = file.getOriginalFilename();
@@ -123,8 +108,7 @@
             } catch (IOException e) {
                 e.printStackTrace();
             }
-
-        }
+        }*/
         return Result.ok();
     }
 
@@ -157,6 +141,21 @@
         }
     }
 
+    @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();
+        }
+    }
+
     @GetMapping("/getDefaultImg")
     public Result<SysPictureBase> getDefaultImg(Integer productType) {
         SysPictureBase data = sysPictureBaseService.getDefaultImg(productType);

--
Gitblit v1.9.1