From 53ac73294f980b85481a3a27699b5eb9958a09e3 Mon Sep 17 00:00:00 2001 From: wuKong Date: Mon, 29 Dec 2025 16:42:21 +0800 Subject: [PATCH 1/8] =?UTF-8?q?feat(promotion):=20=E6=B7=BB=E5=8A=A0DIY?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E7=B1=BB=E5=9E=8B=E5=8A=9F=E8=83=BD=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在DiyTemplateBaseVO中新增模板类型字段并添加非空验证 - 在DiyTemplatePageReqVO中新增模板类型查询参数 - 修改AppDiyTemplateController的getUsedDiyTemplate接口支持类型参数 - 在DiyTemplateDO实体中新增type字段存储模板类型 - 更新DiyTemplateMapper的数据查询逻辑支持按类型筛选 - 实现模板类型相关的数据库查询方法,包括默认类型和指定类型的模板查询 - 修改getUsedDiyTemplate服务方法支持类型参数传入 - 优化模板使用逻辑,支持按类型切换模板功能 --- .../enums/diy/DiyTemplateTypeEnum.java | 54 +++++++++++++++++++ .../diy/vo/template/DiyTemplateBaseVO.java | 4 ++ .../diy/vo/template/DiyTemplatePageReqVO.java | 3 ++ .../app/diy/AppDiyTemplateController.java | 5 +- .../dal/dataobject/diy/DiyTemplateDO.java | 5 ++ .../dal/mysql/diy/DiyTemplateMapper.java | 23 ++++++++ .../service/diy/DiyTemplateService.java | 2 +- .../service/diy/DiyTemplateServiceImpl.java | 10 ++-- 8 files changed, 98 insertions(+), 8 deletions(-) create mode 100644 yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/diy/DiyTemplateTypeEnum.java diff --git a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/diy/DiyTemplateTypeEnum.java b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/diy/DiyTemplateTypeEnum.java new file mode 100644 index 000000000..d6ff0dc3e --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/diy/DiyTemplateTypeEnum.java @@ -0,0 +1,54 @@ +package cn.iocoder.yudao.module.promotion.enums.diy; + +import cn.iocoder.yudao.framework.common.core.ArrayValuable; +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Arrays; + +/** + * 模板类型枚举 + * uniPlatform + * @author wuKong + */ +@AllArgsConstructor +@Getter +public enum DiyTemplateTypeEnum implements ArrayValuable { + DEFAULT("default","默认"), + APP("app", "App"), + WEB("web", "Web"), + MP_WEIXIN("mp-weixin", "微信小程序"), + MP_ALIPAY("mp-alipay", "支付宝小程序"), + MP_BAIDU("mp-baidu", "百度小程序"), + MP_TOUTIAO("mp-toutiao", "抖音小程序"), + MP_LARK("mp-lark", "飞书小程序"), + MP_QQ("mp-qq", "QQ小程序"), + MP_KUAISHOU("mp-kuaishou", "快手小程序"), + MP_JD("mp-jd", "京东小程序"), + MP_360("mp-360", "360小程序"), + MP_HARMONY("mp-harmony", "鸿蒙元服务"), + QUICKAPP_WEBVIEW("quickapp-webview", "快应用通用(包含联盟、华为)"), + QUICKAPP_WEBVIEW_UNION("quickapp-webview-union", "快应用联盟"), + QUICKAPP_WEBVIEW_HUAWEI("quickapp-webview-huawei", "快应用华为"), + //OTHER_VUSINESS_SCEN("other-business-scen", "其他自定义业务场景"), + ; + + private static final String[] ARRAYS = + Arrays.stream(values()).map(DiyTemplateTypeEnum::getType).toArray(String[]::new); + /** + * type String比较灵活 + * 可以是uniPlatform传值 + * 也增加是自定义的业务场景 + */ + private final String type; + + /** + * name + */ + private final String name; + + @Override + public String[] array() { + return ARRAYS; + } +} diff --git a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplateBaseVO.java b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplateBaseVO.java index 63d1d08ae..3f43f6c7a 100644 --- a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplateBaseVO.java +++ b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplateBaseVO.java @@ -23,4 +23,8 @@ public class DiyTemplateBaseVO { @Schema(description = "预览图", example = "[https://www.iocoder.cn/1.jpg]") private List previewPicUrls; + @Schema(description = "模板类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "默认") + @NotEmpty(message = "模板类型不能为空") + private String type; + } diff --git a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplatePageReqVO.java b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplatePageReqVO.java index 1099226f9..c25b5fcb2 100644 --- a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplatePageReqVO.java +++ b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplatePageReqVO.java @@ -20,6 +20,9 @@ public class DiyTemplatePageReqVO extends PageParam { @Schema(description = "模板名称", example = "默认主题") private String name; + @Schema(description = "模板类型", example = "默认") + private String type; + @Schema(description = "是否使用", example = "true") private Boolean used; diff --git a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/AppDiyTemplateController.java b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/AppDiyTemplateController.java index 2146024e8..026202e37 100644 --- a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/AppDiyTemplateController.java +++ b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/AppDiyTemplateController.java @@ -38,9 +38,10 @@ public class AppDiyTemplateController { // TODO @疯狂:要不要把 used 和 get 接口合并哈;不传递 id,直接拿默认; @GetMapping("/used") @Operation(summary = "使用中的装修模板") + @Parameter(name = "type", description = "装修模板类型", example = "1024") @PermitAll - public CommonResult getUsedDiyTemplate() { - DiyTemplateDO diyTemplate = diyTemplateService.getUsedDiyTemplate(); + public CommonResult getUsedDiyTemplate(@RequestParam(value = "type", required = false) String type) { + DiyTemplateDO diyTemplate = diyTemplateService.getUsedDiyTemplate(type); return success(buildVo(diyTemplate)); } diff --git a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyTemplateDO.java b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyTemplateDO.java index 1b7e1d592..0b2676484 100644 --- a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyTemplateDO.java +++ b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyTemplateDO.java @@ -38,6 +38,11 @@ public class DiyTemplateDO extends BaseDO { * 模板名称 */ private String name; + /** + * 模板类型 + * {@link DiyTemplateTypeEnum} + */ + private String type; /** * 是否使用 */ diff --git a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/diy/DiyTemplateMapper.java b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/diy/DiyTemplateMapper.java index ca3c6284e..e547a6976 100644 --- a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/diy/DiyTemplateMapper.java +++ b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/diy/DiyTemplateMapper.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.promotion.dal.mysql.diy; +import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; @@ -19,6 +20,7 @@ public interface DiyTemplateMapper extends BaseMapperX { return selectPage(reqVO, new LambdaQueryWrapperX() .likeIfPresent(DiyTemplateDO::getName, reqVO.getName()) .eqIfPresent(DiyTemplateDO::getUsed, reqVO.getUsed()) + .eqIfPresent(DiyTemplateDO::getType, reqVO.getType()) .betweenIfPresent(DiyTemplateDO::getUsedTime, reqVO.getUsedTime()) .betweenIfPresent(DiyTemplateDO::getCreateTime, reqVO.getCreateTime()) .orderByDesc(DiyTemplateDO::getUsed) // 排序规则1:已使用的排到最前面 @@ -28,6 +30,27 @@ public interface DiyTemplateMapper extends BaseMapperX { default DiyTemplateDO selectByUsed(boolean used) { return selectOne(DiyTemplateDO::getUsed, used); } + default DiyTemplateDO selectByUsed(boolean used, String type) { + return selectOne(DiyTemplateDO::getUsed, used, DiyTemplateDO::getType, type); + } + + default DiyTemplateDO selectAppByUsed(boolean used, String type) { + // 1. 没传类型查默认类型,默认类型找不到,取最近一次使用的模板 + if (ObjectUtil.isEmpty(type)) { + DiyTemplateDO defaultTemplate = selectByUsed(used, "default"); + return ObjectUtil.isNotEmpty(defaultTemplate) ? defaultTemplate : lastUsedTemplate(true); + } + // 2. 传了类型根据类型查询,没找到,取默认类型 + DiyTemplateDO typedTemplate = selectByUsed(used, type); + return ObjectUtil.isNotEmpty(typedTemplate) ? typedTemplate : selectByUsed(true, "default"); + } + + default DiyTemplateDO lastUsedTemplate(boolean used) { + return selectOne(new LambdaQueryWrapperX() + .eq(DiyTemplateDO::getUsed, used) + .orderByDesc(DiyTemplateDO::getUpdateTime) + .last("LIMIT 1")); + } default DiyTemplateDO selectByName(String name) { return selectOne(DiyTemplateDO::getName, name); diff --git a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateService.java b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateService.java index 566e4a75e..e9b475447 100644 --- a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateService.java +++ b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateService.java @@ -72,6 +72,6 @@ public interface DiyTemplateService { * * @return 装修模板 */ - DiyTemplateDO getUsedDiyTemplate(); + DiyTemplateDO getUsedDiyTemplate(String type); } diff --git a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImpl.java b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImpl.java index 6959e827d..d198b4599 100644 --- a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImpl.java @@ -125,10 +125,10 @@ public class DiyTemplateServiceImpl implements DiyTemplateService { @Override public void useDiyTemplate(Long id) { // 校验存在 - validateDiyTemplateExists(id); + DiyTemplateDO diyTemplateDO = validateDiyTemplateExists(id); // TODO @疯狂:要不已使用的情况,抛个业务异常? - // 已使用的更新为未使用 - DiyTemplateDO used = diyTemplateMapper.selectByUsed(true); + // 已使用的更新为未使用,加入模板类型判断 + DiyTemplateDO used = diyTemplateMapper.selectByUsed(true, diyTemplateDO.getType()); if (used != null) { // 如果 id 相同,说明未发生变化 if (used.getId().equals(id)) { @@ -164,8 +164,8 @@ public class DiyTemplateServiceImpl implements DiyTemplateService { } @Override - public DiyTemplateDO getUsedDiyTemplate() { - return diyTemplateMapper.selectByUsed(true); + public DiyTemplateDO getUsedDiyTemplate(String type) { + return diyTemplateMapper.selectAppByUsed(true, type); } } From 3b254a731d19b42c6a1a0b01fd494fc2ffbfa0f7 Mon Sep 17 00:00:00 2001 From: wuKong Date: Mon, 29 Dec 2025 16:57:19 +0800 Subject: [PATCH 2/8] =?UTF-8?q?docs(diy):=20=E6=9B=B4=E6=96=B0=20DiyTempla?= =?UTF-8?q?teTypeEnum=20=E6=B3=A8=E9=87=8A=E5=92=8C=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修正了 DiyTemplateTypeEnum 枚举的注释内容,明确 type 的用途 - 添加了 DiyTemplateDO 中对 DiyTemplateTypeEnum 的导入 - 清理了注释中的冗余表述,使文档更加清晰 --- .../module/promotion/enums/diy/DiyTemplateTypeEnum.java | 6 +++--- .../module/promotion/dal/dataobject/diy/DiyTemplateDO.java | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/diy/DiyTemplateTypeEnum.java b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/diy/DiyTemplateTypeEnum.java index d6ff0dc3e..45792e26e 100644 --- a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/diy/DiyTemplateTypeEnum.java +++ b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/diy/DiyTemplateTypeEnum.java @@ -36,9 +36,9 @@ public enum DiyTemplateTypeEnum implements ArrayValuable { private static final String[] ARRAYS = Arrays.stream(values()).map(DiyTemplateTypeEnum::getType).toArray(String[]::new); /** - * type String比较灵活 - * 可以是uniPlatform传值 - * 也增加是自定义的业务场景 + * type + * 可以是uniPlatform + * 也可以是其他自定义的业务场景 */ private final String type; diff --git a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyTemplateDO.java b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyTemplateDO.java index 0b2676484..f0ae1fa9b 100644 --- a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyTemplateDO.java +++ b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyTemplateDO.java @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.promotion.dal.dataobject.diy; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.mybatis.core.type.StringListTypeHandler; +import cn.iocoder.yudao.module.promotion.enums.diy.DiyTemplateTypeEnum; import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; From 57063b44b0951251def365172938b52a0f9f54d6 Mon Sep 17 00:00:00 2001 From: wuKong Date: Mon, 29 Dec 2025 18:20:50 +0800 Subject: [PATCH 3/8] =?UTF-8?q?feat(promotion):=20=E6=B7=BB=E5=8A=A0DIY?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E7=B1=BB=E5=9E=8B=E6=9E=9A=E4=B8=BE=E9=AA=8C?= =?UTF-8?q?=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在DiyTemplateBaseVO中添加DiyTemplateTypeEnum枚举验证注解 - 将硬编码的"default"字符串替换为DiyTemplateTypeEnum.DEFAULT.getType() - 统一模板类型的枚举管理,提高代码类型安全性 --- .../controller/admin/diy/vo/template/DiyTemplateBaseVO.java | 3 +++ .../module/promotion/dal/mysql/diy/DiyTemplateMapper.java | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplateBaseVO.java b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplateBaseVO.java index 3f43f6c7a..4d890f55f 100644 --- a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplateBaseVO.java +++ b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplateBaseVO.java @@ -1,5 +1,7 @@ package cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template; +import cn.iocoder.yudao.framework.common.validation.InEnum; +import cn.iocoder.yudao.module.promotion.enums.diy.DiyTemplateTypeEnum; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotEmpty; import lombok.Data; @@ -25,6 +27,7 @@ public class DiyTemplateBaseVO { @Schema(description = "模板类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "默认") @NotEmpty(message = "模板类型不能为空") + @InEnum(DiyTemplateTypeEnum.class) private String type; } diff --git a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/diy/DiyTemplateMapper.java b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/diy/DiyTemplateMapper.java index e547a6976..bc776bd85 100644 --- a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/diy/DiyTemplateMapper.java +++ b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/diy/DiyTemplateMapper.java @@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template.DiyTemplatePageReqVO; import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyTemplateDO; +import cn.iocoder.yudao.module.promotion.enums.diy.DiyTemplateTypeEnum; import org.apache.ibatis.annotations.Mapper; /** @@ -37,12 +38,12 @@ public interface DiyTemplateMapper extends BaseMapperX { default DiyTemplateDO selectAppByUsed(boolean used, String type) { // 1. 没传类型查默认类型,默认类型找不到,取最近一次使用的模板 if (ObjectUtil.isEmpty(type)) { - DiyTemplateDO defaultTemplate = selectByUsed(used, "default"); + DiyTemplateDO defaultTemplate = selectByUsed(used, DiyTemplateTypeEnum.DEFAULT.getType()); return ObjectUtil.isNotEmpty(defaultTemplate) ? defaultTemplate : lastUsedTemplate(true); } // 2. 传了类型根据类型查询,没找到,取默认类型 DiyTemplateDO typedTemplate = selectByUsed(used, type); - return ObjectUtil.isNotEmpty(typedTemplate) ? typedTemplate : selectByUsed(true, "default"); + return ObjectUtil.isNotEmpty(typedTemplate) ? typedTemplate : selectByUsed(true, DiyTemplateTypeEnum.DEFAULT.getType()); } default DiyTemplateDO lastUsedTemplate(boolean used) { From bf2604db488a86ee8638f11b167e5df67738299b Mon Sep 17 00:00:00 2001 From: wuKong Date: Tue, 30 Dec 2025 10:46:39 +0800 Subject: [PATCH 4/8] =?UTF-8?q?refactor(promotion):=20=E5=B0=86DiyTemplate?= =?UTF-8?q?TypeEnum=E9=87=8D=E5=91=BD=E5=90=8D=E4=B8=BADiyTemplatePlatform?= =?UTF-8?q?Enum?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将DiyTemplateTypeEnum重命名为DiyTemplatePlatformEnum - 更新枚举常量DEFAULT的值从"default"改为"" - 修改字段名从type改为platform - 更新相关VO、DO和Mapper中的字段引用 - 调整查询方法中字段映射关系 - 更新默认平台值获取逻辑 --- ...ateTypeEnum.java => DiyTemplatePlatformEnum.java} | 12 ++++++------ .../admin/diy/vo/template/DiyTemplateBaseVO.java | 9 ++++----- .../admin/diy/vo/template/DiyTemplatePageReqVO.java | 4 ++-- .../promotion/dal/dataobject/diy/DiyTemplateDO.java | 8 ++++---- .../promotion/dal/mysql/diy/DiyTemplateMapper.java | 10 +++++----- .../service/diy/DiyTemplateServiceImpl.java | 2 +- 6 files changed, 22 insertions(+), 23 deletions(-) rename yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/diy/{DiyTemplateTypeEnum.java => DiyTemplatePlatformEnum.java} (81%) diff --git a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/diy/DiyTemplateTypeEnum.java b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/diy/DiyTemplatePlatformEnum.java similarity index 81% rename from yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/diy/DiyTemplateTypeEnum.java rename to yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/diy/DiyTemplatePlatformEnum.java index 45792e26e..82ee77fb8 100644 --- a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/diy/DiyTemplateTypeEnum.java +++ b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/diy/DiyTemplatePlatformEnum.java @@ -7,14 +7,14 @@ import lombok.Getter; import java.util.Arrays; /** - * 模板类型枚举 + * 模板平台 * uniPlatform * @author wuKong */ @AllArgsConstructor @Getter -public enum DiyTemplateTypeEnum implements ArrayValuable { - DEFAULT("default","默认"), +public enum DiyTemplatePlatformEnum implements ArrayValuable { + DEFAULT("","默认"), APP("app", "App"), WEB("web", "Web"), MP_WEIXIN("mp-weixin", "微信小程序"), @@ -30,17 +30,17 @@ public enum DiyTemplateTypeEnum implements ArrayValuable { QUICKAPP_WEBVIEW("quickapp-webview", "快应用通用(包含联盟、华为)"), QUICKAPP_WEBVIEW_UNION("quickapp-webview-union", "快应用联盟"), QUICKAPP_WEBVIEW_HUAWEI("quickapp-webview-huawei", "快应用华为"), - //OTHER_VUSINESS_SCEN("other-business-scen", "其他自定义业务场景"), + //OTHER_BUSINESS_SCEN("other-business-scen", "其他自定义业务场景"), ; private static final String[] ARRAYS = - Arrays.stream(values()).map(DiyTemplateTypeEnum::getType).toArray(String[]::new); + Arrays.stream(values()).map(DiyTemplatePlatformEnum::getPlatform).toArray(String[]::new); /** * type * 可以是uniPlatform * 也可以是其他自定义的业务场景 */ - private final String type; + private final String platform; /** * name diff --git a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplateBaseVO.java b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplateBaseVO.java index 4d890f55f..177f74ec8 100644 --- a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplateBaseVO.java +++ b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplateBaseVO.java @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template; import cn.iocoder.yudao.framework.common.validation.InEnum; -import cn.iocoder.yudao.module.promotion.enums.diy.DiyTemplateTypeEnum; +import cn.iocoder.yudao.module.promotion.enums.diy.DiyTemplatePlatformEnum; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotEmpty; import lombok.Data; @@ -25,9 +25,8 @@ public class DiyTemplateBaseVO { @Schema(description = "预览图", example = "[https://www.iocoder.cn/1.jpg]") private List previewPicUrls; - @Schema(description = "模板类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "默认") - @NotEmpty(message = "模板类型不能为空") - @InEnum(DiyTemplateTypeEnum.class) - private String type; + @Schema(description = "模板平台", requiredMode = Schema.RequiredMode.REQUIRED, example = "默认") + @InEnum(DiyTemplatePlatformEnum.class) + private String platform; } diff --git a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplatePageReqVO.java b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplatePageReqVO.java index c25b5fcb2..9e4e9606f 100644 --- a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplatePageReqVO.java +++ b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplatePageReqVO.java @@ -20,8 +20,8 @@ public class DiyTemplatePageReqVO extends PageParam { @Schema(description = "模板名称", example = "默认主题") private String name; - @Schema(description = "模板类型", example = "默认") - private String type; + @Schema(description = "模板平台", example = "默认") + private String platform; @Schema(description = "是否使用", example = "true") private Boolean used; diff --git a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyTemplateDO.java b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyTemplateDO.java index f0ae1fa9b..2b06688bb 100644 --- a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyTemplateDO.java +++ b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyTemplateDO.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.promotion.dal.dataobject.diy; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.mybatis.core.type.StringListTypeHandler; -import cn.iocoder.yudao.module.promotion.enums.diy.DiyTemplateTypeEnum; +import cn.iocoder.yudao.module.promotion.enums.diy.DiyTemplatePlatformEnum; import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; @@ -40,10 +40,10 @@ public class DiyTemplateDO extends BaseDO { */ private String name; /** - * 模板类型 - * {@link DiyTemplateTypeEnum} + * 模板平台 + * {@link DiyTemplatePlatformEnum} */ - private String type; + private String platform; /** * 是否使用 */ diff --git a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/diy/DiyTemplateMapper.java b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/diy/DiyTemplateMapper.java index bc776bd85..37b71c6d1 100644 --- a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/diy/DiyTemplateMapper.java +++ b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/diy/DiyTemplateMapper.java @@ -6,7 +6,7 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template.DiyTemplatePageReqVO; import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyTemplateDO; -import cn.iocoder.yudao.module.promotion.enums.diy.DiyTemplateTypeEnum; +import cn.iocoder.yudao.module.promotion.enums.diy.DiyTemplatePlatformEnum; import org.apache.ibatis.annotations.Mapper; /** @@ -21,7 +21,7 @@ public interface DiyTemplateMapper extends BaseMapperX { return selectPage(reqVO, new LambdaQueryWrapperX() .likeIfPresent(DiyTemplateDO::getName, reqVO.getName()) .eqIfPresent(DiyTemplateDO::getUsed, reqVO.getUsed()) - .eqIfPresent(DiyTemplateDO::getType, reqVO.getType()) + .eqIfPresent(DiyTemplateDO::getPlatform, reqVO.getPlatform()) .betweenIfPresent(DiyTemplateDO::getUsedTime, reqVO.getUsedTime()) .betweenIfPresent(DiyTemplateDO::getCreateTime, reqVO.getCreateTime()) .orderByDesc(DiyTemplateDO::getUsed) // 排序规则1:已使用的排到最前面 @@ -32,18 +32,18 @@ public interface DiyTemplateMapper extends BaseMapperX { return selectOne(DiyTemplateDO::getUsed, used); } default DiyTemplateDO selectByUsed(boolean used, String type) { - return selectOne(DiyTemplateDO::getUsed, used, DiyTemplateDO::getType, type); + return selectOne(DiyTemplateDO::getUsed, used, DiyTemplateDO::getPlatform, type); } default DiyTemplateDO selectAppByUsed(boolean used, String type) { // 1. 没传类型查默认类型,默认类型找不到,取最近一次使用的模板 if (ObjectUtil.isEmpty(type)) { - DiyTemplateDO defaultTemplate = selectByUsed(used, DiyTemplateTypeEnum.DEFAULT.getType()); + DiyTemplateDO defaultTemplate = selectByUsed(used, DiyTemplatePlatformEnum.DEFAULT.getPlatform()); return ObjectUtil.isNotEmpty(defaultTemplate) ? defaultTemplate : lastUsedTemplate(true); } // 2. 传了类型根据类型查询,没找到,取默认类型 DiyTemplateDO typedTemplate = selectByUsed(used, type); - return ObjectUtil.isNotEmpty(typedTemplate) ? typedTemplate : selectByUsed(true, DiyTemplateTypeEnum.DEFAULT.getType()); + return ObjectUtil.isNotEmpty(typedTemplate) ? typedTemplate : selectByUsed(true, DiyTemplatePlatformEnum.DEFAULT.getPlatform()); } default DiyTemplateDO lastUsedTemplate(boolean used) { diff --git a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImpl.java b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImpl.java index d198b4599..c2b4bba00 100644 --- a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImpl.java @@ -128,7 +128,7 @@ public class DiyTemplateServiceImpl implements DiyTemplateService { DiyTemplateDO diyTemplateDO = validateDiyTemplateExists(id); // TODO @疯狂:要不已使用的情况,抛个业务异常? // 已使用的更新为未使用,加入模板类型判断 - DiyTemplateDO used = diyTemplateMapper.selectByUsed(true, diyTemplateDO.getType()); + DiyTemplateDO used = diyTemplateMapper.selectByUsed(true, diyTemplateDO.getPlatform()); if (used != null) { // 如果 id 相同,说明未发生变化 if (used.getId().equals(id)) { From 3625010b8ba1bb3c3ae4b6083eea83b60c2fca78 Mon Sep 17 00:00:00 2001 From: wuKong Date: Tue, 30 Dec 2025 10:57:52 +0800 Subject: [PATCH 5/8] =?UTF-8?q?feat(promotion):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E5=B9=B3=E5=8F=B0=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 增加了小程序平台枚举值 MP("mp", "小程序") - 支持微信小程序/支付宝小程序/百度小程序/抖音小程序/飞书小程序/QQ 小程序/360 小程序/鸿蒙元服务/小红书小程序/京东小程序/快手小程序 - 更新文档注释,添加条件编译相关链接 --- .../module/promotion/enums/diy/DiyTemplatePlatformEnum.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/diy/DiyTemplatePlatformEnum.java b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/diy/DiyTemplatePlatformEnum.java index 82ee77fb8..de12c6900 100644 --- a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/diy/DiyTemplatePlatformEnum.java +++ b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/diy/DiyTemplatePlatformEnum.java @@ -9,6 +9,7 @@ import java.util.Arrays; /** * 模板平台 * uniPlatform + * 条件编译 * @author wuKong */ @AllArgsConstructor @@ -30,6 +31,8 @@ public enum DiyTemplatePlatformEnum implements ArrayValuable { QUICKAPP_WEBVIEW("quickapp-webview", "快应用通用(包含联盟、华为)"), QUICKAPP_WEBVIEW_UNION("quickapp-webview-union", "快应用联盟"), QUICKAPP_WEBVIEW_HUAWEI("quickapp-webview-huawei", "快应用华为"), + //微信小程序/支付宝小程序/百度小程序/抖音小程序/飞书小程序/QQ 小程序/360 小程序/鸿蒙元服务/小红书小程序/京东小程序/快手小程序 + MP("mp", "小程序"), //OTHER_BUSINESS_SCEN("other-business-scen", "其他自定义业务场景"), ; From 4dcefa729858d98ee82a7ee4ebb11172e987a16f Mon Sep 17 00:00:00 2001 From: wuKong Date: Tue, 30 Dec 2025 10:58:29 +0800 Subject: [PATCH 6/8] =?UTF-8?q?refactor(promotion):=20=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=20DiyTemplatePlatformEnum=20=E4=B8=AD=E7=9A=84=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除了 type 相关的注释内容 - 保留了枚举的平台数组定义 --- .../module/promotion/enums/diy/DiyTemplatePlatformEnum.java | 1 - 1 file changed, 1 deletion(-) diff --git a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/diy/DiyTemplatePlatformEnum.java b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/diy/DiyTemplatePlatformEnum.java index de12c6900..c988b9a22 100644 --- a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/diy/DiyTemplatePlatformEnum.java +++ b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/diy/DiyTemplatePlatformEnum.java @@ -39,7 +39,6 @@ public enum DiyTemplatePlatformEnum implements ArrayValuable { private static final String[] ARRAYS = Arrays.stream(values()).map(DiyTemplatePlatformEnum::getPlatform).toArray(String[]::new); /** - * type * 可以是uniPlatform * 也可以是其他自定义的业务场景 */ From 453ce470ed2b6be71287e1ec098223d3c9fa4efe Mon Sep 17 00:00:00 2001 From: wuKong Date: Tue, 30 Dec 2025 11:24:27 +0800 Subject: [PATCH 7/8] =?UTF-8?q?refactor(promotion):=20=E5=B0=86=E8=A3=85?= =?UTF-8?q?=E4=BF=AE=E6=A8=A1=E6=9D=BF=E6=8E=A5=E5=8F=A3=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E4=BB=8Etype=E6=94=B9=E4=B8=BAplatform?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改AppDiyTemplateController中getUsedDiyTemplate方法参数名从type改为platform - 更新DiyTemplateMapper中相关方法参数命名和注释 - 调整selectAppByUsed方法中参数名称和逻辑注释 - 修改DiyTemplateService接口中方法参数命名 - 更新DiyTemplateServiceImpl实现类中方法参数名称 --- .../app/diy/AppDiyTemplateController.java | 7 ++++--- .../dal/mysql/diy/DiyTemplateMapper.java | 20 +++++++++---------- .../service/diy/DiyTemplateService.java | 2 +- .../service/diy/DiyTemplateServiceImpl.java | 4 ++-- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/AppDiyTemplateController.java b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/AppDiyTemplateController.java index 026202e37..565155211 100644 --- a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/AppDiyTemplateController.java +++ b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/AppDiyTemplateController.java @@ -38,10 +38,11 @@ public class AppDiyTemplateController { // TODO @疯狂:要不要把 used 和 get 接口合并哈;不传递 id,直接拿默认; @GetMapping("/used") @Operation(summary = "使用中的装修模板") - @Parameter(name = "type", description = "装修模板类型", example = "1024") + @Parameter(name = "platform", description = "装修模板平台", example = "1024") @PermitAll - public CommonResult getUsedDiyTemplate(@RequestParam(value = "type", required = false) String type) { - DiyTemplateDO diyTemplate = diyTemplateService.getUsedDiyTemplate(type); + public CommonResult getUsedDiyTemplate(@RequestParam(value = "platform", + required = false) String platform) { + DiyTemplateDO diyTemplate = diyTemplateService.getUsedDiyTemplate(platform); return success(buildVo(diyTemplate)); } diff --git a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/diy/DiyTemplateMapper.java b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/diy/DiyTemplateMapper.java index 37b71c6d1..12b591d81 100644 --- a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/diy/DiyTemplateMapper.java +++ b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/diy/DiyTemplateMapper.java @@ -31,19 +31,19 @@ public interface DiyTemplateMapper extends BaseMapperX { default DiyTemplateDO selectByUsed(boolean used) { return selectOne(DiyTemplateDO::getUsed, used); } - default DiyTemplateDO selectByUsed(boolean used, String type) { - return selectOne(DiyTemplateDO::getUsed, used, DiyTemplateDO::getPlatform, type); + default DiyTemplateDO selectByUsed(boolean used, String platform) { + return selectOne(DiyTemplateDO::getUsed, used, DiyTemplateDO::getPlatform, platform); } - default DiyTemplateDO selectAppByUsed(boolean used, String type) { - // 1. 没传类型查默认类型,默认类型找不到,取最近一次使用的模板 - if (ObjectUtil.isEmpty(type)) { - DiyTemplateDO defaultTemplate = selectByUsed(used, DiyTemplatePlatformEnum.DEFAULT.getPlatform()); - return ObjectUtil.isNotEmpty(defaultTemplate) ? defaultTemplate : lastUsedTemplate(true); + default DiyTemplateDO selectAppByUsed(boolean used, String platform) { + // 1. 没传值找默认,没找到,取最近一次使用的模板 + if (ObjectUtil.isNull(platform)) { + DiyTemplateDO defaultDiyTemplate = selectByUsed(used, DiyTemplatePlatformEnum.DEFAULT.getPlatform()); + return ObjectUtil.isNotEmpty(defaultDiyTemplate) ? defaultDiyTemplate : lastUsedTemplate(true); } - // 2. 传了类型根据类型查询,没找到,取默认类型 - DiyTemplateDO typedTemplate = selectByUsed(used, type); - return ObjectUtil.isNotEmpty(typedTemplate) ? typedTemplate : selectByUsed(true, DiyTemplatePlatformEnum.DEFAULT.getPlatform()); + // 2. 有传值,没找到,取默认 + DiyTemplateDO diyTemplate = selectByUsed(used, platform); + return ObjectUtil.isNotEmpty(diyTemplate) ? diyTemplate : selectByUsed(true, DiyTemplatePlatformEnum.DEFAULT.getPlatform()); } default DiyTemplateDO lastUsedTemplate(boolean used) { diff --git a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateService.java b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateService.java index e9b475447..0173d51b0 100644 --- a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateService.java +++ b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateService.java @@ -72,6 +72,6 @@ public interface DiyTemplateService { * * @return 装修模板 */ - DiyTemplateDO getUsedDiyTemplate(String type); + DiyTemplateDO getUsedDiyTemplate(String platform); } diff --git a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImpl.java b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImpl.java index c2b4bba00..7d3d5fb6c 100644 --- a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImpl.java @@ -164,8 +164,8 @@ public class DiyTemplateServiceImpl implements DiyTemplateService { } @Override - public DiyTemplateDO getUsedDiyTemplate(String type) { - return diyTemplateMapper.selectAppByUsed(true, type); + public DiyTemplateDO getUsedDiyTemplate(String platform) { + return diyTemplateMapper.selectAppByUsed(true, platform); } } From 8ff19dc776d5f23310168cada782edb055ea01cf Mon Sep 17 00:00:00 2001 From: wuKong Date: Tue, 30 Dec 2025 11:55:50 +0800 Subject: [PATCH 8/8] =?UTF-8?q?chore(diy):=20=E6=9B=B4=E6=96=B0=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E9=80=89=E6=8B=A9=E9=80=BB=E8=BE=91=E7=9A=84=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 优化没传值情况下的注释,明确版本过渡逻辑 - 简化有传值情况下的注释描述 --- .../module/promotion/dal/mysql/diy/DiyTemplateMapper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/diy/DiyTemplateMapper.java b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/diy/DiyTemplateMapper.java index 12b591d81..1a2e29ce4 100644 --- a/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/diy/DiyTemplateMapper.java +++ b/yudao-module-mall/yudao-module-promotion-server/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/diy/DiyTemplateMapper.java @@ -36,12 +36,12 @@ public interface DiyTemplateMapper extends BaseMapperX { } default DiyTemplateDO selectAppByUsed(boolean used, String platform) { - // 1. 没传值找默认,没找到,取最近一次使用的模板 + // 没传值(版本过度逻辑)找默认,没找到,取最近一次使用的模板 if (ObjectUtil.isNull(platform)) { DiyTemplateDO defaultDiyTemplate = selectByUsed(used, DiyTemplatePlatformEnum.DEFAULT.getPlatform()); return ObjectUtil.isNotEmpty(defaultDiyTemplate) ? defaultDiyTemplate : lastUsedTemplate(true); } - // 2. 有传值,没找到,取默认 + // 有传值,没找到,取默认 DiyTemplateDO diyTemplate = selectByUsed(used, platform); return ObjectUtil.isNotEmpty(diyTemplate) ? diyTemplate : selectByUsed(true, DiyTemplatePlatformEnum.DEFAULT.getPlatform()); }