From df609df2cf88de04c3ede0dad55f9755c8d48cd0 Mon Sep 17 00:00:00 2001 From: owen Date: Thu, 11 Jan 2024 00:25:55 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=95=86=E5=93=81=EF=BC=9A=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=E6=B5=8F=E8=A7=88=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/history/AppProductBrowseHistoryController.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/history/AppProductBrowseHistoryController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/history/AppProductBrowseHistoryController.java index f15c149b1..bdd152e7e 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/history/AppProductBrowseHistoryController.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/history/AppProductBrowseHistoryController.java @@ -81,8 +81,9 @@ public class AppProductBrowseHistoryController { // 转换 VO 结果 PageResult result = BeanUtils.toBean(pageResult, AppProductBrowseHistoryRespVO.class, vo -> Optional.ofNullable(spuMap.get(vo.getSpuId())).ifPresent(spu -> { - vo.setSpuName(spu.getName()); - vo.setPicUrl(spu.getPicUrl()); + vo.setSpuName(spu.getName()) + .setPicUrl(spu.getPicUrl()) + .setPrice(spu.getPrice()); })); return success(result); } From 2ab2b510cc1ff4ea98cf82048f1e23e9badd4348 Mon Sep 17 00:00:00 2001 From: owen Date: Thu, 11 Jan 2024 00:26:22 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E8=90=A5=E9=94=80=EF=BC=9A=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=E6=8B=BC=E5=9B=A2=E6=8E=A5=E5=8F=A3=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/combination/CombinationActivityController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/CombinationActivityController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/CombinationActivityController.java index b4befc3f5..9ba319463 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/CombinationActivityController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/CombinationActivityController.java @@ -63,7 +63,7 @@ public class CombinationActivityController { @Operation(summary = "关闭拼团活动") @Parameter(name = "id", description = "编号", required = true) @PreAuthorize("@ss.hasPermission('promotion:combination-activity:close')") - public CommonResult closeSeckillActivity(@RequestParam("id") Long id) { + public CommonResult closeCombinationActivity(@RequestParam("id") Long id) { combinationActivityService.closeCombinationActivityById(id); return success(true); } From 680718c78fef80cc8af491bbb9a23196af17138d Mon Sep 17 00:00:00 2001 From: owen Date: Thu, 11 Jan 2024 11:21:24 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E8=90=A5=E9=94=80=EF=BC=9A=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=E8=A3=85=E4=BF=AE=E9=A2=84=E8=A7=88=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/admin/diy/vo/page/DiyPageBaseVO.java | 2 +- .../admin/diy/vo/template/DiyTemplateBaseVO.java | 2 +- .../promotion/dal/dataobject/diy/DiyPageDO.java | 3 +-- .../promotion/dal/dataobject/diy/DiyTemplateDO.java | 4 ++-- .../service/diy/DiyTemplateServiceImplTest.java | 12 ++++++------ .../src/test/resources/sql/create_tables.sql | 4 ++-- 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/page/DiyPageBaseVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/page/DiyPageBaseVO.java index 4ccb5a736..9ae18c2f9 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/page/DiyPageBaseVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/page/DiyPageBaseVO.java @@ -24,6 +24,6 @@ public class DiyPageBaseVO { private String remark; @Schema(description = "预览图") - private List previewImageUrls; + private List previewPicUrls; } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplateBaseVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplateBaseVO.java index 0d1bce055..93800a168 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplateBaseVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplateBaseVO.java @@ -21,6 +21,6 @@ public class DiyTemplateBaseVO { private String remark; @Schema(description = "预览图", example = "[https://www.iocoder.cn/1.jpg]") - private List previewImageUrls; + private List previewPicUrls; } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyPageDO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyPageDO.java index 4a9324dfc..e1c0dd376 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyPageDO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyPageDO.java @@ -44,12 +44,11 @@ public class DiyPageDO extends BaseDO { * 备注 */ private String remark; - // TODO @疯狂:这个字段要不改成 previewPicUrls,和别的模块一样用 pic 作为图片哇? /** * 预览图,多个逗号分隔 */ @TableField(typeHandler = StringListTypeHandler.class) - private List previewImageUrls; + private List previewPicUrls; /** * 页面属性,JSON 格式 */ diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyTemplateDO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyTemplateDO.java index daf1f786d..1b7e1d592 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyTemplateDO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyTemplateDO.java @@ -50,12 +50,12 @@ public class DiyTemplateDO extends BaseDO { * 备注 */ private String remark; - // TODO @疯狂:这个字段要不改成 previewPicUrls,和别的模块一样用 pic 作为图片哇? + /** * 预览图 */ @TableField(typeHandler = StringListTypeHandler.class) - private List previewImageUrls; + private List previewPicUrls; /** * uni-app 底部导航属性,JSON 格式 */ diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImplTest.java b/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImplTest.java index c9c6d0bdc..0c76f45a4 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImplTest.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImplTest.java @@ -109,7 +109,7 @@ public class DiyTemplateServiceImplTest extends BaseDbUnitTest { o.setUsed(null); o.setUsedTime(null); o.setRemark(null); - o.setPreviewImageUrls(null); + o.setPreviewPicUrls(null); o.setProperty(null); o.setCreateTime(null); }); @@ -122,8 +122,8 @@ public class DiyTemplateServiceImplTest extends BaseDbUnitTest { diyTemplateMapper.insert(cloneIgnoreId(dbDiyTemplate, o -> o.setUsedTime(null))); // 测试 remark 不匹配 diyTemplateMapper.insert(cloneIgnoreId(dbDiyTemplate, o -> o.setRemark(null))); - // 测试 previewImageUrls 不匹配 - diyTemplateMapper.insert(cloneIgnoreId(dbDiyTemplate, o -> o.setPreviewImageUrls(null))); + // 测试 previewPicUrls 不匹配 + diyTemplateMapper.insert(cloneIgnoreId(dbDiyTemplate, o -> o.setPreviewPicUrls(null))); // 测试 property 不匹配 diyTemplateMapper.insert(cloneIgnoreId(dbDiyTemplate, o -> o.setProperty(null))); // 测试 createTime 不匹配 @@ -152,7 +152,7 @@ public class DiyTemplateServiceImplTest extends BaseDbUnitTest { o.setUsed(null); o.setUsedTime(null); o.setRemark(null); - o.setPreviewImageUrls(null); + o.setPreviewPicUrls(null); o.setProperty(null); o.setCreateTime(null); }); @@ -165,8 +165,8 @@ public class DiyTemplateServiceImplTest extends BaseDbUnitTest { diyTemplateMapper.insert(cloneIgnoreId(dbDiyTemplate, o -> o.setUsedTime(null))); // 测试 remark 不匹配 diyTemplateMapper.insert(cloneIgnoreId(dbDiyTemplate, o -> o.setRemark(null))); - // 测试 previewImageUrls 不匹配 - diyTemplateMapper.insert(cloneIgnoreId(dbDiyTemplate, o -> o.setPreviewImageUrls(null))); + // 测试 previewPicUrls 不匹配 + diyTemplateMapper.insert(cloneIgnoreId(dbDiyTemplate, o -> o.setPreviewPicUrls(null))); // 测试 property 不匹配 diyTemplateMapper.insert(cloneIgnoreId(dbDiyTemplate, o -> o.setProperty(null))); // 测试 createTime 不匹配 diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/create_tables.sql b/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/create_tables.sql index dc651301c..00ac3f93d 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/create_tables.sql +++ b/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/create_tables.sql @@ -228,7 +228,7 @@ CREATE TABLE IF NOT EXISTS "promotion_diy_template" "used" bit NOT NULL, "used_time" varchar, "remark" varchar, - "preview_image_urls" varchar, + "preview_pic_urls" varchar, "property" varchar NOT NULL, "creator" varchar DEFAULT '', "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, @@ -244,7 +244,7 @@ CREATE TABLE IF NOT EXISTS "promotion_diy_page" "template_id" bigint NOT NULL, "name" varchar NOT NULL, "remark" varchar, - "preview_image_urls" varchar, + "preview_pic_urls" varchar, "property" varchar, "creator" varchar DEFAULT '', "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, From d6b59743a396addbbb591f524f479447f2c0e0a3 Mon Sep 17 00:00:00 2001 From: owen Date: Thu, 11 Jan 2024 11:55:25 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E8=90=A5=E9=94=80=EF=BC=9A=E6=8E=A5?= =?UTF-8?q?=E5=85=A5=20APP=20=E8=A3=85=E4=BF=AE=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/diy/AppDiyPageController.java | 36 ++++++++++++++++++ .../app/diy/vo/AppDiyPagePropertyRespVO.java | 2 + .../service/diy/DiyTemplateServiceImpl.java | 37 +++++++++---------- 3 files changed, 56 insertions(+), 19 deletions(-) create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/AppDiyPageController.java diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/AppDiyPageController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/AppDiyPageController.java new file mode 100644 index 000000000..fe67404ca --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/AppDiyPageController.java @@ -0,0 +1,36 @@ +package cn.iocoder.yudao.module.promotion.controller.app.diy; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.module.promotion.controller.app.diy.vo.AppDiyPagePropertyRespVO; +import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyPageDO; +import cn.iocoder.yudao.module.promotion.service.diy.DiyPageService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +@Tag(name = "用户 APP - 装修页面") +@RestController +@RequestMapping("/promotion/diy-page") +@Validated +public class AppDiyPageController { + @Resource + private DiyPageService diyPageService; + + @GetMapping("/get") + @Operation(summary = "获得装修页面") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + public CommonResult getDiyPage(@RequestParam("id") Long id) { + DiyPageDO diyPage = diyPageService.getDiyPage(id); + return success(BeanUtils.toBean(diyPage, AppDiyPagePropertyRespVO.class)); + } + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/vo/AppDiyPagePropertyRespVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/vo/AppDiyPagePropertyRespVO.java index 9d623f5d4..fb896d797 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/vo/AppDiyPagePropertyRespVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/vo/AppDiyPagePropertyRespVO.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.promotion.controller.app.diy.vo; +import com.fasterxml.jackson.annotation.JsonRawValue; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.ToString; @@ -16,6 +17,7 @@ public class AppDiyPagePropertyRespVO { private String name; @Schema(description = "页面属性", example = "[]") + @JsonRawValue private String property; } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImpl.java index bc005b940..6959e827d 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImpl.java @@ -11,11 +11,11 @@ import cn.iocoder.yudao.module.promotion.convert.diy.DiyPageConvert; import cn.iocoder.yudao.module.promotion.convert.diy.DiyTemplateConvert; import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyTemplateDO; import cn.iocoder.yudao.module.promotion.dal.mysql.diy.DiyTemplateMapper; +import jakarta.annotation.Resource; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; -import jakarta.annotation.Resource; import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; @@ -36,7 +36,7 @@ public class DiyTemplateServiceImpl implements DiyTemplateService { @Resource private DiyPageService diyPageService; - // TODO @疯狂:事务; + @Transactional(rollbackFor = Exception.class) @Override public Long createDiyTemplate(DiyTemplateCreateReqVO createReqVO) { // 校验名称唯一 @@ -121,8 +121,8 @@ public class DiyTemplateServiceImpl implements DiyTemplateService { return diyTemplateMapper.selectPage(pageReqVO); } + @Transactional(rollbackFor = Exception.class) @Override - // TODO @疯狂:事务; public void useDiyTemplate(Long id) { // 校验存在 validateDiyTemplateExists(id); @@ -134,10 +134,23 @@ public class DiyTemplateServiceImpl implements DiyTemplateService { if (used.getId().equals(id)) { return; } - this.updateUsed(used.getId(), false, null); + this.updateTemplateUsed(used.getId(), false, null); } // 更新为已使用 - this.updateUsed(id, true, LocalDateTime.now()); + this.updateTemplateUsed(id, true, LocalDateTime.now()); + } + + /** + * 更新模板是否使用 + * + * @param id 模板编号 + * @param used 是否使用 + * @param usedTime 使用时间 + */ + private void updateTemplateUsed(Long id, Boolean used, LocalDateTime usedTime) { + DiyTemplateDO updateObj = new DiyTemplateDO().setId(id) + .setUsed(used).setUsedTime(usedTime); + diyTemplateMapper.updateById(updateObj); } @Override @@ -155,18 +168,4 @@ public class DiyTemplateServiceImpl implements DiyTemplateService { return diyTemplateMapper.selectByUsed(true); } - // TODO @疯狂:挪到 useDiyTemplate 下面,改名 updateTemplateUsed 会不会好点哈; - /** - * 更新模板是否使用 - * - * @param id 模板编号 - * @param used 是否使用 - * @param usedTime 使用时间 - */ - private void updateUsed(Long id, Boolean used, LocalDateTime usedTime) { - DiyTemplateDO updateObj = new DiyTemplateDO().setId(id) - .setUsed(used).setUsedTime(usedTime); - diyTemplateMapper.updateById(updateObj); - } - } From 31a28cb40dbebf0c2926d7c148c7505a67473488 Mon Sep 17 00:00:00 2001 From: owen Date: Thu, 11 Jan 2024 12:38:17 +0800 Subject: [PATCH 5/5] =?UTF-8?q?Review=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/promotion/enums/decorate/DecoratePageEnum.java | 2 +- .../controller/app/diy/AppDiyTemplateController.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/decorate/DecoratePageEnum.java b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/decorate/DecoratePageEnum.java index 3b662db7a..d773c2040 100644 --- a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/decorate/DecoratePageEnum.java +++ b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/decorate/DecoratePageEnum.java @@ -16,7 +16,7 @@ import java.util.Arrays; public enum DecoratePageEnum implements IntArrayValuable { INDEX(1, "首页"), - MY(2, "个人中心"), + MY(2, "我的"), ; private static final int[] ARRAYS = Arrays.stream(values()).mapToInt(DecoratePageEnum::getPage).toArray(); diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/AppDiyTemplateController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/AppDiyTemplateController.java index 90ecbcac4..6e4ee2501 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/AppDiyTemplateController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/AppDiyTemplateController.java @@ -5,6 +5,7 @@ import cn.iocoder.yudao.module.promotion.controller.app.diy.vo.AppDiyTemplatePro import cn.iocoder.yudao.module.promotion.convert.diy.DiyTemplateConvert; import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyPageDO; import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyTemplateDO; +import cn.iocoder.yudao.module.promotion.enums.decorate.DecoratePageEnum; import cn.iocoder.yudao.module.promotion.service.diy.DiyPageService; import cn.iocoder.yudao.module.promotion.service.diy.DiyTemplateService; import io.swagger.v3.oas.annotations.Operation; @@ -55,9 +56,8 @@ public class AppDiyTemplateController { } // 查询模板下的页面 List pages = diyPageService.getDiyPageByTemplateId(diyTemplate.getId()); - // TODO @疯狂:首页、我的,要不枚举到 DiyPageDO 例如说 NAME_USER,NAME_HOME 类似这种哈; - String home = findFirst(pages, page -> "首页".equals(page.getName()), DiyPageDO::getProperty); - String user = findFirst(pages, page -> "我的".equals(page.getName()), DiyPageDO::getProperty); + String home = findFirst(pages, page -> DecoratePageEnum.INDEX.getName().equals(page.getName()), DiyPageDO::getProperty); + String user = findFirst(pages, page -> DecoratePageEnum.MY.getName().equals(page.getName()), DiyPageDO::getProperty); // 拼接返回 return DiyTemplateConvert.INSTANCE.convertPropertyVo2(diyTemplate, home, user); }