Browse Source

1.7.11-首页banner上传

JiangChongBo 2 years ago
parent
commit
3888a49594

+ 4 - 0
src/main/java/com/caimei/AdminApplication.java

@@ -1,6 +1,7 @@
 package com.caimei;
 
 import com.github.tobato.fastdfs.FdfsClientConfig;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.web.servlet.MultipartConfigFactory;
@@ -28,6 +29,9 @@ import javax.servlet.MultipartConfigElement;
 @SpringBootApplication
 public class AdminApplication {
 
+    @Value("${spring.profiles.active}")
+    private  String active;
+
     public static void main(String[] args) {
         SpringApplication.run(AdminApplication.class, args);
     }

+ 3 - 0
src/main/java/com/caimei/config/SwaggerConfig.java

@@ -49,5 +49,8 @@ public class SwaggerConfig {
                 // 版本号
                 .version("1.0.0")
                 .build();
+
+
+
     }
 }

+ 9 - 24
src/main/java/com/caimei/controller/admin/auth/AuthProductApi.java

@@ -66,9 +66,15 @@ public class AuthProductApi {
 
 
     @ApiOperation("供应商下审核通过设备sn码列表")
-    @ApiImplicitParam(name = "authId", required = true, value = "授权id")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "authId", required = true, value = "授权id"),
+            @ApiImplicitParam(name = "downStatus", required = true, value = "设备筛选下拉框状态 0全部,1与其他机构关联"),
+            @ApiImplicitParam(name = "productName", required = true, value = "设备名称"),
+            @ApiImplicitParam(name = "sncode", required = true, value = "设备sn码"),
+            @ApiImplicitParam(name = "authParty", required = true, value = "所属机构")
+    })
     @GetMapping("/sn/list")
