Commit 989d7c44d0b4c60e64bb49e59132b471f294fc99
1 parent
1eff9822
code review 店铺装修
Showing
7 changed files
with
54 additions
and
38 deletions
pom.xml
| @@ -15,12 +15,12 @@ | @@ -15,12 +15,12 @@ | ||
| 15 | <!-- 各种 module 拓展 --> | 15 | <!-- 各种 module 拓展 --> |
| 16 | <module>yudao-module-system</module> | 16 | <module>yudao-module-system</module> |
| 17 | <module>yudao-module-infra</module> | 17 | <module>yudao-module-infra</module> |
| 18 | -<!-- <module>yudao-module-member</module>--> | 18 | + <module>yudao-module-member</module> |
| 19 | <!-- <module>yudao-module-bpm</module>--> | 19 | <!-- <module>yudao-module-bpm</module>--> |
| 20 | <!-- <module>yudao-module-report</module>--> | 20 | <!-- <module>yudao-module-report</module>--> |
| 21 | <!-- <module>yudao-module-mp</module>--> | 21 | <!-- <module>yudao-module-mp</module>--> |
| 22 | -<!-- <module>yudao-module-pay</module>--> | ||
| 23 | -<!-- <module>yudao-module-mall</module>--> | 22 | + <module>yudao-module-pay</module> |
| 23 | + <module>yudao-module-mall</module> | ||
| 24 | <!-- 示例项目 --> | 24 | <!-- 示例项目 --> |
| 25 | <!-- <module>yudao-example</module>--> | 25 | <!-- <module>yudao-example</module>--> |
| 26 | </modules> | 26 | </modules> |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplateBaseVO.java
| @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template; | @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template; | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | import lombok.Data; | 4 | import lombok.Data; |
| 5 | 5 | ||
| 6 | -import javax.validation.constraints.NotNull; | 6 | +import javax.validation.constraints.NotEmpty; |
| 7 | import java.util.List; | 7 | import java.util.List; |
| 8 | 8 | ||
| 9 | /** | 9 | /** |
| @@ -14,7 +14,7 @@ import java.util.List; | @@ -14,7 +14,7 @@ import java.util.List; | ||
| 14 | public class DiyTemplateBaseVO { | 14 | public class DiyTemplateBaseVO { |
| 15 | 15 | ||
| 16 | @Schema(description = "模板名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "默认主题") | 16 | @Schema(description = "模板名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "默认主题") |
| 17 | - @NotNull(message = "模板名称不能为空") | 17 | + @NotEmpty(message = "模板名称不能为空") |
| 18 | private String name; | 18 | private String name; |
| 19 | 19 | ||
| 20 | @Schema(description = "备注", example = "默认主题") | 20 | @Schema(description = "备注", example = "默认主题") |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyPageDO.java
| @@ -32,6 +32,8 @@ public class DiyPageDO extends BaseDO { | @@ -32,6 +32,8 @@ public class DiyPageDO extends BaseDO { | ||
| 32 | private Long id; | 32 | private Long id; |
| 33 | /** | 33 | /** |
| 34 | * 装修模板编号 | 34 | * 装修模板编号 |
| 35 | + * | ||
| 36 | + * 关联 {@link DiyTemplateDO#getId()} | ||
| 35 | */ | 37 | */ |
| 36 | private Long templateId; | 38 | private Long templateId; |
| 37 | /** | 39 | /** |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyTemplateDO.java
| @@ -14,6 +14,9 @@ import java.util.List; | @@ -14,6 +14,9 @@ import java.util.List; | ||
| 14 | /** | 14 | /** |
| 15 | * 装修模板 DO | 15 | * 装修模板 DO |
| 16 | * | 16 | * |
| 17 | + * 1. 新建一个模版,下面可以包含多个 {@link DiyPageDO} 页面,例如说首页、我的 | ||
| 18 | + * 2. 如果需要使用某个模版,则将 {@link #used} 设置为 true,表示已使用,有且仅有一个 | ||
| 19 | + * | ||
| 17 | * @author owen | 20 | * @author owen |
| 18 | */ | 21 | */ |
| 19 | @TableName(value = "promotion_diy_template", autoResultMap = true) | 22 | @TableName(value = "promotion_diy_template", autoResultMap = true) |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyPageServiceImpl.java
| @@ -42,7 +42,6 @@ public class DiyPageServiceImpl implements DiyPageService { | @@ -42,7 +42,6 @@ public class DiyPageServiceImpl implements DiyPageService { | ||
| 42 | DiyPageDO diyPage = DiyPageConvert.INSTANCE.convert(createReqVO); | 42 | DiyPageDO diyPage = DiyPageConvert.INSTANCE.convert(createReqVO); |
| 43 | diyPage.setProperty("{}"); | 43 | diyPage.setProperty("{}"); |
| 44 | diyPageMapper.insert(diyPage); | 44 | diyPageMapper.insert(diyPage); |
| 45 | - // 返回 | ||
| 46 | return diyPage.getId(); | 45 | return diyPage.getId(); |
| 47 | } | 46 | } |
| 48 | 47 | ||
| @@ -57,6 +56,13 @@ public class DiyPageServiceImpl implements DiyPageService { | @@ -57,6 +56,13 @@ public class DiyPageServiceImpl implements DiyPageService { | ||
| 57 | diyPageMapper.updateById(updateObj); | 56 | diyPageMapper.updateById(updateObj); |
| 58 | } | 57 | } |
| 59 | 58 | ||
| 59 | + /** | ||
| 60 | + * 校验 Page 页面,在一个 template 模版下的名字是唯一的 | ||
| 61 | + * | ||
| 62 | + * @param id Page 编号 | ||
| 63 | + * @param templateId 模版编号 | ||
| 64 | + * @param name Page 名字 | ||
| 65 | + */ | ||
| 60 | void validateNameUnique(Long id, Long templateId, String name) { | 66 | void validateNameUnique(Long id, Long templateId, String name) { |
| 61 | if (templateId != null || StrUtil.isBlank(name)) { | 67 | if (templateId != null || StrUtil.isBlank(name)) { |
| 62 | return; | 68 | return; |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImpl.java
| @@ -32,9 +32,11 @@ public class DiyTemplateServiceImpl implements DiyTemplateService { | @@ -32,9 +32,11 @@ public class DiyTemplateServiceImpl implements DiyTemplateService { | ||
| 32 | 32 | ||
| 33 | @Resource | 33 | @Resource |
| 34 | private DiyTemplateMapper diyTemplateMapper; | 34 | private DiyTemplateMapper diyTemplateMapper; |
| 35 | + | ||
| 35 | @Resource | 36 | @Resource |
| 36 | private DiyPageService diyPageService; | 37 | private DiyPageService diyPageService; |
| 37 | 38 | ||
| 39 | + // TODO @疯狂:事务; | ||
| 38 | @Override | 40 | @Override |
| 39 | public Long createDiyTemplate(DiyTemplateCreateReqVO createReqVO) { | 41 | public Long createDiyTemplate(DiyTemplateCreateReqVO createReqVO) { |
| 40 | // 校验名称唯一 | 42 | // 校验名称唯一 |
| @@ -120,9 +122,11 @@ public class DiyTemplateServiceImpl implements DiyTemplateService { | @@ -120,9 +122,11 @@ public class DiyTemplateServiceImpl implements DiyTemplateService { | ||
| 120 | } | 122 | } |
| 121 | 123 | ||
| 122 | @Override | 124 | @Override |
| 125 | + // TODO @疯狂:事务; | ||
| 123 | public void useDiyTemplate(Long id) { | 126 | public void useDiyTemplate(Long id) { |
| 124 | // 校验存在 | 127 | // 校验存在 |
| 125 | validateDiyTemplateExists(id); | 128 | validateDiyTemplateExists(id); |
| 129 | + // TODO @疯狂:要不已使用的情况,抛个业务异常? | ||
| 126 | // 已使用的更新为未使用 | 130 | // 已使用的更新为未使用 |
| 127 | DiyTemplateDO used = diyTemplateMapper.selectByUsed(true); | 131 | DiyTemplateDO used = diyTemplateMapper.selectByUsed(true); |
| 128 | if (used != null) { | 132 | if (used != null) { |
| @@ -136,8 +140,8 @@ public class DiyTemplateServiceImpl implements DiyTemplateService { | @@ -136,8 +140,8 @@ public class DiyTemplateServiceImpl implements DiyTemplateService { | ||
| 136 | this.updateUsed(id, true, LocalDateTime.now()); | 140 | this.updateUsed(id, true, LocalDateTime.now()); |
| 137 | } | 141 | } |
| 138 | 142 | ||
| 139 | - @Transactional(rollbackFor = Exception.class) | ||
| 140 | @Override | 143 | @Override |
| 144 | + @Transactional(rollbackFor = Exception.class) | ||
| 141 | public void updateDiyTemplateProperty(DiyTemplatePropertyUpdateRequestVO updateReqVO) { | 145 | public void updateDiyTemplateProperty(DiyTemplatePropertyUpdateRequestVO updateReqVO) { |
| 142 | // 校验存在 | 146 | // 校验存在 |
| 143 | validateDiyTemplateExists(updateReqVO.getId()); | 147 | validateDiyTemplateExists(updateReqVO.getId()); |
| @@ -151,6 +155,7 @@ public class DiyTemplateServiceImpl implements DiyTemplateService { | @@ -151,6 +155,7 @@ public class DiyTemplateServiceImpl implements DiyTemplateService { | ||
| 151 | return diyTemplateMapper.selectByUsed(true); | 155 | return diyTemplateMapper.selectByUsed(true); |
| 152 | } | 156 | } |
| 153 | 157 | ||
| 158 | + // TODO @疯狂:挪到 useDiyTemplate 下面,改名 updateTemplateUsed 会不会好点哈; | ||
| 154 | /** | 159 | /** |
| 155 | * 更新模板是否使用 | 160 | * 更新模板是否使用 |
| 156 | * | 161 | * |
yudao-server/pom.xml
| @@ -37,11 +37,11 @@ | @@ -37,11 +37,11 @@ | ||
| 37 | </dependency> | 37 | </dependency> |
| 38 | 38 | ||
| 39 | <!-- 会员中心。默认注释,保证编译速度 --> | 39 | <!-- 会员中心。默认注释,保证编译速度 --> |
| 40 | -<!-- <dependency>--> | ||
| 41 | -<!-- <groupId>cn.iocoder.boot</groupId>--> | ||
| 42 | -<!-- <artifactId>yudao-module-member-biz</artifactId>--> | ||
| 43 | -<!-- <version>${revision}</version>--> | ||
| 44 | -<!-- </dependency>--> | 40 | + <dependency> |
| 41 | + <groupId>cn.iocoder.boot</groupId> | ||
| 42 | + <artifactId>yudao-module-member-biz</artifactId> | ||
| 43 | + <version>${revision}</version> | ||
| 44 | + </dependency> | ||
| 45 | 45 | ||
| 46 | <!-- 数据报表。默认注释,保证编译速度 --> | 46 | <!-- 数据报表。默认注释,保证编译速度 --> |
| 47 | <!-- <dependency>--> | 47 | <!-- <dependency>--> |
| @@ -56,11 +56,11 @@ | @@ -56,11 +56,11 @@ | ||
| 56 | <!-- <version>${revision}</version>--> | 56 | <!-- <version>${revision}</version>--> |
| 57 | <!-- </dependency>--> | 57 | <!-- </dependency>--> |
| 58 | <!-- 支付服务。默认注释,保证编译速度 --> | 58 | <!-- 支付服务。默认注释,保证编译速度 --> |
| 59 | -<!-- <dependency>--> | ||
| 60 | -<!-- <groupId>cn.iocoder.boot</groupId>--> | ||
| 61 | -<!-- <artifactId>yudao-module-pay-biz</artifactId>--> | ||
| 62 | -<!-- <version>${revision}</version>--> | ||
| 63 | -<!-- </dependency>--> | 59 | + <dependency> |
| 60 | + <groupId>cn.iocoder.boot</groupId> | ||
| 61 | + <artifactId>yudao-module-pay-biz</artifactId> | ||
| 62 | + <version>${revision}</version> | ||
| 63 | + </dependency> | ||
| 64 | 64 | ||
| 65 | <!-- 微信公众号模块。默认注释,保证编译速度 --> | 65 | <!-- 微信公众号模块。默认注释,保证编译速度 --> |
| 66 | <!-- <dependency>--> | 66 | <!-- <dependency>--> |
| @@ -69,27 +69,27 @@ | @@ -69,27 +69,27 @@ | ||
| 69 | <!-- <version>${revision}</version>--> | 69 | <!-- <version>${revision}</version>--> |
| 70 | <!-- </dependency>--> | 70 | <!-- </dependency>--> |
| 71 | 71 | ||
| 72 | -<!-- 商城相关模块。默认注释,保证编译速度--> | ||
| 73 | -<!-- <dependency>--> | ||
| 74 | -<!-- <groupId>cn.iocoder.boot</groupId>--> | ||
| 75 | -<!-- <artifactId>yudao-module-promotion-biz</artifactId>--> | ||
| 76 | -<!-- <version>${revision}</version>--> | ||
| 77 | -<!-- </dependency>--> | ||
| 78 | -<!-- <dependency>--> | ||
| 79 | -<!-- <groupId>cn.iocoder.boot</groupId>--> | ||
| 80 | -<!-- <artifactId>yudao-module-product-biz</artifactId>--> | ||
| 81 | -<!-- <version>${revision}</version>--> | ||
| 82 | -<!-- </dependency>--> | ||
| 83 | -<!-- <dependency>--> | ||
| 84 | -<!-- <groupId>cn.iocoder.boot</groupId>--> | ||
| 85 | -<!-- <artifactId>yudao-module-trade-biz</artifactId>--> | ||
| 86 | -<!-- <version>${revision}</version>--> | ||
| 87 | -<!-- </dependency>--> | ||
| 88 | -<!-- <dependency>--> | ||
| 89 | -<!-- <groupId>cn.iocoder.boot</groupId>--> | ||
| 90 | -<!-- <artifactId>yudao-module-statistics-biz</artifactId>--> | ||
| 91 | -<!-- <version>${revision}</version>--> | ||
| 92 | -<!-- </dependency>--> | 72 | + <!-- 商城相关模块。默认注释,保证编译速度--> |
| 73 | + <dependency> | ||
| 74 | + <groupId>cn.iocoder.boot</groupId> | ||
| 75 | + <artifactId>yudao-module-promotion-biz</artifactId> | ||
| 76 | + <version>${revision}</version> | ||
| 77 | + </dependency> | ||
| 78 | + <dependency> | ||
| 79 | + <groupId>cn.iocoder.boot</groupId> | ||
| 80 | + <artifactId>yudao-module-product-biz</artifactId> | ||
| 81 | + <version>${revision}</version> | ||
| 82 | + </dependency> | ||
| 83 | + <dependency> | ||
| 84 | + <groupId>cn.iocoder.boot</groupId> | ||
| 85 | + <artifactId>yudao-module-trade-biz</artifactId> | ||
| 86 | + <version>${revision}</version> | ||
| 87 | + </dependency> | ||
| 88 | + <dependency> | ||
| 89 | + <groupId>cn.iocoder.boot</groupId> | ||
| 90 | + <artifactId>yudao-module-statistics-biz</artifactId> | ||
| 91 | + <version>${revision}</version> | ||
| 92 | + </dependency> | ||
| 93 | 93 | ||
| 94 | <!-- spring boot 配置所需依赖 --> | 94 | <!-- spring boot 配置所需依赖 --> |
| 95 | <dependency> | 95 | <dependency> |