From 1730a7fc4bb96f258d9dc8dec2e629cadbfdefc0 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期三, 18 六月 2025 13:47:42 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/2.0' into 2.0

---
 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/config/AdvertServiceImpl.java |   46 +++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 45 insertions(+), 1 deletions(-)

diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/config/AdvertServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/config/AdvertServiceImpl.java
index a4b8ae0..1424e49 100644
--- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/config/AdvertServiceImpl.java
+++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/config/AdvertServiceImpl.java
@@ -1,14 +1,16 @@
 package com.ruoyi.system.service.impl.config;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.system.domain.dto.MgtAdvertEditDto;
 import com.ruoyi.system.domain.pojo.config.Advert;
 import com.ruoyi.system.domain.vo.AppAdvertVo;
 import com.ruoyi.system.mapper.config.AdvertMapper;
 import com.ruoyi.system.service.config.AdvertService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.Date;
 
 /**
  * <p>
@@ -45,4 +47,46 @@
         Advert advert = this.getOne(new LambdaQueryWrapper<Advert>().eq(Advert::getDelFlag,0),false);
         return advert;
     }
+
+    /**
+     * @description  修改广告配置
+     * @author  jqs
+     * @date    \ 17:23
+     * @param mgtAdvertEditDto
+     * @return  void
+     */
+    @Override
+    public void editMgtAdvert(MgtAdvertEditDto mgtAdvertEditDto){
+        //删除旧广告配置
+        Advert advert = this.getOne(new LambdaQueryWrapper<Advert>()
+                .eq(Advert::getDelFlag, 0)
+                .orderByDesc(Advert::getAdId)
+                .last("LIMIT 1"), false);
+        if (advert != null) {
+            advert.setDelFlag(1);
+            this.updateById(advert);
+        }
+        //创建新广告配置
+        advert = new Advert();
+        advert.setDelFlag(0);
+        advert.setAdUrl(mgtAdvertEditDto.getAdUrl());
+        advert.setAdContent(mgtAdvertEditDto.getHomeSlogan());
+        advert.setTargetType(mgtAdvertEditDto.getTargetType());
+        advert.setLinkType(mgtAdvertEditDto.getLinkType());
+        advert.setLinkUrl(mgtAdvertEditDto.getLinkUrl());
+        advert.setJumpType(mgtAdvertEditDto.getJumpType());
+        advert.setJumpId(mgtAdvertEditDto.getJumpId());
+        advert.setLogoUrl(mgtAdvertEditDto.getHomeLogo());
+        advert.setCreateTime(new Date());
+        advert.setCreateUserId(mgtAdvertEditDto.getUserId());
+        advert.setAppid(mgtAdvertEditDto.getAppid());
+        //广告语配置
+        advert.setTargetTypeSlogan(mgtAdvertEditDto.getTargetTypeSlogan());
+        advert.setLinkTypeSlogan(mgtAdvertEditDto.getLinkTypeSlogan());
+        advert.setLinkUrlSlogan(mgtAdvertEditDto.getLinkUrlSlogan());
+        advert.setJumpTypeSlogan(mgtAdvertEditDto.getJumpTypeSlogan());
+        advert.setJumpIdSlogan(mgtAdvertEditDto.getJumpIdSlogan());
+        advert.setAppidSlogan(mgtAdvertEditDto.getAppidSlogan());
+        this.save(advert);
+    }
 }

--
Gitblit v1.7.1