From 0aba396924cb1e92890329661af058c3094b4b8c Mon Sep 17 00:00:00 2001 From: HuangHuiKang Date: Wed, 29 Jul 2026 10:21:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8Dlogo=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E5=8F=AF=E4=B8=BA=E7=A9=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/branding/BrandingServiceImpl.java | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/branding/BrandingServiceImpl.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/branding/BrandingServiceImpl.java index 0f1c6fc08..f6d6aab15 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/branding/BrandingServiceImpl.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/branding/BrandingServiceImpl.java @@ -2,10 +2,9 @@ package cn.iocoder.yudao.module.infra.service.branding; import cn.iocoder.yudao.module.infra.controller.admin.branding.vo.BrandingLogoRespVO; import cn.iocoder.yudao.module.infra.controller.admin.branding.vo.BrandingLogoSaveReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigSaveReqVO; import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO; -import cn.iocoder.yudao.module.infra.service.config.ConfigService; -import org.apache.commons.lang3.StringUtils; +import cn.iocoder.yudao.module.infra.dal.mysql.config.ConfigMapper; +import cn.iocoder.yudao.module.infra.enums.config.ConfigTypeEnum; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; @@ -21,7 +20,7 @@ public class BrandingServiceImpl implements BrandingService { private static final String APP_LOGIN_LOGO_KEY = "ui.logo.app.login"; @Resource - private ConfigService configService; + private ConfigMapper configMapper; @Override public BrandingLogoRespVO getLogo() { @@ -34,35 +33,36 @@ public class BrandingServiceImpl implements BrandingService { @Override public void saveLogo(BrandingLogoSaveReqVO saveReqVO) { - saveConfigIfPresent(WEB_LOGIN_LOGO_KEY, "Web 登录页 Logo", saveReqVO.getWebLoginLogo()); - saveConfigIfPresent(WEB_HEADER_LOGO_KEY, "Web 顶部 Logo", saveReqVO.getWebHeaderLogo()); - saveConfigIfPresent(APP_LOGIN_LOGO_KEY, "App 登录页 Logo", saveReqVO.getAppLoginLogo()); + saveConfigIfNotNull(WEB_LOGIN_LOGO_KEY, "Web 登录页 Logo", saveReqVO.getWebLoginLogo()); + saveConfigIfNotNull(WEB_HEADER_LOGO_KEY, "Web 顶部 Logo", saveReqVO.getWebHeaderLogo()); + saveConfigIfNotNull(APP_LOGIN_LOGO_KEY, "App 登录页 Logo", saveReqVO.getAppLoginLogo()); } private String getConfigValue(String key) { - ConfigDO config = configService.getConfigByKey(key); + ConfigDO config = configMapper.selectByKey(key); return config == null || !Boolean.TRUE.equals(config.getVisible()) ? null : config.getValue(); } - private void saveConfigIfPresent(String key, String name, String value) { - if (StringUtils.isBlank(value)) { + private void saveConfigIfNotNull(String key, String name, String value) { + if (value == null) { return; } - ConfigDO config = configService.getConfigByKey(key); - ConfigSaveReqVO saveReqVO = new ConfigSaveReqVO(); + ConfigDO config = configMapper.selectByKey(key); + ConfigDO saveObj = new ConfigDO(); if (config != null) { - saveReqVO.setId(config.getId()); + saveObj.setId(config.getId()); } - saveReqVO.setCategory(CATEGORY); - saveReqVO.setName(name); - saveReqVO.setKey(key); - saveReqVO.setValue(value); - saveReqVO.setVisible(true); - saveReqVO.setRemark("品牌 Logo 配置"); + saveObj.setCategory(CATEGORY); + saveObj.setName(name); + saveObj.setConfigKey(key); + saveObj.setValue(value); + saveObj.setType(ConfigTypeEnum.CUSTOM.getType()); + saveObj.setVisible(true); + saveObj.setRemark("品牌 Logo 配置"); if (config == null) { - configService.createConfig(saveReqVO); + configMapper.insert(saveObj); } else { - configService.updateConfig(saveReqVO); + configMapper.updateById(saveObj); } }