From 652ec7d6dfdee121704961847fae3a3a5be3f5b6 Mon Sep 17 00:00:00 2001
From: jinlin <jinlin>
Date: 星期一, 01 四月 2024 15:26:15 +0800
Subject: [PATCH] 修改

---
 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/sysPictureBase/controller/SysPictureBaseController.java |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 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 36df92b..2288545 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
@@ -50,7 +50,8 @@
     @ApiImplicitParams({
             @ApiImplicitParam(name = Constant.Q.ORDER_FIELD, value = Constant.QV.ORDER_FIELD, dataType = Constant.QT.STRING),
             @ApiImplicitParam(name = Constant.Q.ORDER, value = Constant.QV.ORDER, dataType = Constant.QT.STRING),
-            @ApiImplicitParam(name = "productType", value = "妫�绱㈠叧閿瓧", dataType = Constant.QT.STRING, format = "CONTENT_TYPE^LK"), @ApiImplicitParam(name = "systemMark", value = "绯荤粺鏍囪瘑", dataType = Constant.QT.STRING, format = "SYSTEM_MARK^LK")})
+            @ApiImplicitParam(name = "productType", value = "妫�绱㈠叧閿瓧", dataType = Constant.QT.STRING, format = "PRODUCT_TYPE^EQ"),
+            @ApiImplicitParam(name = "systemMark", value = "绯荤粺鏍囪瘑", dataType = Constant.QT.STRING, format = "SYSTEM_MARK^LK")})
     public Result<List<SysPictureBase>> page(@ApiIgnore @QueryParam QueryFilter queryFilter) {
 
         return Result.ok(sysPictureBaseService.page(queryFilter));
@@ -69,6 +70,7 @@
     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);
@@ -87,8 +89,10 @@
             sysPictureBaseService.insert(sysPictureBase);
         }
         if (sysPictureBase.getIsDefault()==1){
-            sysPictureBaseService.updateByDefault(sysPictureBase.getId(),sysPictureBase.getProductType());
-            sysPictureBaseService.updateProdeuctImg(sysPictureBase.getId(),sysPictureBase.getProductType());
+            if (!sysPictureBase.getId().equals(pictureBase.getId())){
+                sysPictureBaseService.updateByDefault(sysPictureBase.getId(),sysPictureBase.getProductType());
+                sysPictureBaseService.updateProdeuctImg(sysPictureBase.getId(),sysPictureBase.getProductType(),pictureBase.getId());
+            }
         }
         if (file != null) {
             BufferedImage bufferedImage = null;
@@ -148,6 +152,11 @@
         }
     }
 
+    @GetMapping("/getDefaultImg")
+    public Result<SysPictureBase> getDefaultImg(Integer productType) {
+        SysPictureBase data = sysPictureBaseService.getDefaultImg(productType);
+        return Result.ok(data);
+    }
     @DeleteMapping
     @ApiOperation("鍒犻櫎")
     @LogOperation("鍒犻櫎")

--
Gitblit v1.9.1