From b04b1f186c4250e6894823f990189950508d877d Mon Sep 17 00:00:00 2001
From: jinlin <jinlin>
Date: 星期二, 19 三月 2024 14:47:33 +0800
Subject: [PATCH] 修改

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

diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/sysPictureBase/controller/SysPictureBaseController.java b/modules/mainPart/src/main/java/com/zt/life/modules/sysPictureBase/controller/SysPictureBaseController.java
index 11cc5a0..6b70d7d 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/sysPictureBase/controller/SysPictureBaseController.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/sysPictureBase/controller/SysPictureBaseController.java
@@ -37,6 +37,7 @@
 import javax.servlet.http.HttpServletResponse;
 import java.awt.image.BufferedImage;
 import java.io.*;
+import java.util.List;
 
 
 /**
@@ -60,14 +61,12 @@
     @GetMapping("page")
     @ApiOperation("鍒嗛〉")
     @ApiImplicitParams({
-            @ApiImplicitParam(name = Constant.Q.PAGE, value = Constant.QV.PAGE, required = true, dataType = Constant.QT.INT),
-            @ApiImplicitParam(name = Constant.Q.LIMIT, value = Constant.QV.LIMIT, required = true, dataType = Constant.QT.INT),
             @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 = "contentType", value = "妫�绱㈠叧閿瓧", dataType = Constant.QT.STRING, format = "CONTENT_TYPE^LK"), @ApiImplicitParam(name = "systemMark", value = "绯荤粺鏍囪瘑", dataType = Constant.QT.STRING, format = "SYSTEM_MARK^LK")})
-    public PageResult<SysPictureBase> page(@ApiIgnore @QueryParam QueryFilter queryFilter) {
+            @ApiImplicitParam(name = "productType", value = "妫�绱㈠叧閿瓧", dataType = Constant.QT.STRING, format = "CONTENT_TYPE^LK"), @ApiImplicitParam(name = "systemMark", value = "绯荤粺鏍囪瘑", dataType = Constant.QT.STRING, format = "SYSTEM_MARK^LK")})
+    public Result<List<SysPictureBase>> page(@ApiIgnore @QueryParam QueryFilter queryFilter) {
 
-        return PageResult.ok(sysPictureBaseService.page(queryFilter));
+        return Result.ok(sysPictureBaseService.page(queryFilter));
     }
 
     @GetMapping("{id}")
@@ -80,30 +79,29 @@
     @PostMapping("save")
     @ApiOperation("淇濆瓨")
     @LogOperation("淇濆瓨")
-    public Result save(@RequestBody MultipartFile file, Long id, String type, String subType,
-                       String name, String contentType, String systemMark, Integer sortNo, String remark) {
+    public Result save(@RequestBody MultipartFile file, Long id, Integer isDefault,
+                       String name, String contentType, Integer productType,  String remark) {
         SysPictureBase sysPictureBase;
-        if (id != null) {
+        if (id != 0) {
             sysPictureBase = sysPictureBaseService.get(id);
-            sysPictureBase.setType(type);
-            sysPictureBase.setSubType(subType);
+            sysPictureBase.setIsDefault(isDefault);
             sysPictureBase.setName(name);
             sysPictureBase.setContentType(contentType);
-            sysPictureBase.setSystemMark(systemMark);
-            sysPictureBase.setSortNo(sortNo);
+            sysPictureBase.setProductType(productType);
             sysPictureBase.setRemark(remark);
             sysPictureBaseService.update(sysPictureBase);
         } else {
             sysPictureBase = new SysPictureBase();
-            sysPictureBase.setType(type);
-            sysPictureBase.setSubType(subType);
+            sysPictureBase.setIsDefault(isDefault);
             sysPictureBase.setName(name);
             sysPictureBase.setContentType(contentType);
-            sysPictureBase.setSystemMark(systemMark);
-            Integer no = sysPictureBaseService.getNo();
-            sysPictureBase.setSortNo(no + 1);
+            sysPictureBase.setProductType(productType);
             sysPictureBase.setRemark(remark);
             sysPictureBaseService.insert(sysPictureBase);
+        }
+        if (sysPictureBase.getIsDefault()==1){
+            sysPictureBaseService.updateByDefault(sysPictureBase.getId(),sysPictureBase.getProductType());
+            sysPictureBaseService.updateProdeuctImg(sysPictureBase.getId(),sysPictureBase.getProductType());
         }
         if (file != null) {
             BufferedImage bufferedImage = null;
@@ -147,7 +145,8 @@
             byte[] buff = new byte[1024];
             //鎵�璇诲彇鐨勫唴瀹逛娇鐢╪鏉ユ帴鏀�
             int n;
-            //褰撴病鏈夎鍙栧畬鏃�,缁х画璇诲彇,寰幆
+            //褰撴病鏈夎
+            //鍙栧畬鏃�,缁х画璇诲彇,寰幆
             while ((n = in.read(buff)) != -1) {
                 //灏嗗瓧鑺傛暟缁勭殑鏁版嵁鍏ㄩ儴鍐欏叆鍒拌緭鍑烘祦涓�
                 outputStream.write(buff, 0, n);

--
Gitblit v1.9.1