xyc
2024-11-07 769ba15e9071b01cb53a65e8fdf4c8f37ac005b9
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("删除")