-    public ResponseJson<List<String>> getSnCodeList(@CurrentUser SysUser sysUser, Integer authId) {
+    public ResponseJson<List<ProductListVo>> getSnCodeList(@CurrentUser SysUser sysUser, Integer authId, Integer downStatus, String productName, String sncode, String authParty) {
         if (null == sysUser) {
             return ResponseJson.error("用户信息异常", null);
         }
@@ -78,28 +84,7 @@ public class AuthProductApi {
         if (null == authUserId) {
             return ResponseJson.error("供应商用户id不能为空", null);
         }
-        return authProductService.getSnCodeList(authUserId, authId);
-    }
-
-    /**
-     * 1.7.4:
-     * 新加获取关联机构下的sn码
-     * **/
-    @ApiOperation("供应商下审核通过设备sn码列表")
-    @ApiImplicitParam(name = "authId", required = true, value = "授权id")
-    @GetMapping("/sn/listSn")
-    public ResponseJson<List<String>> getSnCodeListSn(@CurrentUser SysUser sysUser, Integer authId) {
-        if (null == sysUser) {
-            return ResponseJson.error("用户信息异常", null);
-        }
-        // 获取供应商用户id
-        Integer userIdentity = sysUser.getUserIdentity();
-        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
-        if (null == authUserId) {
-            return ResponseJson.error("供应商用户id不能为空", null);
-        }
-
-        return authProductService.getSnCodeList1(authUserId, authId);
+        return authProductService.getSnCodeList(authUserId, authId, downStatus, productName, sncode, authParty);
     }
 
     /**

+ 94 - 0
src/main/java/com/caimei/controller/admin/auth/BannerApi.java

@@ -0,0 +1,94 @@
+package com.caimei.controller.admin.auth;
+
+
+import com.caimei.annotation.CurrentUser;
+import com.caimei.model.ResponseJson;
+import com.caimei.model.po.CmBrandBannerPo;
+import com.caimei.model.po.SysUser;
+import com.caimei.model.vo.DoctorFormVo;
+import com.caimei.service.auth.BannerService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.*;
+
+
+/**
+ * 首页BannerAPIApi
+ *
+ * @author : Kaick
+ * @date : 2023/3/23
+ */
+@Api(tags = "首页BannerAPI")
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/banner")
+public class BannerApi {
+    private static final Logger logger = LoggerFactory.getLogger(BannerApi.class);
+    private final BannerService bannerService;
+
+
+    /**
+     * 首页Banner回显数据
+     */
+    @ApiOperation("首页Banner回显数据")
+    @ApiImplicitParam(name = "authUserId", required = true, value = "供应商id")
+    @GetMapping("/form/data")
+    public ResponseJson<DoctorFormVo> getBannerFormData(@CurrentUser SysUser sysUser) {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
+        if (null == authUserId) {
+            return ResponseJson.error("供应商用户id不能为空", null);
+        }
+        return bannerService.getBanner(authUserId);
+    }
+
+    /**
+     * 添加/编辑首页Banner
+     */
+    @ApiOperation("添加/编辑首页Banner")
+    @PostMapping("/save")
+    public ResponseJson saveBanner(@CurrentUser  SysUser sysUser,@RequestBody CmBrandBannerPo bannerPo)  {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
+        if (null == authUserId) {
+            return ResponseJson.error("供应商用户id不能为空", null);
+        }
+        if (null != bannerPo) {
+            if (null != bannerPo.getHeadPcBanner() && null != bannerPo.getHeadAppBanner()) {
+                if (null == bannerPo.getJumpStatus() || 2 < bannerPo.getJumpStatus()) {
+                    return ResponseJson.error("首页Banner跳转方式状态参数不正确", null);
+                } else {
+                    if (1 == bannerPo.getJumpStatus()) {
+                        if (null == bannerPo.getJumpPcPicture() && null == bannerPo.getJumpAppPicture()) {
+                            return ResponseJson.error("首页Banner跳转图片 Pc端,移动端都必须添加", null);
+                        }
+                    }
+                }
+            } else {
+                return ResponseJson.error("首页Banner Pc端,移动端都必须添加", null);
+            }
+        } else {
+            logger.info("【图片上传】>>>>>>>>>>>>>>>>图片上传失败:");
+            return ResponseJson.error("首页Banner上传失败");
+        }
+        /*
+            组装首页Banner数据
+         */
+        bannerPo.setAuthUserId(authUserId);
+        return bannerService.saveBanner(bannerPo);
+    }
+
+
+}

+ 3 - 0
src/main/java/com/caimei/controller/admin/auth/UploadApi.java

@@ -8,6 +8,7 @@ import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -16,7 +17,9 @@ import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.File;
+import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.HashMap;

+ 9 - 0
src/main/java/com/caimei/controller/admin/auth/UserApi.java

@@ -10,8 +10,14 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
+import org.apache.commons.io.IOUtils;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
 import java.util.Map;
 
 
@@ -63,4 +69,7 @@ public class UserApi {
         passwordDto.setAuthUserId(authUserId);
         return userService.updatePassword(passwordDto);
     }
+
+
+
 }

+ 1 - 2
src/main/java/com/caimei/mapper/cmMapper/AuthProductMapper.java

@@ -105,8 +105,7 @@ public interface AuthProductMapper {
 
     ProductFormVo getProductInfo(@Param("productId") Integer productId, @Param("snCode") String snCode);
 
-    List<String> getSnCodeList(Integer authUserId, Integer authId,@Param("snCodeList") List<String> snCodeList);
-    List<String> getSnCodeList1(Integer authUserId, Integer authId,String[] relationIdList,@Param("snCodeList") List<String> snCodeList);
+    List<ProductListVo> getSnCodeList(Integer authUserId, Integer authId, String[] relationIdList, @Param("snCodeList") List<String> snCodeList, String productName, String snCode, String authParty);
 
     List<Integer> getAllSn(Integer authId);
 

+ 24 - 0
src/main/java/com/caimei/mapper/cmMapper/BannerMapper.java

@@ -0,0 +1,24 @@
+package com.caimei.mapper.cmMapper;
+
+import com.caimei.model.po.CmBrandBannerPo;
+import org.apache.ibatis.annotations.Mapper;
+
+
+/**
+ * cm_brand_auth
+ *
+ * @author : Kaick
+ * @date : 2023/3/23
+ */
+@Mapper
+public interface BannerMapper {
+
+    CmBrandBannerPo geteBanner(Integer authUserId);
+
+    void addBanner(CmBrandBannerPo bannerPo);
+
+    void setBanner(CmBrandBannerPo bannerPo);
+
+    void deleteBanner(Integer authUserId);
+
+}

+ 47 - 0
src/main/java/com/caimei/model/po/CmBrandBannerPo.java

@@ -0,0 +1,47 @@
+package com.caimei.model.po;
+
+import lombok.Data;
+
+/**
+ * cm_brand_auth
+ * @author : Kaick
+ * @date : 2023/3/23
+ */
+@Data
+public class CmBrandBannerPo {
+    /**
+     * 首页banner表Id
+     */
+    private Integer id;
+    /**
+     * 供应商id
+     */
+    private Integer authUserId;
+    /**
+     * 首页pc端banner
+     */
+    private String headPcBanner;
+    /**
+     * 首页移动端banner
+     */
+    private String headAppBanner;
+    /**
+     * 首页banner跳转方式状态:0无,1图片,2链接
+     */
+    private Integer jumpStatus;
+    /**
+     * 首页pc端banner跳转图片
+     */
+    private String jumpPcPicture;
+    /**
+     * 首页移动端banner跳转图片
+     */
+    private String jumpAppPicture;
+    /**
+     * 首页banner跳转链接
+     */
+    private String jumpLink;
+
+
+    private static final long serialVersionUID = 1L;
+}

+ 9 - 0
src/main/java/com/caimei/model/vo/ProductListVo.java

@@ -104,4 +104,13 @@ public class ProductListVo {
      * 商品图片
      */
     private String image;
+    /**
+     * 所属机构
+     */
+    private String authParty;
+    /**
+     * 设备id
+     */
+    private String productTypeId;
+
 }

+ 1 - 8
src/main/java/com/caimei/service/auth/AuthProductService.java

@@ -192,15 +192,8 @@ public interface AuthProductService {
      * @param authId
      * @return
      */
-    ResponseJson<List<String>> getSnCodeList(Integer authUserId, Integer authId);
+    ResponseJson<List<ProductListVo>> getSnCodeList(Integer authUserId, Integer authId,Integer downStatus, String productName, String sncode, String authParty);
 
-    /**
-     * sn码列表1
-     * @param authUserId
-     * @param authId
-     * @return
-     */
-    ResponseJson<List<String>> getSnCodeList1(Integer authUserId, Integer authId);
 
     /**
      * 更改设备分类查看标记

+ 44 - 0
src/main/java/com/caimei/service/auth/BannerService.java

@@ -0,0 +1,44 @@
+package com.caimei.service.auth;
+
+
+import com.caimei.model.ResponseJson;
+import com.caimei.model.po.CmBrandBannerPo;
+import com.caimei.model.po.CmBrandDoctorPo;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * cm_brand_auth
+ *
+ * @author : Kaick
+ * @date : 2023/3/23
+ */
+public interface BannerService {
+    /**
+     * 添加/编辑首页Banner
+     * @param bannerPo
+     * @return
+     */
+    ResponseJson saveBanner(CmBrandBannerPo bannerPo);
+    /**
+     * 按照供应商id查看
+     * @param authUserId
+     * @return
+     */
+    ResponseJson getBanner(Integer authUserId);
+
+    /**
+     * 按照供应商id修改
+     * @param bannerPo
+     * @return
+     */
+    ResponseJson setBanner(CmBrandBannerPo bannerPo);
+    /**
+     * 按照供应商id删除
+     * @param authUserId
+     * @return
+     */
+    ResponseJson deleteBanner(Integer authUserId);
+
+}

+ 17 - 19
src/main/java/com/caimei/service/auth/impl/AuthProductServiceImpl.java

@@ -640,7 +640,7 @@ public class AuthProductServiceImpl implements AuthProductService {
             paramList = authProductMapper.getParamsByProductId(productForm.getProductId());
         }
         productForm.setParamList(paramList);
-        if(null!=productForm){
+        if(null!=productForm.getAuthDates()){
             SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd");
             String authDate = simpleDateFormat.format(productForm.getAuthDates());
             productForm.setAuthDate(authDate);
@@ -968,31 +968,29 @@ public class AuthProductServiceImpl implements AuthProductService {
     }
 
     @Override
-    public ResponseJson<List<String>> getSnCodeList(Integer authUserId, Integer authId) {
-        //获取该机构下所有的sn码
+    public ResponseJson<List<ProductListVo>> getSnCodeList(Integer authUserId, Integer authId, Integer downStatus, String productName, String sncode, String authParty) {
+        List<ProductListVo> snCodeList = new ArrayList<>();
         List<Integer> liallSn = authProductMapper.getAllSn(authId);
         List<String> allSnlist = authProductMapper.getAllSnlist(liallSn);
-        List<String> snCodeList = authProductMapper.getSnCodeList(authUserId, authId,allSnlist);
-        return ResponseJson.success(snCodeList);
-    }
-
-    @Override
-    public ResponseJson<List<String>> getSnCodeList1(Integer authUserId, Integer authId) {
-        //判断该机构是否与其他机构关联
-        String relationId = authProductMapper.getRelationId(authId);
-        String[] relationIdList=null;
-        List<String> snCodeList=new ArrayList<>();
-        if (!"".equals(relationId)&&null !=relationId){
-            relationIdList = relationId.split(",");
+        //判断机构筛选下拉框 0全部,1与其他机构关联
+        if (1 == downStatus) {
+            //判断该机构是否与其他机构关联
+            String relationId = authProductMapper.getRelationId(authId);
+            String[] relationIdList = null;
+            if (!"".equals(relationId) && null != relationId) {
+                relationIdList = relationId.split(",");
+                //获取该机构下所有的sn码
+                snCodeList = authProductMapper.getSnCodeList(authUserId, authId, relationIdList, allSnlist,  productName,  sncode,  authParty);
+            }
+        }else {
             //获取该机构下所有的sn码
-            List<Integer> liallSn = authProductMapper.getAllSn(authId);
-            List<String> allSnlist = authProductMapper.getAllSnlist(liallSn);
-            snCodeList = authProductMapper.getSnCodeList1(authUserId, authId,relationIdList,allSnlist);
+            snCodeList = authProductMapper.getSnCodeList(authUserId, authId, null, allSnlist,  productName,  sncode,  authParty);
         }
-        return ResponseJson.success(snCodeList);
 
+        return ResponseJson.success(snCodeList);
     }
 
+
     @Override
     public ResponseJson checkProductType(Integer productTypeId) {
         authProductMapper.checkProductType(productTypeId);

+ 83 - 0
src/main/java/com/caimei/service/auth/impl/BannerServiceImpl.java

@@ -0,0 +1,83 @@
+package com.caimei.service.auth.impl;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.caimei.mapper.cmMapper.AddressMapper;
+import com.caimei.mapper.cmMapper.AuthMapper;
+import com.caimei.mapper.cmMapper.BannerMapper;
+import com.caimei.model.ResponseJson;
+import com.caimei.model.po.CmBrandAuthPo;
+import com.caimei.model.po.CmBrandBannerPo;
+import com.caimei.model.po.TownPo;
+import com.caimei.model.vo.AddressSelectVo;
+import com.caimei.model.vo.RossAddressVo;
+import com.caimei.service.auth.AddressService;
+import com.caimei.service.auth.BannerService;
+import com.caimei.service.auth.UploadService;
+import com.caimei.utils.OSSUtils;
+import com.caimei.utils.RequestUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * cm_brand_auth
+ *
+ * @author : Kaick
+ * @date : 2023/3/23
+ */
+@Slf4j
+@Service
+public class BannerServiceImpl implements BannerService {
+    @Resource
+    private BannerMapper bannerMapper;
+
+    @Override
+    @Transactional
+    public ResponseJson saveBanner(CmBrandBannerPo bannerPo) {
+        CmBrandBannerPo cmBrandBannerPo = bannerMapper.geteBanner(bannerPo.getAuthUserId());
+        if (null == cmBrandBannerPo){
+            // 插入首页Banner信息
+            bannerMapper.addBanner(bannerPo);
+        }else{
+            // 更新首页Banner信息
+            bannerMapper.setBanner(bannerPo);
+        }
+        return ResponseJson.success("首页Banner上传成功");
+    }
+
+    @Override
+    public ResponseJson getBanner(Integer authUserId) {
+        if (null == authUserId) {
+            return ResponseJson.error("参数异常,供应商id不能为空", null);
+        }
+        return ResponseJson.success(bannerMapper.geteBanner(authUserId));
+    }
+
+    @Override
+    public ResponseJson setBanner(CmBrandBannerPo bannerPo) {
+        bannerMapper.setBanner(bannerPo);
+        return ResponseJson.success(ResponseJson.success("修改首页Banner成功"));
+    }
+
+    @Override
+    public ResponseJson deleteBanner(Integer authUserId) {
+        if (null == authUserId) {
+            return ResponseJson.error("参数异常,请输入供应商id",null);
+        }
+        bannerMapper.deleteBanner(authUserId);
+        return ResponseJson.success("删除首页Banner成功");
+    }
+}

+ 0 - 2
src/main/resources/application.yml

@@ -22,5 +22,3 @@ aliyunConfig:
 
 
 
-
-

+ 2 - 2
src/main/resources/config/beta/application-beta.yml

@@ -4,9 +4,9 @@ spring:
     cmdatasource:
       driver-class-name: com.mysql.cj.jdbc.Driver
 #      内网地址
-      jdbc-url: jdbc:mysql://172.31.165.28:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
+#      jdbc-url: jdbc:mysql://172.31.165.28:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
 #      公网地址
-#      jdbc-url: jdbc:mysql://120.79.25.27:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
+      jdbc-url: jdbc:mysql://120.79.25.27:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
       username: developer
       password: J5p3tgOVazNl4ydf
       type: com.zaxxer.hikari.HikariDataSource

+ 2 - 1
src/main/resources/config/dev/application-dev.yml

@@ -103,4 +103,5 @@ rocketmq:
   name-server: 47.107.48.218:9876 # 測試
   producer:
     group: caimei_dev_group        # 生产者分组
-    send-message-timeout: 3000     # 发送消息超时时间,单位:毫秒。默认为 3000 。
+    send-message-timeout: 3000     # 发送消息超时时间,单位:毫秒。默认为 3000 。
+

+ 15 - 16
src/main/resources/mapper/AuthProductMapper.xml

@@ -497,27 +497,26 @@
             </if>
         </where>
     </select>
-    <select id="getSnCodeList" resultType="java.lang.String">
-        select DISTINCT snCode
-        from cm_brand_auth_product p
-        left join cm_brand_product_relation r on p.id = r.productId
-        left join cm_brand_auth a on a.id = r.authId
-        where a.authUserId = #{authUserId} and a.delFlag = 0 and (r.authType = 2 or (r.authType = 1 and a.id != #{authId}) ) and p.auditStatus = 1
-        <if test="snCodeList != null and snCodeList.size>0">
-            and p.snCode not in
-            <foreach collection="snCodeList" open="(" separator="," close=")" item="sn">
-                #{sn,jdbcType=VARCHAR}
-            </foreach>
-        </if>
-    </select>
 
-    <select id="getSnCodeList1" resultType="java.lang.String">
-        select DISTINCT snCode,p.id,p.name
+    <select id="getSnCodeList" resultType="com.caimei.model.vo.ProductListVo">
+        select DISTINCT p.id as productId,p.productTypeId as productTypeId,t.name as productName,snCode,a.authParty as
+        authParty
         from cm_brand_auth_product p
         left join cm_brand_product_relation r on p.id = r.productId
         left join cm_brand_auth a on a.id = r.authId
+        left join cm_brand_product_type t on t.id = p.productTypeId
         where
-        a.authUserId = #{authUserId} and a.delFlag = 0 and (r.authType = 2 or (r.authType = 1 and a.id != #{authId}) ) and p.auditStatus = 1
+        a.authUserId = #{authUserId} and a.delFlag = 0 and (r.authType = 2 or (r.authType = 1 and a.id != #{authId}) )
+        and p.auditStatus = 1
+        <if test="productName != null and productName != ''">
+            and t.name like concat('%',#{productName},'%')
+        </if>
+        <if test="snCode != null and snCode != ''">
+            and p.snCode like concat('%',#{snCode},'%')
+        </if>
+        <if test="authParty != null and authParty != ''">
+            and a.authParty like concat('%',#{authParty},'%')
+        </if>
         <if test="snCodeList != null and snCodeList.size>0">
             and p.snCode not in
             <foreach collection="snCodeList" open="(" separator="," close=")" item="sn">

+ 23 - 0
src/main/resources/mapper/BannerMapper.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.caimei.mapper.cmMapper.BannerMapper">
+    <insert id="addBanner">
+        INSERT INTO cm_brand_banner(`authUserId`, `headPcBanner`, `headAppBanner`, `jumpStatus`, `jumpPcPicture`, `jumpAppPicture`, `jumpLink`)
+        VALUES ( #{authUserId},#{headPcBanner},#{headAppBanner},#{jumpStatus},#{jumpPcPicture},#{jumpAppPicture},#{jumpLink});
+    </insert>
+    <update id="setBanner">
+    UPDATE `cm_brand_banner` SET  `headPcBanner` = #{headPcBanner}, `headAppBanner` = #{headAppBanner},
+    `jumpStatus` = #{jumpStatus},
+    `jumpPcPicture` = #{jumpPcPicture}, `jumpAppPicture` = #{jumpAppPicture},
+    `jumpLink` = #{jumpLink}
+    WHERE `authUserId` = #{authUserId};
+    </update>
+    <delete id="deleteBanner">
+        delete from cm_brand_banner where authUserId = #{authUserId}
+    </delete>
+    <select id="geteBanner" resultType="com.caimei.model.po.CmBrandBannerPo">
+        SELECT id,`authUserId`, `headPcBanner`, `headAppBanner`, `jumpStatus`, `jumpPcPicture`, `jumpAppPicture`, `jumpLink`
+        FROM cm_brand_banner
+        where authUserId=#{authUserId} LIMIT 0,1
+    </select>
+</mapper>

+ 37 - 2
src/test/java/com/caimei/AdminApplicationTests.java

@@ -1,13 +1,21 @@
 package com.caimei;
 
 import com.alibaba.fastjson.JSONObject;
+import com.aliyun.oss.OSS;
+import com.aliyun.oss.OSSClientBuilder;
+import com.aliyun.oss.model.ListObjectsRequest;
+import com.aliyun.oss.model.OSSObjectSummary;
+import com.aliyun.oss.model.ObjectListing;
 import com.caimei.mapper.cmMapper.AuthMapper;
 import com.caimei.model.po.CmBrandAuthPo;
 import com.caimei.model.vo.RossAddressVo;
 import com.caimei.utils.ImageUtils;
 import com.caimei.utils.OSSUtils;
 import org.junit.Test;
+import org.springframework.beans.factory.annotation.Configurable;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Configuration;
 import org.springframework.core.io.ClassPathResource;
 
 import javax.annotation.Resource;
@@ -15,19 +23,46 @@ import javax.imageio.ImageIO;
 import java.awt.*;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.Date;
+import java.util.List;
 
 @SpringBootTest
 public class AdminApplicationTests {
     @Resource
     private AuthMapper authMapper;
 
+
+
+
+    @Test
+    public void ossDelTest() {
+        OSS ossClient = new OSSClientBuilder().build("https://oss-cn-shenzhen.aliyuncs.com", "LTAI4GBL3o4YkWnbKYgf2Xia", "dBjAXqbYiEPP6Ukuk2ZsXQeET7FVkK");
+
+        // 列举文件。如果不设置keyPrefix,则列举存储空间下的所有文件。如果设置keyPrefix,则列举包含指定前缀的文件。
+        ObjectListing objectListing = ossClient.listObjects("caimei-oss");
+        List<OSSObjectSummary> sums = objectListing.getObjectSummaries();
+        for (OSSObjectSummary s : sums) {
+            System.out.println("\t" + s.getKey());
+        }
+//        ossClient.deleteObject("caimei-oss", "beta" + "/authFile/" + "a63c46a50d4c43ebaea5adec6cbdc61b.jpg");
+
+
+
+        // 设置URL过期时间为1个小时
+        Date expiration = new Date(System.currentTimeMillis() + 3600L * 1000);
+        String url = ossClient.generatePresignedUrl("caimei-oss", "beta" + "/authFile/" + "6f0f7adcf6d1491cb4167a3205f6545e.jpg", expiration).toString();
+        // 关闭OSSClient。
+        ossClient.shutdown();
+        System.out.println(url);
+    }
+
     @Test
-    public void JWTToken(){
+    public void JWTToken() {
         OSSUtils.deleteSingleFile("5dbb6eb668174438ae5f9b5a1d99f7cf.ppt");
     }
 
     @Test
-    public void  drawImage() throws IOException {
+    public void drawImage() throws IOException {
         ClassPathResource classPathResource = new ClassPathResource("/images/pcWaterMark.png");
         InputStream inputStreamImg = classPathResource.getInputStream();
         Image pcWaterMarkImg = ImageIO.read(inputStreamImg);