From 134c06beb2b6b7f7025fb030a9e52bcceebbfc98 Mon Sep 17 00:00:00 2001 From: jinlin <jinlin> Date: 星期一, 15 七月 2024 14:36:49 +0800 Subject: [PATCH] 修改 --- modules/mainPart/src/main/java/com/zt/life/modules/mainPart/sysPictureBase/controller/SysPictureBaseController.java | 43 ++++++------------------------------------- 1 files changed, 6 insertions(+), 37 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 8147d2a..34a8351 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,42 +73,10 @@ } 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); } -/* if (file != null) { - BufferedImage bufferedImage = null; - try { - String fileName = file.getOriginalFilename(); - String[] arr = fileName.split("\\."); - String suffixName = arr[arr.length - 1].toLowerCase(); - - bufferedImage = ImageIO.read(file.getInputStream()); - // 瀹藉害 - int width = bufferedImage.getWidth(); - sysPictureBase.setWidth(width); - // 楂樺害 - int height = bufferedImage.getHeight(); - sysPictureBase.setHeight(height); - sysPictureBaseService.update(sysPictureBase); - String tempUploadDir = localPath + "/product_img/"; - File dir = new File(tempUploadDir); - if (!dir.exists()) { - dir.mkdirs(); - } - ImageIO.write(bufferedImage, suffixName, new File(tempUploadDir + sysPictureBase.getId().toString())); - } catch (IOException e) { - e.printStackTrace(); - } - }*/ return Result.ok(); } @@ -136,7 +104,7 @@ //鍏虫祦 outputStream.close(); in.close(); - } catch (IOException e) { + } catch (IOException e) { e.printStackTrace(); } } @@ -151,7 +119,7 @@ response.getWriter().flush(); response.getWriter().close(); - } catch (IOException e) { + } catch (IOException e) { e.printStackTrace(); } } @@ -161,6 +129,7 @@ SysPictureBase data = sysPictureBaseService.getDefaultImg(productType); return Result.ok(data); } + @DeleteMapping @ApiOperation("鍒犻櫎") @LogOperation("鍒犻櫎") -- Gitblit v1.9.1