From 2d9889af9f9d89d7cb2e50e828305e4acddf893f Mon Sep 17 00:00:00 2001 From: XinWei <2718030729@qq.com> Date: Sun, 29 Sep 2024 22:35:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=98=E8=B4=B9=E4=BC=9A=E5=91=98=E6=9D=83?= =?UTF-8?q?=E7=9B=8A=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/mall/promotion/memberbenefit/index.ts | 44 ++++ .../memberbenefit/PaidMemberBenefitForm.vue | 117 +++++++++ .../mall/promotion/memberbenefit/index.vue | 232 ++++++++++++++++++ .../member/enums/ErrorCodeConstants.java | 3 +- .../PaidMemberBenefitController.java | 97 ++++++++ .../MemberBenefitLevelRelationPageReqVO.java | 28 +++ .../vo/MemberBenefitLevelRelationRespVO.java | 32 +++ .../MemberBenefitLevelRelationSaveReqVO.java | 23 ++ .../vo/PaidMemberBenefitPageReqVO.java | 37 +++ .../vo/PaidMemberBenefitRespVO.java | 44 ++++ .../vo/PaidMemberBenefitSaveReqVO.java | 34 +++ .../memberbenefit/PaidMemberBenefitDO.java | 51 ++++ .../MemberBenefitLevelRelationDO.java | 39 +++ .../PaidMemberBenefitMapper.java | 31 +++ .../MemberBenefitLevelRelationMapper.java | 28 +++ .../PaidMemberBenefitService.java | 56 +++++ .../PaidMemberBenefitServiceImpl.java | 75 ++++++ .../MemberBenefitLevelRelationService.java | 56 +++++ ...MemberBenefitLevelRelationServiceImpl.java | 75 ++++++ 19 files changed, 1101 insertions(+), 1 deletion(-) create mode 100644 yudao-admin-vue3/src/api/mall/promotion/memberbenefit/index.ts create mode 100644 yudao-admin-vue3/src/views/mall/promotion/memberbenefit/PaidMemberBenefitForm.vue create mode 100644 yudao-admin-vue3/src/views/mall/promotion/memberbenefit/index.vue create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/PaidMemberBenefitController.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/MemberBenefitLevelRelationPageReqVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/MemberBenefitLevelRelationRespVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/MemberBenefitLevelRelationSaveReqVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/PaidMemberBenefitPageReqVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/PaidMemberBenefitRespVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/PaidMemberBenefitSaveReqVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/memberbenefit/PaidMemberBenefitDO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/memberbenefitlevelrelation/MemberBenefitLevelRelationDO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/memberbenefit/PaidMemberBenefitMapper.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/memberbenefitlevelrelation/MemberBenefitLevelRelationMapper.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberbenefit/PaidMemberBenefitService.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberbenefit/PaidMemberBenefitServiceImpl.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberbenefitlevelrelation/MemberBenefitLevelRelationService.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberbenefitlevelrelation/MemberBenefitLevelRelationServiceImpl.java diff --git a/yudao-admin-vue3/src/api/mall/promotion/memberbenefit/index.ts b/yudao-admin-vue3/src/api/mall/promotion/memberbenefit/index.ts new file mode 100644 index 0000000..9a76773 --- /dev/null +++ b/yudao-admin-vue3/src/api/mall/promotion/memberbenefit/index.ts @@ -0,0 +1,44 @@ +import request from '@/config/axios' + +// 付费会员权益 VO +export interface PaidMemberBenefitVO { + id: number // 编号 + name: string // 名称 + iconUrl: string // 图标地址 + intro: string // 描述 + status: boolean // 状态:(默认)0隐藏 1显示 + sort: number // 排序 +} + +// 付费会员权益 API +export const PaidMemberBenefitApi = { + // 查询付费会员权益分页 + getPaidMemberBenefitPage: async (params: any) => { + return await request.get({ url: `/paidmemberbenefit/paid-member-benefit/page`, params }) + }, + + // 查询付费会员权益详情 + getPaidMemberBenefit: async (id: number) => { + return await request.get({ url: `/paidmemberbenefit/paid-member-benefit/get?id=` + id }) + }, + + // 新增付费会员权益 + createPaidMemberBenefit: async (data: PaidMemberBenefitVO) => { + return await request.post({ url: `/paidmemberbenefit/paid-member-benefit/create`, data }) + }, + + // 修改付费会员权益 + updatePaidMemberBenefit: async (data: PaidMemberBenefitVO) => { + return await request.put({ url: `/paidmemberbenefit/paid-member-benefit/update`, data }) + }, + + // 删除付费会员权益 + deletePaidMemberBenefit: async (id: number) => { + return await request.delete({ url: `/paidmemberbenefit/paid-member-benefit/delete?id=` + id }) + }, + + // 导出付费会员权益 Excel + exportPaidMemberBenefit: async (params) => { + return await request.download({ url: `/paidmemberbenefit/paid-member-benefit/export-excel`, params }) + }, +} \ No newline at end of file diff --git a/yudao-admin-vue3/src/views/mall/promotion/memberbenefit/PaidMemberBenefitForm.vue b/yudao-admin-vue3/src/views/mall/promotion/memberbenefit/PaidMemberBenefitForm.vue new file mode 100644 index 0000000..a0f4087 --- /dev/null +++ b/yudao-admin-vue3/src/views/mall/promotion/memberbenefit/PaidMemberBenefitForm.vue @@ -0,0 +1,117 @@ + + \ No newline at end of file diff --git a/yudao-admin-vue3/src/views/mall/promotion/memberbenefit/index.vue b/yudao-admin-vue3/src/views/mall/promotion/memberbenefit/index.vue new file mode 100644 index 0000000..8adccf1 --- /dev/null +++ b/yudao-admin-vue3/src/views/mall/promotion/memberbenefit/index.vue @@ -0,0 +1,232 @@ + + + \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java index ee970a5..d056ba8 100644 --- a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java +++ b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java @@ -50,7 +50,8 @@ public interface ErrorCodeConstants { ErrorCode LEVEL_HAS_USER = new ErrorCode(1_004_011_005, "用户等级下存在用户,无法删除"); ErrorCode EXPERIENCE_BIZ_NOT_SUPPORT = new ErrorCode(1_004_011_201, "用户经验业务类型不支持"); - + ErrorCode PAID_MEMBER_BENEFIT_NOT_EXISTS = new ErrorCode(1_004_011_202, "付费会员权益不存在"); + ErrorCode PAID_MEMBER_BENEFIT_LEVEL_RELATION_NOT_EXISTS = new ErrorCode(1_004_011_202, "会员权益和等级关系不存在"); //========== 用户分组 1-004-012-000 ========== ErrorCode GROUP_NOT_EXISTS = new ErrorCode(1_004_012_000, "用户分组不存在"); ErrorCode GROUP_HAS_USER = new ErrorCode(1_004_012_001, "用户分组下存在用户,无法删除"); diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/PaidMemberBenefitController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/PaidMemberBenefitController.java new file mode 100644 index 0000000..b8b05d1 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/PaidMemberBenefitController.java @@ -0,0 +1,97 @@ +package cn.iocoder.yudao.module.member.controller.admin.memberbenefit; + +import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitPageReqVO; +import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitRespVO; +import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitSaveReqVO; +import cn.iocoder.yudao.module.member.dal.dataobject.memberbenefit.PaidMemberBenefitDO; +import cn.iocoder.yudao.module.member.service.memberbenefit.PaidMemberBenefitService; +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import javax.validation.constraints.*; +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; + +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*; + + +@Tag(name = "管理后台 - 付费会员权益") +@RestController +@RequestMapping("/paidmemberbenefit/paid-member-benefit") +@Validated +public class PaidMemberBenefitController { + + @Resource + private PaidMemberBenefitService paidMemberBenefitService; + + @PostMapping("/create") + @Operation(summary = "创建付费会员权益") + @PreAuthorize("@ss.hasPermission('paidmemberbenefit:paid-member-benefit:create')") + public CommonResult createPaidMemberBenefit(@Valid @RequestBody PaidMemberBenefitSaveReqVO createReqVO) { + return success(paidMemberBenefitService.createPaidMemberBenefit(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新付费会员权益") + @PreAuthorize("@ss.hasPermission('paidmemberbenefit:paid-member-benefit:update')") + public CommonResult updatePaidMemberBenefit(@Valid @RequestBody PaidMemberBenefitSaveReqVO updateReqVO) { + paidMemberBenefitService.updatePaidMemberBenefit(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除付费会员权益") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('paidmemberbenefit:paid-member-benefit:delete')") + public CommonResult deletePaidMemberBenefit(@RequestParam("id") Long id) { + paidMemberBenefitService.deletePaidMemberBenefit(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得付费会员权益") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('paidmemberbenefit:paid-member-benefit:query')") + public CommonResult getPaidMemberBenefit(@RequestParam("id") Long id) { + PaidMemberBenefitDO paidMemberBenefit = paidMemberBenefitService.getPaidMemberBenefit(id); + return success(BeanUtils.toBean(paidMemberBenefit, PaidMemberBenefitRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得付费会员权益分页") + @PreAuthorize("@ss.hasPermission('paidmemberbenefit:paid-member-benefit:query')") + public CommonResult> getPaidMemberBenefitPage(@Valid PaidMemberBenefitPageReqVO pageReqVO) { + PageResult pageResult = paidMemberBenefitService.getPaidMemberBenefitPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, PaidMemberBenefitRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出付费会员权益 Excel") + @PreAuthorize("@ss.hasPermission('paidmemberbenefit:paid-member-benefit:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportPaidMemberBenefitExcel(@Valid PaidMemberBenefitPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = paidMemberBenefitService.getPaidMemberBenefitPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "付费会员权益.xls", "数据", PaidMemberBenefitRespVO.class, + BeanUtils.toBean(list, PaidMemberBenefitRespVO.class)); + } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/MemberBenefitLevelRelationPageReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/MemberBenefitLevelRelationPageReqVO.java new file mode 100644 index 0000000..7de9dd0 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/MemberBenefitLevelRelationPageReqVO.java @@ -0,0 +1,28 @@ +package cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +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 MemberBenefitLevelRelationPageReqVO extends PageParam { + + @Schema(description = "会员等级编号", example = "234") + private Long memberLevelId; + + @Schema(description = "会员权益编号", example = "8416") + private Long memberBenefitId; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/MemberBenefitLevelRelationRespVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/MemberBenefitLevelRelationRespVO.java new file mode 100644 index 0000000..00f1594 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/MemberBenefitLevelRelationRespVO.java @@ -0,0 +1,32 @@ +package cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 会员权益和等级关系 Response VO") +@Data +@ExcelIgnoreUnannotated +public class MemberBenefitLevelRelationRespVO { + + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "30308") + @ExcelProperty("编号") + private Long id; + + @Schema(description = "会员等级编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "234") + @ExcelProperty("会员等级编号") + private Long memberLevelId; + + @Schema(description = "会员权益编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8416") + @ExcelProperty("会员权益编号") + private Long memberBenefitId; + + @Schema(description = "创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/MemberBenefitLevelRelationSaveReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/MemberBenefitLevelRelationSaveReqVO.java new file mode 100644 index 0000000..7fd7446 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/MemberBenefitLevelRelationSaveReqVO.java @@ -0,0 +1,23 @@ +package cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 会员权益和等级关系新增/修改 Request VO") +@Data +public class MemberBenefitLevelRelationSaveReqVO { + + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "30308") + private Long id; + + @Schema(description = "会员等级编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "234") + @NotNull(message = "会员等级编号不能为空") + private Long memberLevelId; + + @Schema(description = "会员权益编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8416") + @NotNull(message = "会员权益编号不能为空") + private Long memberBenefitId; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/PaidMemberBenefitPageReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/PaidMemberBenefitPageReqVO.java new file mode 100644 index 0000000..29b8ac6 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/PaidMemberBenefitPageReqVO.java @@ -0,0 +1,37 @@ +package cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +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 PaidMemberBenefitPageReqVO extends PageParam { + + @Schema(description = "名称", example = "王五") + private String name; + + @Schema(description = "图标地址", example = "https://www.iocoder.cn") + private String iconUrl; + + @Schema(description = "描述") + private String intro; + + @Schema(description = "状态:(默认)0隐藏 1显示", example = "1") + private Boolean status; + + @Schema(description = "排序") + private Integer sort; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/PaidMemberBenefitRespVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/PaidMemberBenefitRespVO.java new file mode 100644 index 0000000..256efdd --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/PaidMemberBenefitRespVO.java @@ -0,0 +1,44 @@ +package cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 付费会员权益 Response VO") +@Data +@ExcelIgnoreUnannotated +public class PaidMemberBenefitRespVO { + + @Schema(description = " 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "29131") + @ExcelProperty(" 编号") + private Long id; + + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") + @ExcelProperty("名称") + private String name; + + @Schema(description = "图标地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn") + @ExcelProperty("图标地址") + private String iconUrl; + + @Schema(description = "描述") + @ExcelProperty("描述") + private String intro; + + @Schema(description = "状态:(默认)0隐藏 1显示", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty("状态:(默认)0隐藏 1显示") + private Boolean status; + + @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("排序") + private Integer sort; + + @Schema(description = "创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/PaidMemberBenefitSaveReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/PaidMemberBenefitSaveReqVO.java new file mode 100644 index 0000000..c89dc41 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/memberbenefit/vo/PaidMemberBenefitSaveReqVO.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 付费会员权益新增/修改 Request VO") +@Data +public class PaidMemberBenefitSaveReqVO { + + @Schema(description = " 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "29131") + private Long id; + + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") + @NotEmpty(message = "名称不能为空") + private String name; + + @Schema(description = "图标地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn") + @NotEmpty(message = "图标地址不能为空") + private String iconUrl; + + @Schema(description = "描述") + private String intro; + + @Schema(description = "状态:(默认)0隐藏 1显示", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "状态:(默认)0隐藏 1显示不能为空") + private Boolean status; + + @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "排序不能为空") + private Integer sort; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/memberbenefit/PaidMemberBenefitDO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/memberbenefit/PaidMemberBenefitDO.java new file mode 100644 index 0000000..e7e497b --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/memberbenefit/PaidMemberBenefitDO.java @@ -0,0 +1,51 @@ +package cn.iocoder.yudao.module.member.dal.dataobject.memberbenefit; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 付费会员权益 DO + * + * @author 管理员 + */ +@TableName("paid_member_benefit") +@KeySequence("paid_member_benefit_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class PaidMemberBenefitDO extends BaseDO { + + /** + * 编号 + */ + @TableId + private Long id; + /** + * 名称 + */ + private String name; + /** + * 图标地址 + */ + private String iconUrl; + /** + * 描述 + */ + private String intro; + /** + * 状态:(默认)0隐藏 1显示 + */ + private Boolean status; + /** + * 排序 + */ + private Integer sort; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/memberbenefitlevelrelation/MemberBenefitLevelRelationDO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/memberbenefitlevelrelation/MemberBenefitLevelRelationDO.java new file mode 100644 index 0000000..a170794 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/memberbenefitlevelrelation/MemberBenefitLevelRelationDO.java @@ -0,0 +1,39 @@ +package cn.iocoder.yudao.module.member.dal.dataobject.memberbenefitlevelrelation; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 会员权益和等级关系 DO + * + * @author 管理员 + */ +@TableName("paid_member_benefit_level_relation") +@KeySequence("paid_member_benefit_level_relation_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class MemberBenefitLevelRelationDO extends BaseDO { + + /** + * 编号 + */ + @TableId + private Long id; + /** + * 会员等级编号 + */ + private Long memberLevelId; + /** + * 会员权益编号 + */ + private Long memberBenefitId; + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/memberbenefit/PaidMemberBenefitMapper.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/memberbenefit/PaidMemberBenefitMapper.java new file mode 100644 index 0000000..50a0fe7 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/memberbenefit/PaidMemberBenefitMapper.java @@ -0,0 +1,31 @@ +package cn.iocoder.yudao.module.member.dal.mysql.memberbenefit; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitPageReqVO; +import cn.iocoder.yudao.module.member.dal.dataobject.memberbenefit.PaidMemberBenefitDO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 付费会员权益 Mapper + * + * @author 管理员 + */ +@Mapper +public interface PaidMemberBenefitMapper extends BaseMapperX { + + default PageResult selectPage(PaidMemberBenefitPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(PaidMemberBenefitDO::getName, reqVO.getName()) + .eqIfPresent(PaidMemberBenefitDO::getIconUrl, reqVO.getIconUrl()) + .eqIfPresent(PaidMemberBenefitDO::getIntro, reqVO.getIntro()) + .eqIfPresent(PaidMemberBenefitDO::getStatus, reqVO.getStatus()) + .eqIfPresent(PaidMemberBenefitDO::getSort, reqVO.getSort()) + .betweenIfPresent(PaidMemberBenefitDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(PaidMemberBenefitDO::getId)); + } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/memberbenefitlevelrelation/MemberBenefitLevelRelationMapper.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/memberbenefitlevelrelation/MemberBenefitLevelRelationMapper.java new file mode 100644 index 0000000..73521ff --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/memberbenefitlevelrelation/MemberBenefitLevelRelationMapper.java @@ -0,0 +1,28 @@ +package cn.iocoder.yudao.module.member.dal.mysql.memberbenefitlevelrelation; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.MemberBenefitLevelRelationPageReqVO; +import cn.iocoder.yudao.module.member.dal.dataobject.memberbenefitlevelrelation.MemberBenefitLevelRelationDO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 会员权益和等级关系 Mapper + * + * @author 管理员 + */ +@Mapper +public interface MemberBenefitLevelRelationMapper extends BaseMapperX { + + default PageResult selectPage(MemberBenefitLevelRelationPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(MemberBenefitLevelRelationDO::getMemberLevelId, reqVO.getMemberLevelId()) + .eqIfPresent(MemberBenefitLevelRelationDO::getMemberBenefitId, reqVO.getMemberBenefitId()) + .betweenIfPresent(MemberBenefitLevelRelationDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(MemberBenefitLevelRelationDO::getId)); + } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberbenefit/PaidMemberBenefitService.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberbenefit/PaidMemberBenefitService.java new file mode 100644 index 0000000..f3b56a1 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberbenefit/PaidMemberBenefitService.java @@ -0,0 +1,56 @@ +package cn.iocoder.yudao.module.member.service.memberbenefit; + +import java.util.*; +import javax.validation.*; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitPageReqVO; +import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitSaveReqVO; +import cn.iocoder.yudao.module.member.dal.dataobject.memberbenefit.PaidMemberBenefitDO; + +/** + * 付费会员权益 Service 接口 + * + * @author 管理员 + */ +public interface PaidMemberBenefitService { + + /** + * 创建付费会员权益 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createPaidMemberBenefit(@Valid PaidMemberBenefitSaveReqVO createReqVO); + + /** + * 更新付费会员权益 + * + * @param updateReqVO 更新信息 + */ + void updatePaidMemberBenefit(@Valid PaidMemberBenefitSaveReqVO updateReqVO); + + /** + * 删除付费会员权益 + * + * @param id 编号 + */ + void deletePaidMemberBenefit(Long id); + + /** + * 获得付费会员权益 + * + * @param id 编号 + * @return 付费会员权益 + */ + PaidMemberBenefitDO getPaidMemberBenefit(Long id); + + /** + * 获得付费会员权益分页 + * + * @param pageReqVO 分页查询 + * @return 付费会员权益分页 + */ + PageResult getPaidMemberBenefitPage(PaidMemberBenefitPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberbenefit/PaidMemberBenefitServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberbenefit/PaidMemberBenefitServiceImpl.java new file mode 100644 index 0000000..16b4e37 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberbenefit/PaidMemberBenefitServiceImpl.java @@ -0,0 +1,75 @@ +package cn.iocoder.yudao.module.member.service.memberbenefit; + +import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitPageReqVO; +import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.PaidMemberBenefitSaveReqVO; +import cn.iocoder.yudao.module.member.dal.dataobject.memberbenefit.PaidMemberBenefitDO; +import cn.iocoder.yudao.module.member.dal.mysql.memberbenefit.PaidMemberBenefitMapper; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; + + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.PAID_MEMBER_BENEFIT_NOT_EXISTS; + +/** + * 付费会员权益 Service 实现类 + * + * @author 管理员 + */ +@Service +@Validated +public class PaidMemberBenefitServiceImpl implements PaidMemberBenefitService { + + @Resource + private PaidMemberBenefitMapper paidMemberBenefitMapper; + + @Override + public Long createPaidMemberBenefit(PaidMemberBenefitSaveReqVO createReqVO) { + // 插入 + PaidMemberBenefitDO paidMemberBenefit = BeanUtils.toBean(createReqVO, PaidMemberBenefitDO.class); + paidMemberBenefitMapper.insert(paidMemberBenefit); + // 返回 + return paidMemberBenefit.getId(); + } + + @Override + public void updatePaidMemberBenefit(PaidMemberBenefitSaveReqVO updateReqVO) { + // 校验存在 + validatePaidMemberBenefitExists(updateReqVO.getId()); + // 更新 + PaidMemberBenefitDO updateObj = BeanUtils.toBean(updateReqVO, PaidMemberBenefitDO.class); + paidMemberBenefitMapper.updateById(updateObj); + } + + @Override + public void deletePaidMemberBenefit(Long id) { + // 校验存在 + validatePaidMemberBenefitExists(id); + // 删除 + paidMemberBenefitMapper.deleteById(id); + } + + private void validatePaidMemberBenefitExists(Long id) { + if (paidMemberBenefitMapper.selectById(id) == null) { + throw exception(PAID_MEMBER_BENEFIT_NOT_EXISTS); + } + } + + @Override + public PaidMemberBenefitDO getPaidMemberBenefit(Long id) { + return paidMemberBenefitMapper.selectById(id); + } + + @Override + public PageResult getPaidMemberBenefitPage(PaidMemberBenefitPageReqVO pageReqVO) { + return paidMemberBenefitMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberbenefitlevelrelation/MemberBenefitLevelRelationService.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberbenefitlevelrelation/MemberBenefitLevelRelationService.java new file mode 100644 index 0000000..8c0961c --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberbenefitlevelrelation/MemberBenefitLevelRelationService.java @@ -0,0 +1,56 @@ +package cn.iocoder.yudao.module.member.service.memberbenefitlevelrelation; + +import java.util.*; +import javax.validation.*; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.MemberBenefitLevelRelationPageReqVO; +import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.MemberBenefitLevelRelationSaveReqVO; +import cn.iocoder.yudao.module.member.dal.dataobject.memberbenefitlevelrelation.MemberBenefitLevelRelationDO; + +/** + * 会员权益和等级关系 Service 接口 + * + * @author 管理员 + */ +public interface MemberBenefitLevelRelationService { + + /** + * 创建会员权益和等级关系 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createMemberBenefitLevelRelation(@Valid MemberBenefitLevelRelationSaveReqVO createReqVO); + + /** + * 更新会员权益和等级关系 + * + * @param updateReqVO 更新信息 + */ + void updateMemberBenefitLevelRelation(@Valid MemberBenefitLevelRelationSaveReqVO updateReqVO); + + /** + * 删除会员权益和等级关系 + * + * @param id 编号 + */ + void deleteMemberBenefitLevelRelation(Long id); + + /** + * 获得会员权益和等级关系 + * + * @param id 编号 + * @return 会员权益和等级关系 + */ + MemberBenefitLevelRelationDO getMemberBenefitLevelRelation(Long id); + + /** + * 获得会员权益和等级关系分页 + * + * @param pageReqVO 分页查询 + * @return 会员权益和等级关系分页 + */ + PageResult getMemberBenefitLevelRelationPage(MemberBenefitLevelRelationPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberbenefitlevelrelation/MemberBenefitLevelRelationServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberbenefitlevelrelation/MemberBenefitLevelRelationServiceImpl.java new file mode 100644 index 0000000..9724384 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/memberbenefitlevelrelation/MemberBenefitLevelRelationServiceImpl.java @@ -0,0 +1,75 @@ +package cn.iocoder.yudao.module.member.service.memberbenefitlevelrelation; + +import cn.iocoder.yudao.framework.common.exception.ErrorCode; +import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.MemberBenefitLevelRelationPageReqVO; +import cn.iocoder.yudao.module.member.controller.admin.memberbenefit.vo.MemberBenefitLevelRelationSaveReqVO; +import cn.iocoder.yudao.module.member.dal.dataobject.memberbenefitlevelrelation.MemberBenefitLevelRelationDO; +import cn.iocoder.yudao.module.member.dal.mysql.memberbenefitlevelrelation.MemberBenefitLevelRelationMapper; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; + + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.PAID_MEMBER_BENEFIT_LEVEL_RELATION_NOT_EXISTS; + +/** + * 会员权益和等级关系 Service 实现类 + * + * @author 管理员 + */ +@Service +@Validated +public class MemberBenefitLevelRelationServiceImpl implements MemberBenefitLevelRelationService { + @Resource + private MemberBenefitLevelRelationMapper memberBenefitLevelRelationMapper; + + @Override + public Long createMemberBenefitLevelRelation(MemberBenefitLevelRelationSaveReqVO createReqVO) { + // 插入 + MemberBenefitLevelRelationDO memberBenefitLevelRelation = BeanUtils.toBean(createReqVO, MemberBenefitLevelRelationDO.class); + memberBenefitLevelRelationMapper.insert(memberBenefitLevelRelation); + // 返回 + return memberBenefitLevelRelation.getId(); + } + + @Override + public void updateMemberBenefitLevelRelation(MemberBenefitLevelRelationSaveReqVO updateReqVO) { + // 校验存在 + validateMemberBenefitLevelRelationExists(updateReqVO.getId()); + // 更新 + MemberBenefitLevelRelationDO updateObj = BeanUtils.toBean(updateReqVO, MemberBenefitLevelRelationDO.class); + memberBenefitLevelRelationMapper.updateById(updateObj); + } + + @Override + public void deleteMemberBenefitLevelRelation(Long id) { + // 校验存在 + validateMemberBenefitLevelRelationExists(id); + // 删除 + memberBenefitLevelRelationMapper.deleteById(id); + } + + private void validateMemberBenefitLevelRelationExists(Long id) { + if (memberBenefitLevelRelationMapper.selectById(id) == null) { + throw exception(PAID_MEMBER_BENEFIT_LEVEL_RELATION_NOT_EXISTS); + } + } + + @Override + public MemberBenefitLevelRelationDO getMemberBenefitLevelRelation(Long id) { + return memberBenefitLevelRelationMapper.selectById(id); + } + + @Override + public PageResult getMemberBenefitLevelRelationPage(MemberBenefitLevelRelationPageReqVO pageReqVO) { + return memberBenefitLevelRelationMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file