From 3a2ccc9d6b5d48d3225e63b1be1ce0449c73c44e Mon Sep 17 00:00:00 2001 From: owen Date: Mon, 23 Oct 2023 22:10:54 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=90=A5=E9=94=80=EF=BC=9A=E8=A3=85?= =?UTF-8?q?=E4=BF=AE=E6=A8=A1=E6=9D=BF=E3=80=81=E8=A3=85=E4=BF=AE=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/mysql/mall.sql | 83 ++++++++- .../promotion/enums/ErrorCodeConstants.java | 7 + .../admin/padiyge/DiyPageController.java | 85 +++++++++ .../admin/padiyge/vo/DiyPageBaseVO.java | 29 +++ .../admin/padiyge/vo/DiyPageCreateReqVO.java | 14 ++ .../admin/padiyge/vo/DiyPagePageReqVO.java | 27 +++ .../admin/padiyge/vo/DiyPageRespVO.java | 22 +++ .../admin/padiyge/vo/DiyPageUpdateReqVO.java | 20 ++ .../admin/template/DiyTemplateController.java | 82 ++++++++ .../admin/template/vo/DiyTemplateBaseVO.java | 29 +++ .../template/vo/DiyTemplateCreateReqVO.java | 14 ++ .../template/vo/DiyTemplatePageReqVO.java | 34 ++++ .../admin/template/vo/DiyTemplateRespVO.java | 28 +++ .../template/vo/DiyTemplateUpdateReqVO.java | 20 ++ .../convert/padiyge/DiyPageConvert.java | 33 ++++ .../convert/template/DiyTemplateConvert.java | 31 ++++ .../dal/dataobject/padiyge/DiyPageDO.java | 55 ++++++ .../dataobject/template/DiyTemplateDO.java | 60 ++++++ .../dal/mysql/padiyge/DiyPageMapper.java | 26 +++ .../dal/mysql/template/DiyTemplateMapper.java | 32 ++++ .../service/padiyge/DiyPageService.java | 66 +++++++ .../service/padiyge/DiyPageServiceImpl.java | 84 +++++++++ .../service/template/DiyTemplateService.java | 63 +++++++ .../template/DiyTemplateServiceImpl.java | 100 ++++++++++ .../padiyge/DiyPageServiceImplTest.java | 128 +++++++++++++ .../template/DiyTemplateServiceImplTest.java | 175 ++++++++++++++++++ .../src/test/resources/sql/clean.sql | 8 +- .../src/test/resources/sql/create_tables.sql | 37 +++- 28 files changed, 1385 insertions(+), 7 deletions(-) create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/DiyPageController.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPageBaseVO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPageCreateReqVO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPagePageReqVO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPageRespVO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPageUpdateReqVO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/DiyTemplateController.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplateBaseVO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplateCreateReqVO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplatePageReqVO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplateRespVO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplateUpdateReqVO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/padiyge/DiyPageConvert.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/template/DiyTemplateConvert.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/padiyge/DiyPageDO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/template/DiyTemplateDO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/padiyge/DiyPageMapper.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/template/DiyTemplateMapper.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/padiyge/DiyPageService.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/padiyge/DiyPageServiceImpl.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/template/DiyTemplateService.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/template/DiyTemplateServiceImpl.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/padiyge/DiyPageServiceImplTest.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/template/DiyTemplateServiceImplTest.java diff --git a/sql/mysql/mall.sql b/sql/mysql/mall.sql index 70ce52af4..050e4e6b5 100644 --- a/sql/mysql/mall.sql +++ b/sql/mysql/mall.sql @@ -1,2 +1,83 @@ INSERT INTO system_menu (name, permission, type, sort, parent_id, path, icon, component, component_name) -VALUES ('核销订单', '', 2, 2, 2166, 'pick-up-order', 'ep:list', 'mall/trade/delivery/pickUpOrder/index', 'PickUpOrder'); \ No newline at end of file +VALUES ('核销订单', '', 2, 2, 2166, 'pick-up-order', 'ep:list', 'mall/trade/delivery/pickUpOrder/index', 'PickUpOrder'); + +CREATE TABLE promotion_diy_template +( + id bigint AUTO_INCREMENT COMMENT '装修模板编号' + PRIMARY KEY, + name varchar(100) NOT NULL COMMENT '模板名称', + used bit DEFAULT b'0' NOT NULL COMMENT '是否使用', + used_time datetime NULL COMMENT '使用时间', + remark varchar(255) NULL COMMENT '备注', + preview_image_urls varchar(2000) NULL COMMENT '预览图,多个逗号分隔', + property varchar(2000) NULL COMMENT '页面属性,JSON 格式', + creator varchar(64) DEFAULT '' NULL COMMENT '创建者', + create_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间', + updater varchar(64) DEFAULT '' NULL COMMENT '更新者', + update_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + deleted bit DEFAULT b'0' NOT NULL COMMENT '是否删除', + tenant_id bigint DEFAULT 0 NOT NULL COMMENT '租户编号' +) + COMMENT '装修模板'; + +-- 菜单 SQL +INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status, component_name) +VALUES ('装修模板', '', 2, 20, 2030, 'diy-template', 'fa6-solid:brush', 'mall/promotion/diy/template/index', 0, 'DiyTemplate'); + +-- 按钮父菜单ID +-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码 +SELECT @parentId := LAST_INSERT_ID(); + +-- 按钮 SQL +INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status) +VALUES ('装修模板查询', 'promotion:diy-template:query', 3, 1, @parentId, '', '', '', 0); +INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status) +VALUES ('装修模板创建', 'promotion:diy-template:create', 3, 2, @parentId, '', '', '', 0); +INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status) +VALUES ('装修模板更新', 'promotion:diy-template:update', 3, 3, @parentId, '', '', '', 0); +INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status) +VALUES ('装修模板删除', 'promotion:diy-template:delete', 3, 4, @parentId, '', '', '', 0); +INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status) +VALUES ('装修模板使用', 'promotion:diy-template:use', 3, 5, @parentId, '', '', '', 0);; + + + +CREATE TABLE promotion_diy_page +( + id bigint AUTO_INCREMENT COMMENT '装修页面编号' + PRIMARY KEY, + template_id bigint NULL COMMENT '装修模板编号', + name varchar(100) NOT NULL COMMENT '页面名称', + remark varchar(255) NULL COMMENT '备注', + preview_image_urls varchar(2000) NULL COMMENT '预览图,多个逗号分隔', + property varchar(2000) NULL COMMENT '页面属性,JSON 格式', + creator varchar(64) DEFAULT '' NULL COMMENT '创建者', + create_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间', + updater varchar(64) DEFAULT '' NULL COMMENT '更新者', + update_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + deleted bit DEFAULT b'0' NOT NULL COMMENT '是否删除', + tenant_id bigint DEFAULT 0 NOT NULL COMMENT '租户编号' +) + COMMENT '装修页面'; + +CREATE INDEX idx_template_id ON promotion_diy_page (template_id); + +-- 菜单 SQL +INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status, component_name) +VALUES ('装修页面', '', 2, 21, 2030, 'diy-page', 'foundation:page-edit', 'mall/promotion/diy/page/index', 0, 'DiyPage'); + +-- 按钮父菜单ID +-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码 +SELECT @parentId := LAST_INSERT_ID(); + +-- 按钮 SQL +INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status) +VALUES ('装修页面查询', 'promotion:diy-page:query', 3, 1, @parentId, '', '', '', 0); +INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status) +VALUES ('装修页面创建', 'promotion:diy-page:create', 3, 2, @parentId, '', '', '', 0); +INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status) +VALUES ('装修页面更新', 'promotion:diy-page:update', 3, 3, @parentId, '', '', '', 0); +INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status) +VALUES ('装修页面删除', 'promotion:diy-page:delete', 3, 4, @parentId, '', '', '', 0); +INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status) +VALUES ('装修页面导出', 'promotion:diy-page:export', 3, 5, @parentId, '', '', '', 0); \ No newline at end of file diff --git a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/ErrorCodeConstants.java b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/ErrorCodeConstants.java index 0755f71c4..7000bcc59 100644 --- a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/ErrorCodeConstants.java +++ b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/ErrorCodeConstants.java @@ -116,4 +116,11 @@ public interface ErrorCodeConstants { // ========== 文章管理 1-013-016-000 ========== ErrorCode ARTICLE_NOT_EXISTS = new ErrorCode(1_013_016_000, "文章不存在"); + // ========== 装修模板 1-013-017-000 ========== + ErrorCode DIY_TEMPLATE_NOT_EXISTS = new ErrorCode(1_013_017_000, "装修模板不存在"); + ErrorCode DIY_TEMPLATE_USED_CANNOT_DELETE = new ErrorCode(1_013_017_001, "不能删除正在使用的装修模板"); + + // ========== 装修页面 1-013-018-000 ========== + ErrorCode DIY_PAGE_NOT_EXISTS = new ErrorCode(1_013_018_000, "装修页面不存在"); + } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/DiyPageController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/DiyPageController.java new file mode 100644 index 000000000..e49bba327 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/DiyPageController.java @@ -0,0 +1,85 @@ +package cn.iocoder.yudao.module.promotion.controller.admin.padiyge; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPageCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPagePageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPageRespVO; +import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPageUpdateReqVO; +import cn.iocoder.yudao.module.promotion.convert.padiyge.DiyPageConvert; +import cn.iocoder.yudao.module.promotion.dal.dataobject.padiyge.DiyPageDO; +import cn.iocoder.yudao.module.promotion.service.padiyge.DiyPageService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.Valid; +import java.util.Collection; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - 装修页面") +@RestController +@RequestMapping("/promotion/diy-page") +@Validated +public class DiyPageController { + + @Resource + private DiyPageService diyPageService; + + @PostMapping("/create") + @Operation(summary = "创建装修页面") + @PreAuthorize("@ss.hasPermission('promotion:diy-page:create')") + public CommonResult createDiyPage(@Valid @RequestBody DiyPageCreateReqVO createReqVO) { + return success(diyPageService.createDiyPage(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新装修页面") + @PreAuthorize("@ss.hasPermission('promotion:diy-page:update')") + public CommonResult updateDiyPage(@Valid @RequestBody DiyPageUpdateReqVO updateReqVO) { + diyPageService.updateDiyPage(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除装修页面") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('promotion:diy-page:delete')") + public CommonResult deleteDiyPage(@RequestParam("id") Long id) { + diyPageService.deleteDiyPage(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得装修页面") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('promotion:diy-page:query')") + public CommonResult getDiyPage(@RequestParam("id") Long id) { + DiyPageDO diyPage = diyPageService.getDiyPage(id); + return success(DiyPageConvert.INSTANCE.convert(diyPage)); + } + + @GetMapping("/list") + @Operation(summary = "获得装修页面列表") + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") + @PreAuthorize("@ss.hasPermission('promotion:diy-page:query')") + public CommonResult> getDiyPageList(@RequestParam("ids") Collection ids) { + List list = diyPageService.getDiyPageList(ids); + return success(DiyPageConvert.INSTANCE.convertList(list)); + } + + @GetMapping("/page") + @Operation(summary = "获得装修页面分页") + @PreAuthorize("@ss.hasPermission('promotion:diy-page:query')") + public CommonResult> getDiyPagePage(@Valid DiyPagePageReqVO pageVO) { + PageResult pageResult = diyPageService.getDiyPagePage(pageVO); + return success(DiyPageConvert.INSTANCE.convertPage(pageResult)); + } + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPageBaseVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPageBaseVO.java new file mode 100644 index 000000000..e9c086f49 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPageBaseVO.java @@ -0,0 +1,29 @@ +package cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * 装修页面 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + */ +@Data +public class DiyPageBaseVO { + + @Schema(description = "装修模板编号", example = "26179") + private Long templateId; + + @Schema(description = "页面名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") + @NotNull(message = "页面名称不能为空") + private String name; + + @Schema(description = "备注", example = "随便") + private String remark; + + @Schema(description = "预览图") + private List previewImageUrls; + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPageCreateReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPageCreateReqVO.java new file mode 100644 index 000000000..6b20cccac --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPageCreateReqVO.java @@ -0,0 +1,14 @@ +package cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Schema(description = "管理后台 - 装修页面创建 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class DiyPageCreateReqVO extends DiyPageBaseVO { + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPagePageReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPagePageReqVO.java new file mode 100644 index 000000000..af17a2ec0 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPagePageReqVO.java @@ -0,0 +1,27 @@ +package cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 装修页面分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class DiyPagePageReqVO extends PageParam { + + @Schema(description = "页面名称", example = "王五") + private String name; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPageRespVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPageRespVO.java new file mode 100644 index 000000000..51bd5b3da --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPageRespVO.java @@ -0,0 +1,22 @@ +package cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 装修页面 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class DiyPageRespVO extends DiyPageBaseVO { + + @Schema(description = "装修页面编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "12082") + private Long id; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime createTime; + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPageUpdateReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPageUpdateReqVO.java new file mode 100644 index 000000000..ddfd99d79 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPageUpdateReqVO.java @@ -0,0 +1,20 @@ +package cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import javax.validation.constraints.NotNull; + +@Schema(description = "管理后台 - 装修页面更新 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class DiyPageUpdateReqVO extends DiyPageBaseVO { + + @Schema(description = "装修页面编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "12082") + @NotNull(message = "装修页面编号不能为空") + private Long id; + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/DiyTemplateController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/DiyTemplateController.java new file mode 100644 index 000000000..651781709 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/DiyTemplateController.java @@ -0,0 +1,82 @@ +package cn.iocoder.yudao.module.promotion.controller.admin.template; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.DiyTemplateCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.DiyTemplatePageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.DiyTemplateRespVO; +import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.DiyTemplateUpdateReqVO; +import cn.iocoder.yudao.module.promotion.convert.template.DiyTemplateConvert; +import cn.iocoder.yudao.module.promotion.dal.dataobject.template.DiyTemplateDO; +import cn.iocoder.yudao.module.promotion.service.template.DiyTemplateService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.Valid; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - 装修模板") +@RestController +@RequestMapping("/promotion/diy-template") +@Validated +public class DiyTemplateController { + + @Resource + private DiyTemplateService diyTemplateService; + + @PostMapping("/create") + @Operation(summary = "创建装修模板") + @PreAuthorize("@ss.hasPermission('promotion:diy-template:create')") + public CommonResult createDiyTemplate(@Valid @RequestBody DiyTemplateCreateReqVO createReqVO) { + return success(diyTemplateService.createDiyTemplate(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新装修模板") + @PreAuthorize("@ss.hasPermission('promotion:diy-template:update')") + public CommonResult updateDiyTemplate(@Valid @RequestBody DiyTemplateUpdateReqVO updateReqVO) { + diyTemplateService.updateDiyTemplate(updateReqVO); + return success(true); + } + + @PutMapping("/use") + @Operation(summary = "使用装修模板") + @PreAuthorize("@ss.hasPermission('promotion:diy-template:use')") + public CommonResult useDiyTemplate(@RequestParam("id") Long id) { + diyTemplateService.useDiyTemplate(id); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除装修模板") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('promotion:diy-template:delete')") + public CommonResult deleteDiyTemplate(@RequestParam("id") Long id) { + diyTemplateService.deleteDiyTemplate(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得装修模板") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('promotion:diy-template:query')") + public CommonResult getDiyTemplate(@RequestParam("id") Long id) { + DiyTemplateDO diyTemplate = diyTemplateService.getDiyTemplate(id); + return success(DiyTemplateConvert.INSTANCE.convert(diyTemplate)); + } + + @GetMapping("/page") + @Operation(summary = "获得装修模板分页") + @PreAuthorize("@ss.hasPermission('promotion:diy-template:query')") + public CommonResult> getDiyTemplatePage(@Valid DiyTemplatePageReqVO pageVO) { + PageResult pageResult = diyTemplateService.getDiyTemplatePage(pageVO); + return success(DiyTemplateConvert.INSTANCE.convertPage(pageResult)); + } + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplateBaseVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplateBaseVO.java new file mode 100644 index 000000000..bdc51a1bb --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplateBaseVO.java @@ -0,0 +1,29 @@ +package cn.iocoder.yudao.module.promotion.controller.admin.template.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * 装修模板 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + */ +@Data +public class DiyTemplateBaseVO { + + @Schema(description = "模板名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "默认主题") + @NotNull(message = "模板名称不能为空") + private String name; + + @Schema(description = "备注", example = "默认主题") + private String remark; + + @Schema(description = "预览图", example = "[https://www.iocoder.cn/1.jpg]") + private List previewImageUrls; + + @Schema(description = "模板属性,JSON 格式", requiredMode = Schema.RequiredMode.REQUIRED, example = "{}") + private String property; + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplateCreateReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplateCreateReqVO.java new file mode 100644 index 000000000..96506c7cb --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplateCreateReqVO.java @@ -0,0 +1,14 @@ +package cn.iocoder.yudao.module.promotion.controller.admin.template.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Schema(description = "管理后台 - 装修模板创建 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class DiyTemplateCreateReqVO extends DiyTemplateBaseVO { + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplatePageReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplatePageReqVO.java new file mode 100644 index 000000000..120ca0911 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplatePageReqVO.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.module.promotion.controller.admin.template.vo; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 装修模板分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class DiyTemplatePageReqVO extends PageParam { + + @Schema(description = "模板名称", example = "默认主题") + private String name; + + @Schema(description = "是否使用", example = "true") + private Boolean used; + + @Schema(description = "使用时间", example = "使用时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] usedTime; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplateRespVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplateRespVO.java new file mode 100644 index 000000000..b7bd4b5b7 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplateRespVO.java @@ -0,0 +1,28 @@ +package cn.iocoder.yudao.module.promotion.controller.admin.template.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 装修模板 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class DiyTemplateRespVO extends DiyTemplateBaseVO { + + @Schema(description = "装修模板编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "31209") + private Long id; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime createTime; + + @Schema(description = "是否使用", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") + private Boolean used; + + @Schema(description = "使用时间", example = "使用时间") + private LocalDateTime usedTime; + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplateUpdateReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplateUpdateReqVO.java new file mode 100644 index 000000000..b7ec68e51 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplateUpdateReqVO.java @@ -0,0 +1,20 @@ +package cn.iocoder.yudao.module.promotion.controller.admin.template.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import javax.validation.constraints.NotNull; + +@Schema(description = "管理后台 - 装修模板更新 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class DiyTemplateUpdateReqVO extends DiyTemplateBaseVO { + + @Schema(description = "装修模板编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "31209") + @NotNull(message = "装修模板编号不能为空") + private Long id; + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/padiyge/DiyPageConvert.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/padiyge/DiyPageConvert.java new file mode 100644 index 000000000..2fe6124e6 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/padiyge/DiyPageConvert.java @@ -0,0 +1,33 @@ +package cn.iocoder.yudao.module.promotion.convert.padiyge; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPageCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPageRespVO; +import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPageUpdateReqVO; +import cn.iocoder.yudao.module.promotion.dal.dataobject.padiyge.DiyPageDO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +/** + * 装修页面 Convert + * + * @author owen + */ +@Mapper +public interface DiyPageConvert { + + DiyPageConvert INSTANCE = Mappers.getMapper(DiyPageConvert.class); + + DiyPageDO convert(DiyPageCreateReqVO bean); + + DiyPageDO convert(DiyPageUpdateReqVO bean); + + DiyPageRespVO convert(DiyPageDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/template/DiyTemplateConvert.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/template/DiyTemplateConvert.java new file mode 100644 index 000000000..8da831700 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/template/DiyTemplateConvert.java @@ -0,0 +1,31 @@ +package cn.iocoder.yudao.module.promotion.convert.template; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.*; +import cn.iocoder.yudao.module.promotion.dal.dataobject.template.DiyTemplateDO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +/** + * 装修模板 Convert + * + * @author owen + */ +@Mapper +public interface DiyTemplateConvert { + + DiyTemplateConvert INSTANCE = Mappers.getMapper(DiyTemplateConvert.class); + + DiyTemplateDO convert(DiyTemplateCreateReqVO bean); + + DiyTemplateDO convert(DiyTemplateUpdateReqVO bean); + + DiyTemplateRespVO convert(DiyTemplateDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/padiyge/DiyPageDO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/padiyge/DiyPageDO.java new file mode 100644 index 000000000..34cf3325f --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/padiyge/DiyPageDO.java @@ -0,0 +1,55 @@ +package cn.iocoder.yudao.module.promotion.dal.dataobject.padiyge; + +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import cn.iocoder.yudao.framework.mybatis.core.type.StringListTypeHandler; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; + +import java.util.List; + +/** + * 装修页面 DO + * + * @author owen + */ +@TableName(value = "promotion_diy_page", autoResultMap = true) +@KeySequence("promotion_diy_page_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class DiyPageDO extends BaseDO { + + /** + * 装修页面编号 + */ + @TableId + private Long id; + /** + * 装修模板编号 + */ + private Long templateId; + /** + * 页面名称 + */ + private String name; + /** + * 备注 + */ + private String remark; + /** + * 预览图,多个逗号分隔 + */ + @TableField(typeHandler = StringListTypeHandler.class) + private List previewImageUrls; + /** + * 页面属性,JSON 格式 + */ + private String property; + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/template/DiyTemplateDO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/template/DiyTemplateDO.java new file mode 100644 index 000000000..682cad0ba --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/template/DiyTemplateDO.java @@ -0,0 +1,60 @@ +package cn.iocoder.yudao.module.promotion.dal.dataobject.template; + +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import cn.iocoder.yudao.framework.mybatis.core.type.StringListTypeHandler; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * 装修模板 DO + * + * @author owen + */ +@TableName(value = "promotion_diy_template", autoResultMap = true) +@KeySequence("promotion_diy_template_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class DiyTemplateDO extends BaseDO { + + /** + * 装修模板编号 + */ + @TableId + private Long id; + /** + * 模板名称 + */ + private String name; + /** + * 是否使用 + */ + private Boolean used; + /** + * 使用时间 + */ + private LocalDateTime usedTime; + /** + * 备注 + */ + private String remark; + /** + * 预览图 + */ + @TableField(typeHandler = StringListTypeHandler.class) + private List previewImageUrls; + /** + * 底部导航属性,JSON 格式 + */ + private String property; + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/padiyge/DiyPageMapper.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/padiyge/DiyPageMapper.java new file mode 100644 index 000000000..bc04e6ce0 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/padiyge/DiyPageMapper.java @@ -0,0 +1,26 @@ +package cn.iocoder.yudao.module.promotion.dal.mysql.padiyge; + +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; +import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPagePageReqVO; +import cn.iocoder.yudao.module.promotion.dal.dataobject.padiyge.DiyPageDO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 装修页面 Mapper + * + * @author owen + */ +@Mapper +public interface DiyPageMapper extends BaseMapperX { + + default PageResult selectPage(DiyPagePageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(DiyPageDO::getName, reqVO.getName()) + .betweenIfPresent(DiyPageDO::getCreateTime, reqVO.getCreateTime()) + .isNull(DiyPageDO::getTemplateId) + .orderByDesc(DiyPageDO::getId)); + } + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/template/DiyTemplateMapper.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/template/DiyTemplateMapper.java new file mode 100644 index 000000000..0351cfb1b --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/template/DiyTemplateMapper.java @@ -0,0 +1,32 @@ +package cn.iocoder.yudao.module.promotion.dal.mysql.template; + +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; +import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.DiyTemplatePageReqVO; +import cn.iocoder.yudao.module.promotion.dal.dataobject.template.DiyTemplateDO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 装修模板 Mapper + * + * @author owen + */ +@Mapper +public interface DiyTemplateMapper extends BaseMapperX { + + default PageResult selectPage(DiyTemplatePageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(DiyTemplateDO::getName, reqVO.getName()) + .eqIfPresent(DiyTemplateDO::getUsed, reqVO.getUsed()) + .betweenIfPresent(DiyTemplateDO::getUsedTime, reqVO.getUsedTime()) + .betweenIfPresent(DiyTemplateDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(DiyTemplateDO::getUsed) // 排序规则1:已使用的排到最前面 + .orderByDesc(DiyTemplateDO::getId)); // 排序规则2:新创建的排到前面 + } + + default DiyTemplateDO selectByUsed(boolean used) { + return selectOne(DiyTemplateDO::getUsed, used); + } + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/padiyge/DiyPageService.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/padiyge/DiyPageService.java new file mode 100644 index 000000000..0e3011c98 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/padiyge/DiyPageService.java @@ -0,0 +1,66 @@ +package cn.iocoder.yudao.module.promotion.service.padiyge; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPageCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPagePageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPageUpdateReqVO; +import cn.iocoder.yudao.module.promotion.dal.dataobject.padiyge.DiyPageDO; + +import javax.validation.Valid; +import java.util.Collection; +import java.util.List; + +/** + * 装修页面 Service 接口 + * + * @author owen + */ +public interface DiyPageService { + + /** + * 创建装修页面 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createDiyPage(@Valid DiyPageCreateReqVO createReqVO); + + /** + * 更新装修页面 + * + * @param updateReqVO 更新信息 + */ + void updateDiyPage(@Valid DiyPageUpdateReqVO updateReqVO); + + /** + * 删除装修页面 + * + * @param id 编号 + */ + void deleteDiyPage(Long id); + + /** + * 获得装修页面 + * + * @param id 编号 + * @return 装修页面 + */ + DiyPageDO getDiyPage(Long id); + + /** + * 获得装修页面列表 + * + * @param ids 编号 + * @return 装修页面列表 + */ + List getDiyPageList(Collection ids); + + /** + * 获得装修页面分页 + * + * @param pageReqVO 分页查询 + * @return 装修页面分页 + */ + PageResult getDiyPagePage(DiyPagePageReqVO pageReqVO); + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/padiyge/DiyPageServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/padiyge/DiyPageServiceImpl.java new file mode 100644 index 000000000..28bef36a0 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/padiyge/DiyPageServiceImpl.java @@ -0,0 +1,84 @@ +package cn.iocoder.yudao.module.promotion.service.padiyge; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.ListUtil; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPageCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPagePageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPageUpdateReqVO; +import cn.iocoder.yudao.module.promotion.convert.padiyge.DiyPageConvert; +import cn.iocoder.yudao.module.promotion.dal.dataobject.padiyge.DiyPageDO; +import cn.iocoder.yudao.module.promotion.dal.mysql.padiyge.DiyPageMapper; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.Collection; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.DIY_PAGE_NOT_EXISTS; + +/** + * 装修页面 Service 实现类 + * + * @author owen + */ +@Service +@Validated +public class DiyPageServiceImpl implements DiyPageService { + + @Resource + private DiyPageMapper diyPageMapper; + + @Override + public Long createDiyPage(DiyPageCreateReqVO createReqVO) { + // 插入 + DiyPageDO diyPage = DiyPageConvert.INSTANCE.convert(createReqVO); + diyPageMapper.insert(diyPage); + // 返回 + return diyPage.getId(); + } + + @Override + public void updateDiyPage(DiyPageUpdateReqVO updateReqVO) { + // 校验存在 + validateDiyPageExists(updateReqVO.getId()); + // 更新 + DiyPageDO updateObj = DiyPageConvert.INSTANCE.convert(updateReqVO); + diyPageMapper.updateById(updateObj); + } + + @Override + public void deleteDiyPage(Long id) { + // 校验存在 + validateDiyPageExists(id); + // 删除 + diyPageMapper.deleteById(id); + } + + private void validateDiyPageExists(Long id) { + if (diyPageMapper.selectById(id) == null) { + throw exception(DIY_PAGE_NOT_EXISTS); + } + } + + @Override + public DiyPageDO getDiyPage(Long id) { + return diyPageMapper.selectById(id); + } + + @Override + public List getDiyPageList(Collection ids) { + if (CollUtil.isEmpty(ids)) { + return ListUtil.empty(); + } + return diyPageMapper.selectBatchIds(ids); + } + + @Override + public PageResult getDiyPagePage(DiyPagePageReqVO pageReqVO) { + return diyPageMapper.selectPage(pageReqVO); + } + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/template/DiyTemplateService.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/template/DiyTemplateService.java new file mode 100644 index 000000000..130ad9f21 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/template/DiyTemplateService.java @@ -0,0 +1,63 @@ +package cn.iocoder.yudao.module.promotion.service.template; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.DiyTemplateCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.DiyTemplatePageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.DiyTemplateUpdateReqVO; +import cn.iocoder.yudao.module.promotion.dal.dataobject.template.DiyTemplateDO; + +import javax.validation.Valid; + +/** + * 装修模板 Service 接口 + * + * @author owen + */ +public interface DiyTemplateService { + + /** + * 创建装修模板 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createDiyTemplate(@Valid DiyTemplateCreateReqVO createReqVO); + + /** + * 更新装修模板 + * + * @param updateReqVO 更新信息 + */ + void updateDiyTemplate(@Valid DiyTemplateUpdateReqVO updateReqVO); + + /** + * 删除装修模板 + * + * @param id 编号 + */ + void deleteDiyTemplate(Long id); + + /** + * 获得装修模板 + * + * @param id 编号 + * @return 装修模板 + */ + DiyTemplateDO getDiyTemplate(Long id); + + /** + * 获得装修模板分页 + * + * @param pageReqVO 分页查询 + * @return 装修模板分页 + */ + PageResult getDiyTemplatePage(DiyTemplatePageReqVO pageReqVO); + + /** + * 使用装修模板 + * + * @param id 编号 + */ + void useDiyTemplate(Long id); + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/template/DiyTemplateServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/template/DiyTemplateServiceImpl.java new file mode 100644 index 000000000..334b166aa --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/template/DiyTemplateServiceImpl.java @@ -0,0 +1,100 @@ +package cn.iocoder.yudao.module.promotion.service.template; + +import cn.hutool.core.util.BooleanUtil; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.DiyTemplateCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.DiyTemplatePageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.DiyTemplateUpdateReqVO; +import cn.iocoder.yudao.module.promotion.convert.template.DiyTemplateConvert; +import cn.iocoder.yudao.module.promotion.dal.dataobject.template.DiyTemplateDO; +import cn.iocoder.yudao.module.promotion.dal.mysql.template.DiyTemplateMapper; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.DIY_TEMPLATE_NOT_EXISTS; +import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.DIY_TEMPLATE_USED_CANNOT_DELETE; + +/** + * 装修模板 Service 实现类 + * + * @author owen + */ +@Service +@Validated +public class DiyTemplateServiceImpl implements DiyTemplateService { + + @Resource + private DiyTemplateMapper diyTemplateMapper; + + @Override + public Long createDiyTemplate(DiyTemplateCreateReqVO createReqVO) { + // 插入 + DiyTemplateDO diyTemplate = DiyTemplateConvert.INSTANCE.convert(createReqVO); + diyTemplateMapper.insert(diyTemplate); + // 返回 + return diyTemplate.getId(); + } + + @Override + public void updateDiyTemplate(DiyTemplateUpdateReqVO updateReqVO) { + // 校验存在 + validateDiyTemplateExists(updateReqVO.getId()); + // 更新 + DiyTemplateDO updateObj = DiyTemplateConvert.INSTANCE.convert(updateReqVO); + diyTemplateMapper.updateById(updateObj); + } + + @Override + public void deleteDiyTemplate(Long id) { + // 校验存在 + DiyTemplateDO diyTemplateDO = validateDiyTemplateExists(id); + // 校验使用中 + if (BooleanUtil.isTrue(diyTemplateDO.getUsed())) { + throw exception(DIY_TEMPLATE_USED_CANNOT_DELETE); + } + // 删除 + diyTemplateMapper.deleteById(id); + } + + private DiyTemplateDO validateDiyTemplateExists(Long id) { + DiyTemplateDO diyTemplateDO = diyTemplateMapper.selectById(id); + if (diyTemplateDO == null) { + throw exception(DIY_TEMPLATE_NOT_EXISTS); + } + return diyTemplateDO; + } + + @Override + public DiyTemplateDO getDiyTemplate(Long id) { + return diyTemplateMapper.selectById(id); + } + + @Override + public PageResult getDiyTemplatePage(DiyTemplatePageReqVO pageReqVO) { + return diyTemplateMapper.selectPage(pageReqVO); + } + + @Override + public void useDiyTemplate(Long id) { + // 校验存在 + validateDiyTemplateExists(id); + // 已使用的更新为未使用 + DiyTemplateDO used = diyTemplateMapper.selectByUsed(true); + if (used != null) { + this.updateUsed(used.getId(), false, null); + } + // 更新为已使用 + this.updateUsed(id, true, LocalDateTime.now()); + } + + private void updateUsed(Long id, Boolean used, LocalDateTime usedTime) { + DiyTemplateDO updateObj = new DiyTemplateDO().setId(id) + .setUsed(used).setUsedTime(usedTime); + diyTemplateMapper.updateById(updateObj); + } + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/padiyge/DiyPageServiceImplTest.java b/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/padiyge/DiyPageServiceImplTest.java new file mode 100644 index 000000000..e0702248a --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/padiyge/DiyPageServiceImplTest.java @@ -0,0 +1,128 @@ +package cn.iocoder.yudao.module.promotion.service.padiyge; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; +import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPageCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPagePageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPageUpdateReqVO; +import cn.iocoder.yudao.module.promotion.dal.dataobject.padiyge.DiyPageDO; +import cn.iocoder.yudao.module.promotion.dal.mysql.padiyge.DiyPageMapper; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.springframework.context.annotation.Import; + +import javax.annotation.Resource; + +import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; +import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.DIY_PAGE_NOT_EXISTS; +import static org.junit.jupiter.api.Assertions.*; + +/** + * {@link DiyPageServiceImpl} 的单元测试类 + * + * @author owen + */ +@Import(DiyPageServiceImpl.class) +public class DiyPageServiceImplTest extends BaseDbUnitTest { + + @Resource + private DiyPageServiceImpl diyPageService; + + @Resource + private DiyPageMapper diyPageMapper; + + @Test + public void testCreateDiyPage_success() { + // 准备参数 + DiyPageCreateReqVO reqVO = randomPojo(DiyPageCreateReqVO.class); + + // 调用 + Long diyPageId = diyPageService.createDiyPage(reqVO); + // 断言 + assertNotNull(diyPageId); + // 校验记录的属性是否正确 + DiyPageDO diyPage = diyPageMapper.selectById(diyPageId); + assertPojoEquals(reqVO, diyPage); + } + + @Test + public void testUpdateDiyPage_success() { + // mock 数据 + DiyPageDO dbDiyPage = randomPojo(DiyPageDO.class); + diyPageMapper.insert(dbDiyPage);// @Sql: 先插入出一条存在的数据 + // 准备参数 + DiyPageUpdateReqVO reqVO = randomPojo(DiyPageUpdateReqVO.class, o -> { + o.setId(dbDiyPage.getId()); // 设置更新的 ID + }); + + // 调用 + diyPageService.updateDiyPage(reqVO); + // 校验是否更新正确 + DiyPageDO diyPage = diyPageMapper.selectById(reqVO.getId()); // 获取最新的 + assertPojoEquals(reqVO, diyPage); + } + + @Test + public void testUpdateDiyPage_notExists() { + // 准备参数 + DiyPageUpdateReqVO reqVO = randomPojo(DiyPageUpdateReqVO.class); + + // 调用, 并断言异常 + assertServiceException(() -> diyPageService.updateDiyPage(reqVO), DIY_PAGE_NOT_EXISTS); + } + + @Test + public void testDeleteDiyPage_success() { + // mock 数据 + DiyPageDO dbDiyPage = randomPojo(DiyPageDO.class); + diyPageMapper.insert(dbDiyPage);// @Sql: 先插入出一条存在的数据 + // 准备参数 + Long id = dbDiyPage.getId(); + + // 调用 + diyPageService.deleteDiyPage(id); + // 校验数据不存在了 + assertNull(diyPageMapper.selectById(id)); + } + + @Test + public void testDeleteDiyPage_notExists() { + // 准备参数 + Long id = randomLongId(); + + // 调用, 并断言异常 + assertServiceException(() -> diyPageService.deleteDiyPage(id), DIY_PAGE_NOT_EXISTS); + } + + @Test + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 + public void testGetDiyPagePage() { + // mock 数据 + DiyPageDO dbDiyPage = randomPojo(DiyPageDO.class, o -> { // 等会查询到 + o.setName(null); + o.setCreateTime(null); + }); + diyPageMapper.insert(dbDiyPage); + // 测试 name 不匹配 + diyPageMapper.insert(cloneIgnoreId(dbDiyPage, o -> o.setName(null))); + // 测试 createTime 不匹配 + diyPageMapper.insert(cloneIgnoreId(dbDiyPage, o -> o.setCreateTime(null))); + // 准备参数 + DiyPagePageReqVO reqVO = new DiyPagePageReqVO(); + reqVO.setName(null); + reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); + + // 调用 + PageResult pageResult = diyPageService.getDiyPagePage(reqVO); + // 断言 + assertEquals(1, pageResult.getTotal()); + assertEquals(1, pageResult.getList().size()); + assertPojoEquals(dbDiyPage, pageResult.getList().get(0)); + } + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/template/DiyTemplateServiceImplTest.java b/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/template/DiyTemplateServiceImplTest.java new file mode 100644 index 000000000..a72245801 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/template/DiyTemplateServiceImplTest.java @@ -0,0 +1,175 @@ +package cn.iocoder.yudao.module.promotion.service.template; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; +import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.DiyTemplateCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.DiyTemplatePageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.DiyTemplateUpdateReqVO; +import cn.iocoder.yudao.module.promotion.dal.dataobject.template.DiyTemplateDO; +import cn.iocoder.yudao.module.promotion.dal.mysql.template.DiyTemplateMapper; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.springframework.context.annotation.Import; + +import javax.annotation.Resource; + +import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; +import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.DIY_TEMPLATE_NOT_EXISTS; +import static org.junit.jupiter.api.Assertions.*; + +/** + * {@link DiyTemplateServiceImpl} 的单元测试类 + * + * @author owen + */ +@Import(DiyTemplateServiceImpl.class) +public class DiyTemplateServiceImplTest extends BaseDbUnitTest { + + @Resource + private DiyTemplateServiceImpl diyTemplateService; + + @Resource + private DiyTemplateMapper diyTemplateMapper; + + @Test + public void testCreateDiyTemplate_success() { + // 准备参数 + DiyTemplateCreateReqVO reqVO = randomPojo(DiyTemplateCreateReqVO.class); + + // 调用 + Long diyTemplateId = diyTemplateService.createDiyTemplate(reqVO); + // 断言 + assertNotNull(diyTemplateId); + // 校验记录的属性是否正确 + DiyTemplateDO diyTemplate = diyTemplateMapper.selectById(diyTemplateId); + assertPojoEquals(reqVO, diyTemplate); + } + + @Test + public void testUpdateDiyTemplate_success() { + // mock 数据 + DiyTemplateDO dbDiyTemplate = randomPojo(DiyTemplateDO.class); + diyTemplateMapper.insert(dbDiyTemplate);// @Sql: 先插入出一条存在的数据 + // 准备参数 + DiyTemplateUpdateReqVO reqVO = randomPojo(DiyTemplateUpdateReqVO.class, o -> { + o.setId(dbDiyTemplate.getId()); // 设置更新的 ID + }); + + // 调用 + diyTemplateService.updateDiyTemplate(reqVO); + // 校验是否更新正确 + DiyTemplateDO diyTemplate = diyTemplateMapper.selectById(reqVO.getId()); // 获取最新的 + assertPojoEquals(reqVO, diyTemplate); + } + + @Test + public void testUpdateDiyTemplate_notExists() { + // 准备参数 + DiyTemplateUpdateReqVO reqVO = randomPojo(DiyTemplateUpdateReqVO.class); + + // 调用, 并断言异常 + assertServiceException(() -> diyTemplateService.updateDiyTemplate(reqVO), DIY_TEMPLATE_NOT_EXISTS); + } + + @Test + public void testDeleteDiyTemplate_success() { + // mock 数据 + DiyTemplateDO dbDiyTemplate = randomPojo(DiyTemplateDO.class); + diyTemplateMapper.insert(dbDiyTemplate);// @Sql: 先插入出一条存在的数据 + // 准备参数 + Long id = dbDiyTemplate.getId(); + + // 调用 + diyTemplateService.deleteDiyTemplate(id); + // 校验数据不存在了 + assertNull(diyTemplateMapper.selectById(id)); + } + + @Test + public void testDeleteDiyTemplate_notExists() { + // 准备参数 + Long id = randomLongId(); + + // 调用, 并断言异常 + assertServiceException(() -> diyTemplateService.deleteDiyTemplate(id), DIY_TEMPLATE_NOT_EXISTS); + } + + @Test + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 + public void testGetDiyTemplatePage() { + // mock 数据 + DiyTemplateDO dbDiyTemplate = randomPojo(DiyTemplateDO.class, o -> { // 等会查询到 + o.setName(null); + o.setUsed(null); + o.setUsedTime(null); + o.setRemark(null); + o.setPreviewImageUrls(null); + o.setProperty(null); + o.setCreateTime(null); + }); + diyTemplateMapper.insert(dbDiyTemplate); + // 测试 name 不匹配 + diyTemplateMapper.insert(cloneIgnoreId(dbDiyTemplate, o -> o.setName(null))); + // 测试 used 不匹配 + diyTemplateMapper.insert(cloneIgnoreId(dbDiyTemplate, o -> o.setUsed(null))); + // 测试 usedTime 不匹配 + 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))); + // 测试 property 不匹配 + diyTemplateMapper.insert(cloneIgnoreId(dbDiyTemplate, o -> o.setProperty(null))); + // 测试 createTime 不匹配 + diyTemplateMapper.insert(cloneIgnoreId(dbDiyTemplate, o -> o.setCreateTime(null))); + // 准备参数 + DiyTemplatePageReqVO reqVO = new DiyTemplatePageReqVO(); + reqVO.setName(null); + reqVO.setUsed(null); + reqVO.setUsedTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); + reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); + + // 调用 + PageResult pageResult = diyTemplateService.getDiyTemplatePage(reqVO); + // 断言 + assertEquals(1, pageResult.getTotal()); + assertEquals(1, pageResult.getList().size()); + assertPojoEquals(dbDiyTemplate, pageResult.getList().get(0)); + } + + @Test + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 + public void testGetDiyTemplateList() { + // mock 数据 + DiyTemplateDO dbDiyTemplate = randomPojo(DiyTemplateDO.class, o -> { // 等会查询到 + o.setName(null); + o.setUsed(null); + o.setUsedTime(null); + o.setRemark(null); + o.setPreviewImageUrls(null); + o.setProperty(null); + o.setCreateTime(null); + }); + diyTemplateMapper.insert(dbDiyTemplate); + // 测试 name 不匹配 + diyTemplateMapper.insert(cloneIgnoreId(dbDiyTemplate, o -> o.setName(null))); + // 测试 used 不匹配 + diyTemplateMapper.insert(cloneIgnoreId(dbDiyTemplate, o -> o.setUsed(null))); + // 测试 usedTime 不匹配 + 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))); + // 测试 property 不匹配 + diyTemplateMapper.insert(cloneIgnoreId(dbDiyTemplate, o -> o.setProperty(null))); + // 测试 createTime 不匹配 + diyTemplateMapper.insert(cloneIgnoreId(dbDiyTemplate, o -> o.setCreateTime(null))); + } + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/clean.sql b/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/clean.sql index 5e02a9f04..6a1a24252 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/clean.sql +++ b/yudao-module-mall/yudao-module-promotion-biz/src/test/resources/sql/clean.sql @@ -6,7 +6,7 @@ DELETE FROM "promotion_discount_activity"; DELETE FROM "promotion_discount_product"; DELETE FROM "promotion_seckill_config"; DELETE FROM "promotion_combination_activity"; -DELETE -FROM "promotion_article_category"; -DELETE -FROM "promotion_article"; +DELETE FROM "promotion_article_category"; +DELETE FROM "promotion_article"; +DELETE FROM "promotion_diy_template"; +DELETE FROM "promotion_diy_page"; \ No newline at end of file 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 a60f6c9e7..dc651301c 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 @@ -112,7 +112,6 @@ CREATE TABLE IF NOT EXISTS "promotion_discount_activity" PRIMARY KEY ("id") ) COMMENT '限时折扣活动'; --- 将该建表 SQL 语句,添加到 yudao-module-promotion-biz 模块的 test/resources/sql/create_tables.sql 文件里 CREATE TABLE IF NOT EXISTS "promotion_seckill_activity" ( "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY, @@ -220,4 +219,38 @@ CREATE TABLE IF NOT EXISTS "promotion_article" "deleted" bit NOT NULL DEFAULT FALSE, "tenant_id" bigint NOT NULL, PRIMARY KEY ("id") -) COMMENT '文章管理表'; \ No newline at end of file +) COMMENT '文章管理表'; + +CREATE TABLE IF NOT EXISTS "promotion_diy_template" +( + "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY, + "name" varchar NOT NULL, + "used" bit NOT NULL, + "used_time" varchar, + "remark" varchar, + "preview_image_urls" varchar, + "property" varchar NOT NULL, + "creator" varchar DEFAULT '', + "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updater" varchar DEFAULT '', + "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + "deleted" bit NOT NULL DEFAULT FALSE, + "tenant_id" bigint NOT NULL DEFAULT 0, + PRIMARY KEY ("id") +) COMMENT '装修模板'; +CREATE TABLE IF NOT EXISTS "promotion_diy_page" +( + "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY, + "template_id" bigint NOT NULL, + "name" varchar NOT NULL, + "remark" varchar, + "preview_image_urls" varchar, + "property" varchar, + "creator" varchar DEFAULT '', + "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updater" varchar DEFAULT '', + "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + "deleted" bit NOT NULL DEFAULT FALSE, + "tenant_id" bigint NOT NULL, + PRIMARY KEY ("id") +) COMMENT '装修页面'; \ No newline at end of file From c637a172eca5b72944ef5c12998ca2037f735a16 Mon Sep 17 00:00:00 2001 From: owen Date: Sun, 29 Oct 2023 18:50:55 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=90=A5=E9=94=80=EF=BC=9A=E8=A3=85?= =?UTF-8?q?=E4=BF=AE=E4=BB=A3=E7=A0=81=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{padiyge => diy}/DiyPageController.java | 16 ++++++++-------- .../{template => diy}/DiyTemplateController.java | 16 ++++++++-------- .../vo => diy/vo/page}/DiyPageBaseVO.java | 5 ++++- .../vo => diy/vo/page}/DiyPageCreateReqVO.java | 2 +- .../vo => diy/vo/page}/DiyPagePageReqVO.java | 2 +- .../vo => diy/vo/page}/DiyPageRespVO.java | 2 +- .../vo => diy/vo/page}/DiyPageUpdateReqVO.java | 2 +- .../vo/template}/DiyTemplateBaseVO.java | 2 +- .../vo/template}/DiyTemplateCreateReqVO.java | 2 +- .../vo/template}/DiyTemplatePageReqVO.java | 2 +- .../vo/template}/DiyTemplateRespVO.java | 2 +- .../vo/template}/DiyTemplateUpdateReqVO.java | 2 +- .../convert/{padiyge => diy}/DiyPageConvert.java | 10 +++++----- .../{template => diy}/DiyTemplateConvert.java | 8 +++++--- .../dataobject/{padiyge => diy}/DiyPageDO.java | 2 +- .../{template => diy}/DiyTemplateDO.java | 2 +- .../mysql/{padiyge => diy}/DiyPageMapper.java | 6 +++--- .../{template => diy}/DiyTemplateMapper.java | 6 +++--- .../service/{padiyge => diy}/DiyPageService.java | 10 +++++----- .../{padiyge => diy}/DiyPageServiceImpl.java | 14 +++++++------- .../{template => diy}/DiyTemplateService.java | 10 +++++----- .../DiyTemplateServiceImpl.java | 14 +++++++------- .../DiscountActivityServiceImplTest.java | 1 - .../{padiyge => diy}/DiyPageServiceImplTest.java | 12 ++++++------ .../DiyTemplateServiceImplTest.java | 12 ++++++------ 25 files changed, 83 insertions(+), 79 deletions(-) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/{padiyge => diy}/DiyPageController.java (83%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/{template => diy}/DiyTemplateController.java (82%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/{padiyge/vo => diy/vo/page}/DiyPageBaseVO.java (83%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/{padiyge/vo => diy/vo/page}/DiyPageCreateReqVO.java (82%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/{padiyge/vo => diy/vo/page}/DiyPagePageReqVO.java (92%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/{padiyge/vo => diy/vo/page}/DiyPageRespVO.java (89%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/{padiyge/vo => diy/vo/page}/DiyPageUpdateReqVO.java (88%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/{template/vo => diy/vo/template}/DiyTemplateBaseVO.java (92%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/{template/vo => diy/vo/template}/DiyTemplateCreateReqVO.java (81%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/{template/vo => diy/vo/template}/DiyTemplatePageReqVO.java (93%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/{template/vo => diy/vo/template}/DiyTemplateRespVO.java (91%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/{template/vo => diy/vo/template}/DiyTemplateUpdateReqVO.java (88%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/{padiyge => diy}/DiyPageConvert.java (59%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/{template => diy}/DiyTemplateConvert.java (60%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/{padiyge => diy}/DiyPageDO.java (95%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/{template => diy}/DiyTemplateDO.java (95%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/{padiyge => diy}/DiyPageMapper.java (77%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/{template => diy}/DiyTemplateMapper.java (83%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/{padiyge => diy}/DiyPageService.java (74%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/{padiyge => diy}/DiyPageServiceImpl.java (79%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/{template => diy}/DiyTemplateService.java (72%) rename yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/{template => diy}/DiyTemplateServiceImpl.java (83%) rename yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/{padiyge => diy}/DiyPageServiceImplTest.java (90%) rename yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/{template => diy}/DiyTemplateServiceImplTest.java (93%) diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/DiyPageController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/DiyPageController.java similarity index 83% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/DiyPageController.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/DiyPageController.java index e49bba327..850d38568 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/DiyPageController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/DiyPageController.java @@ -1,14 +1,14 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.padiyge; +package cn.iocoder.yudao.module.promotion.controller.admin.diy; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPageCreateReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPagePageReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPageRespVO; -import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPageUpdateReqVO; -import cn.iocoder.yudao.module.promotion.convert.padiyge.DiyPageConvert; -import cn.iocoder.yudao.module.promotion.dal.dataobject.padiyge.DiyPageDO; -import cn.iocoder.yudao.module.promotion.service.padiyge.DiyPageService; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page.DiyPageCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page.DiyPagePageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page.DiyPageRespVO; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page.DiyPageUpdateReqVO; +import cn.iocoder.yudao.module.promotion.convert.diy.DiyPageConvert; +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; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/DiyTemplateController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/DiyTemplateController.java similarity index 82% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/DiyTemplateController.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/DiyTemplateController.java index 651781709..dcbf22cec 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/DiyTemplateController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/DiyTemplateController.java @@ -1,14 +1,14 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.template; +package cn.iocoder.yudao.module.promotion.controller.admin.diy; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.DiyTemplateCreateReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.DiyTemplatePageReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.DiyTemplateRespVO; -import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.DiyTemplateUpdateReqVO; -import cn.iocoder.yudao.module.promotion.convert.template.DiyTemplateConvert; -import cn.iocoder.yudao.module.promotion.dal.dataobject.template.DiyTemplateDO; -import cn.iocoder.yudao.module.promotion.service.template.DiyTemplateService; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template.DiyTemplateCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template.DiyTemplatePageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template.DiyTemplateRespVO; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template.DiyTemplateUpdateReqVO; +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.service.diy.DiyTemplateService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/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 similarity index 83% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPageBaseVO.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/page/DiyPageBaseVO.java index e9c086f49..3ec390a8d 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/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 @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo; +package cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -26,4 +26,7 @@ public class DiyPageBaseVO { @Schema(description = "预览图") private List previewImageUrls; + @Schema(description = "页面属性", example = "[]") + private String property; + } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPageCreateReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/page/DiyPageCreateReqVO.java similarity index 82% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPageCreateReqVO.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/page/DiyPageCreateReqVO.java index 6b20cccac..17d3b35cb 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPageCreateReqVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/page/DiyPageCreateReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo; +package cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPagePageReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/page/DiyPagePageReqVO.java similarity index 92% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPagePageReqVO.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/page/DiyPagePageReqVO.java index af17a2ec0..5c81b9f93 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPagePageReqVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/page/DiyPagePageReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo; +package cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page; import cn.iocoder.yudao.framework.common.pojo.PageParam; import io.swagger.v3.oas.annotations.media.Schema; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPageRespVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/page/DiyPageRespVO.java similarity index 89% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPageRespVO.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/page/DiyPageRespVO.java index 51bd5b3da..9e2d9af86 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPageRespVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/page/DiyPageRespVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo; +package cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPageUpdateReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/page/DiyPageUpdateReqVO.java similarity index 88% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPageUpdateReqVO.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/page/DiyPageUpdateReqVO.java index ddfd99d79..9909b57f9 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/padiyge/vo/DiyPageUpdateReqVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/page/DiyPageUpdateReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo; +package cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/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 similarity index 92% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplateBaseVO.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplateBaseVO.java index bdc51a1bb..1bfc6a725 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/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 @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.template.vo; +package cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplateCreateReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplateCreateReqVO.java similarity index 81% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplateCreateReqVO.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplateCreateReqVO.java index 96506c7cb..659f9c590 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplateCreateReqVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplateCreateReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.template.vo; +package cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplatePageReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplatePageReqVO.java similarity index 93% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplatePageReqVO.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplatePageReqVO.java index 120ca0911..1099226f9 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplatePageReqVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplatePageReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.template.vo; +package cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template; import cn.iocoder.yudao.framework.common.pojo.PageParam; import io.swagger.v3.oas.annotations.media.Schema; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplateRespVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplateRespVO.java similarity index 91% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplateRespVO.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplateRespVO.java index b7bd4b5b7..e19089e6a 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplateRespVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplateRespVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.template.vo; +package cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplateUpdateReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplateUpdateReqVO.java similarity index 88% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplateUpdateReqVO.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplateUpdateReqVO.java index b7ec68e51..887f2f9dd 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/template/vo/DiyTemplateUpdateReqVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/diy/vo/template/DiyTemplateUpdateReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.template.vo; +package cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/padiyge/DiyPageConvert.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/diy/DiyPageConvert.java similarity index 59% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/padiyge/DiyPageConvert.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/diy/DiyPageConvert.java index 2fe6124e6..a8b22d318 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/padiyge/DiyPageConvert.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/diy/DiyPageConvert.java @@ -1,10 +1,10 @@ -package cn.iocoder.yudao.module.promotion.convert.padiyge; +package cn.iocoder.yudao.module.promotion.convert.diy; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPageCreateReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPageRespVO; -import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPageUpdateReqVO; -import cn.iocoder.yudao.module.promotion.dal.dataobject.padiyge.DiyPageDO; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page.DiyPageCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page.DiyPageRespVO; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page.DiyPageUpdateReqVO; +import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyPageDO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/template/DiyTemplateConvert.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/diy/DiyTemplateConvert.java similarity index 60% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/template/DiyTemplateConvert.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/diy/DiyTemplateConvert.java index 8da831700..6f338e918 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/template/DiyTemplateConvert.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/diy/DiyTemplateConvert.java @@ -1,8 +1,10 @@ -package cn.iocoder.yudao.module.promotion.convert.template; +package cn.iocoder.yudao.module.promotion.convert.diy; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.*; -import cn.iocoder.yudao.module.promotion.dal.dataobject.template.DiyTemplateDO; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template.DiyTemplateCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template.DiyTemplateRespVO; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template.DiyTemplateUpdateReqVO; +import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyTemplateDO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/padiyge/DiyPageDO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyPageDO.java similarity index 95% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/padiyge/DiyPageDO.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyPageDO.java index 34cf3325f..e5e3f4208 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/padiyge/DiyPageDO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyPageDO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.dal.dataobject.padiyge; +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; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/template/DiyTemplateDO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyTemplateDO.java similarity index 95% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/template/DiyTemplateDO.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyTemplateDO.java index 682cad0ba..a50fd4dde 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/template/DiyTemplateDO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/diy/DiyTemplateDO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.promotion.dal.dataobject.template; +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; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/padiyge/DiyPageMapper.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/diy/DiyPageMapper.java similarity index 77% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/padiyge/DiyPageMapper.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/diy/DiyPageMapper.java index bc04e6ce0..a0ef3714c 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/padiyge/DiyPageMapper.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/diy/DiyPageMapper.java @@ -1,10 +1,10 @@ -package cn.iocoder.yudao.module.promotion.dal.mysql.padiyge; +package cn.iocoder.yudao.module.promotion.dal.mysql.diy; 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; -import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPagePageReqVO; -import cn.iocoder.yudao.module.promotion.dal.dataobject.padiyge.DiyPageDO; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page.DiyPagePageReqVO; +import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyPageDO; import org.apache.ibatis.annotations.Mapper; /** diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/template/DiyTemplateMapper.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/diy/DiyTemplateMapper.java similarity index 83% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/template/DiyTemplateMapper.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/diy/DiyTemplateMapper.java index 0351cfb1b..5ac1d99fc 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/template/DiyTemplateMapper.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/diy/DiyTemplateMapper.java @@ -1,10 +1,10 @@ -package cn.iocoder.yudao.module.promotion.dal.mysql.template; +package cn.iocoder.yudao.module.promotion.dal.mysql.diy; 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; -import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.DiyTemplatePageReqVO; -import cn.iocoder.yudao.module.promotion.dal.dataobject.template.DiyTemplateDO; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template.DiyTemplatePageReqVO; +import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyTemplateDO; import org.apache.ibatis.annotations.Mapper; /** diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/padiyge/DiyPageService.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyPageService.java similarity index 74% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/padiyge/DiyPageService.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyPageService.java index 0e3011c98..94a065ffe 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/padiyge/DiyPageService.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyPageService.java @@ -1,10 +1,10 @@ -package cn.iocoder.yudao.module.promotion.service.padiyge; +package cn.iocoder.yudao.module.promotion.service.diy; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPageCreateReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPagePageReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPageUpdateReqVO; -import cn.iocoder.yudao.module.promotion.dal.dataobject.padiyge.DiyPageDO; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page.DiyPageCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page.DiyPagePageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page.DiyPageUpdateReqVO; +import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyPageDO; import javax.validation.Valid; import java.util.Collection; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/padiyge/DiyPageServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyPageServiceImpl.java similarity index 79% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/padiyge/DiyPageServiceImpl.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyPageServiceImpl.java index 28bef36a0..26371e36a 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/padiyge/DiyPageServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyPageServiceImpl.java @@ -1,14 +1,14 @@ -package cn.iocoder.yudao.module.promotion.service.padiyge; +package cn.iocoder.yudao.module.promotion.service.diy; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.ListUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPageCreateReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPagePageReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPageUpdateReqVO; -import cn.iocoder.yudao.module.promotion.convert.padiyge.DiyPageConvert; -import cn.iocoder.yudao.module.promotion.dal.dataobject.padiyge.DiyPageDO; -import cn.iocoder.yudao.module.promotion.dal.mysql.padiyge.DiyPageMapper; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page.DiyPageCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page.DiyPagePageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page.DiyPageUpdateReqVO; +import cn.iocoder.yudao.module.promotion.convert.diy.DiyPageConvert; +import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyPageDO; +import cn.iocoder.yudao.module.promotion.dal.mysql.diy.DiyPageMapper; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/template/DiyTemplateService.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateService.java similarity index 72% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/template/DiyTemplateService.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateService.java index 130ad9f21..b8611a0a9 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/template/DiyTemplateService.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateService.java @@ -1,10 +1,10 @@ -package cn.iocoder.yudao.module.promotion.service.template; +package cn.iocoder.yudao.module.promotion.service.diy; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.DiyTemplateCreateReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.DiyTemplatePageReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.DiyTemplateUpdateReqVO; -import cn.iocoder.yudao.module.promotion.dal.dataobject.template.DiyTemplateDO; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template.DiyTemplateCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template.DiyTemplatePageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template.DiyTemplateUpdateReqVO; +import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyTemplateDO; import javax.validation.Valid; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/template/DiyTemplateServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImpl.java similarity index 83% rename from yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/template/DiyTemplateServiceImpl.java rename to yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImpl.java index 334b166aa..1e2de3ba4 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/template/DiyTemplateServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImpl.java @@ -1,13 +1,13 @@ -package cn.iocoder.yudao.module.promotion.service.template; +package cn.iocoder.yudao.module.promotion.service.diy; import cn.hutool.core.util.BooleanUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.DiyTemplateCreateReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.DiyTemplatePageReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.DiyTemplateUpdateReqVO; -import cn.iocoder.yudao.module.promotion.convert.template.DiyTemplateConvert; -import cn.iocoder.yudao.module.promotion.dal.dataobject.template.DiyTemplateDO; -import cn.iocoder.yudao.module.promotion.dal.mysql.template.DiyTemplateMapper; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template.DiyTemplateCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template.DiyTemplatePageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template.DiyTemplateUpdateReqVO; +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 org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/discount/DiscountActivityServiceImplTest.java b/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/discount/DiscountActivityServiceImplTest.java index 5ad517463..0a1cb5eb4 100755 --- a/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/discount/DiscountActivityServiceImplTest.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/discount/DiscountActivityServiceImplTest.java @@ -18,7 +18,6 @@ import org.springframework.context.annotation.Import; import javax.annotation.Resource; import java.time.Duration; import java.time.LocalDateTime; -import java.util.Date; import java.util.List; import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.addTime; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/padiyge/DiyPageServiceImplTest.java b/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/diy/DiyPageServiceImplTest.java similarity index 90% rename from yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/padiyge/DiyPageServiceImplTest.java rename to yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/diy/DiyPageServiceImplTest.java index e0702248a..bc5253706 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/padiyge/DiyPageServiceImplTest.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/diy/DiyPageServiceImplTest.java @@ -1,12 +1,12 @@ -package cn.iocoder.yudao.module.promotion.service.padiyge; +package cn.iocoder.yudao.module.promotion.service.diy; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; -import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPageCreateReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPagePageReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.padiyge.vo.DiyPageUpdateReqVO; -import cn.iocoder.yudao.module.promotion.dal.dataobject.padiyge.DiyPageDO; -import cn.iocoder.yudao.module.promotion.dal.mysql.padiyge.DiyPageMapper; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page.DiyPageCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page.DiyPagePageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.page.DiyPageUpdateReqVO; +import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyPageDO; +import cn.iocoder.yudao.module.promotion.dal.mysql.diy.DiyPageMapper; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.springframework.context.annotation.Import; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/template/DiyTemplateServiceImplTest.java b/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImplTest.java similarity index 93% rename from yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/template/DiyTemplateServiceImplTest.java rename to yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImplTest.java index a72245801..6fa2d584e 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/template/DiyTemplateServiceImplTest.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/diy/DiyTemplateServiceImplTest.java @@ -1,12 +1,12 @@ -package cn.iocoder.yudao.module.promotion.service.template; +package cn.iocoder.yudao.module.promotion.service.diy; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; -import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.DiyTemplateCreateReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.DiyTemplatePageReqVO; -import cn.iocoder.yudao.module.promotion.controller.admin.template.vo.DiyTemplateUpdateReqVO; -import cn.iocoder.yudao.module.promotion.dal.dataobject.template.DiyTemplateDO; -import cn.iocoder.yudao.module.promotion.dal.mysql.template.DiyTemplateMapper; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template.DiyTemplateCreateReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template.DiyTemplatePageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.diy.vo.template.DiyTemplateUpdateReqVO; +import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyTemplateDO; +import cn.iocoder.yudao.module.promotion.dal.mysql.diy.DiyTemplateMapper; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.springframework.context.annotation.Import; From b5f9ed9edfa9e22240825dd5655ab21aec103bd1 Mon Sep 17 00:00:00 2001 From: owen Date: Sun, 29 Oct 2023 22:04:21 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=90=A5=E9=94=80=EF=BC=9A=E8=A3=85?= =?UTF-8?q?=E4=BF=AESQL=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/mysql/mall.sql | 55 +++++++++++++++++++--------------------------- 1 file changed, 23 insertions(+), 32 deletions(-) diff --git a/sql/mysql/mall.sql b/sql/mysql/mall.sql index 050e4e6b5..8f8aa3f5f 100644 --- a/sql/mysql/mall.sql +++ b/sql/mysql/mall.sql @@ -10,7 +10,7 @@ CREATE TABLE promotion_diy_template used_time datetime NULL COMMENT '使用时间', remark varchar(255) NULL COMMENT '备注', preview_image_urls varchar(2000) NULL COMMENT '预览图,多个逗号分隔', - property varchar(2000) NULL COMMENT '页面属性,JSON 格式', + property text NULL COMMENT '页面属性,JSON 格式', creator varchar(64) DEFAULT '' NULL COMMENT '创建者', create_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间', updater varchar(64) DEFAULT '' NULL COMMENT '更新者', @@ -20,28 +20,6 @@ CREATE TABLE promotion_diy_template ) COMMENT '装修模板'; --- 菜单 SQL -INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status, component_name) -VALUES ('装修模板', '', 2, 20, 2030, 'diy-template', 'fa6-solid:brush', 'mall/promotion/diy/template/index', 0, 'DiyTemplate'); - --- 按钮父菜单ID --- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码 -SELECT @parentId := LAST_INSERT_ID(); - --- 按钮 SQL -INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status) -VALUES ('装修模板查询', 'promotion:diy-template:query', 3, 1, @parentId, '', '', '', 0); -INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status) -VALUES ('装修模板创建', 'promotion:diy-template:create', 3, 2, @parentId, '', '', '', 0); -INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status) -VALUES ('装修模板更新', 'promotion:diy-template:update', 3, 3, @parentId, '', '', '', 0); -INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status) -VALUES ('装修模板删除', 'promotion:diy-template:delete', 3, 4, @parentId, '', '', '', 0); -INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status) -VALUES ('装修模板使用', 'promotion:diy-template:use', 3, 5, @parentId, '', '', '', 0);; - - - CREATE TABLE promotion_diy_page ( id bigint AUTO_INCREMENT COMMENT '装修页面编号' @@ -50,7 +28,7 @@ CREATE TABLE promotion_diy_page name varchar(100) NOT NULL COMMENT '页面名称', remark varchar(255) NULL COMMENT '备注', preview_image_urls varchar(2000) NULL COMMENT '预览图,多个逗号分隔', - property varchar(2000) NULL COMMENT '页面属性,JSON 格式', + property text NULL COMMENT '页面属性,JSON 格式', creator varchar(64) DEFAULT '' NULL COMMENT '创建者', create_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间', updater varchar(64) DEFAULT '' NULL COMMENT '更新者', @@ -62,15 +40,30 @@ CREATE TABLE promotion_diy_page CREATE INDEX idx_template_id ON promotion_diy_page (template_id); --- 菜单 SQL +-- 装修,上级菜单:营销中心 INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status, component_name) -VALUES ('装修页面', '', 2, 21, 2030, 'diy-page', 'foundation:page-edit', 'mall/promotion/diy/page/index', 0, 'DiyPage'); +VALUES ('商城装修', '', 2, 20, 2030, 'diy-template', 'fa6-solid:brush', 'mall/promotion/diy/template/index', 0, 'DiyTemplate'); +SELECT @diyParentId := LAST_INSERT_ID(); --- 按钮父菜单ID --- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码 +-- 装修模板 +INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status, component_name) +VALUES ('装修模板', '', 2, 1, @diyParentId, 'diy-template', 'fa6-solid:brush', 'mall/promotion/diy/template/index', 0, 'DiyTemplate'); SELECT @parentId := LAST_INSERT_ID(); +INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status) +VALUES ('装修模板查询', 'promotion:diy-template:query', 3, 1, @parentId, '', '', '', 0); +INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status) +VALUES ('装修模板创建', 'promotion:diy-template:create', 3, 2, @parentId, '', '', '', 0); +INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status) +VALUES ('装修模板更新', 'promotion:diy-template:update', 3, 3, @parentId, '', '', '', 0); +INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status) +VALUES ('装修模板删除', 'promotion:diy-template:delete', 3, 4, @parentId, '', '', '', 0); +INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status) +VALUES ('装修模板使用', 'promotion:diy-template:use', 3, 5, @parentId, '', '', '', 0); --- 按钮 SQL +-- 装修页面 +INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status, component_name) +VALUES ('装修页面', '', 2, 2, @diyParentId, 'diy-page', 'foundation:page-edit', 'mall/promotion/diy/page/index', 0, 'DiyPage'); +SELECT @parentId := LAST_INSERT_ID(); INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status) VALUES ('装修页面查询', 'promotion:diy-page:query', 3, 1, @parentId, '', '', '', 0); INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status) @@ -78,6 +71,4 @@ VALUES ('装修页面创建', 'promotion:diy-page:create', 3, 2, @parentId, '', INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status) VALUES ('装修页面更新', 'promotion:diy-page:update', 3, 3, @parentId, '', '', '', 0); INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status) -VALUES ('装修页面删除', 'promotion:diy-page:delete', 3, 4, @parentId, '', '', '', 0); -INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status) -VALUES ('装修页面导出', 'promotion:diy-page:export', 3, 5, @parentId, '', '', '', 0); \ No newline at end of file +VALUES ('装修页面删除', 'promotion:diy-page:delete', 3, 4, @parentId, '', '', '', 0);; \ No newline at end of file