From 228fe0cc824a6c02a6ac700c8519aed4ee014fcf Mon Sep 17 00:00:00 2001 From: khy <2908249413@qq.com> Date: Thu, 17 Oct 2024 09:19:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=9A=E5=91=98=E7=B1=BB=E5=9E=8B=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/member/type/cardForm.vue | 6 ++- .../app/type/AppMemberCardTypeController.java | 37 +++++++++++++++++++ .../app/type/vo/AppMemberCardTypeRespVO.java | 25 +++++++++++++ .../convert/type/MemberCardTypeConvert.java | 17 +++++++++ .../PaidMemberCardTypeMapper.java | 5 +++ .../PaidMemberCardTypeService.java | 3 ++ .../PaidMemberCardTypeServiceImpl.java | 9 +++++ 7 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/type/AppMemberCardTypeController.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/type/vo/AppMemberCardTypeRespVO.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/type/MemberCardTypeConvert.java diff --git a/yudao-admin-vue3/src/views/member/type/cardForm.vue b/yudao-admin-vue3/src/views/member/type/cardForm.vue index d0af1a2..b8c6a55 100644 --- a/yudao-admin-vue3/src/views/member/type/cardForm.vue +++ b/yudao-admin-vue3/src/views/member/type/cardForm.vue @@ -11,7 +11,11 @@ - + diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/type/AppMemberCardTypeController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/type/AppMemberCardTypeController.java new file mode 100644 index 0000000..79c4305 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/type/AppMemberCardTypeController.java @@ -0,0 +1,37 @@ +package cn.iocoder.yudao.module.member.controller.app.type; + +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.module.member.controller.app.type.vo.AppMemberCardTypeRespVO; +import cn.iocoder.yudao.module.member.convert.type.MemberCardTypeConvert; +import cn.iocoder.yudao.module.member.dal.dataobject.membercardtype.PaidMemberCardTypeDO; +import cn.iocoder.yudao.module.member.service.membercardtype.PaidMemberCardTypeService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +@Tag(name = "用户 App - 会员卡类型") +@RestController +@RequestMapping("/member/card/type") +@Validated +public class AppMemberCardTypeController { + + @Resource + private PaidMemberCardTypeService cardService; + + + @GetMapping("/list") + @Operation(summary = "获得会员卡类型列表") + public CommonResult> list() { + /** 查询状态为启用的会员卡类型列表*/ + List list = cardService.getCardTypeList(CommonStatusEnum.DISABLE.getStatus()); + return success(MemberCardTypeConvert.INSTANCE.convertList(list)); + } + +} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/type/vo/AppMemberCardTypeRespVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/type/vo/AppMemberCardTypeRespVO.java new file mode 100644 index 0000000..a38279a --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/type/vo/AppMemberCardTypeRespVO.java @@ -0,0 +1,25 @@ +package cn.iocoder.yudao.module.member.controller.app.type.vo; + +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +@Schema(description = "用户 App - 会员卡类型 Response VO") +@Data +public class AppMemberCardTypeRespVO { + @Schema(description = "会员卡名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") + private String name; + + @Schema(description = "会员有效期(天)", requiredMode = Schema.RequiredMode.REQUIRED, example = "13455") + private String vid; + + @Schema(description = "会员卡原价", requiredMode = Schema.RequiredMode.REQUIRED, example = "32259") + private BigDecimal originalPrice; + + @Schema(description = "会员卡优惠价", example = "12301") + private BigDecimal specialPrice; +} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/type/MemberCardTypeConvert.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/type/MemberCardTypeConvert.java new file mode 100644 index 0000000..5942d21 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/type/MemberCardTypeConvert.java @@ -0,0 +1,17 @@ +package cn.iocoder.yudao.module.member.convert.type; + +import cn.iocoder.yudao.module.member.controller.app.type.vo.AppMemberCardTypeRespVO; +import cn.iocoder.yudao.module.member.dal.dataobject.membercardtype.PaidMemberCardTypeDO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + + +@Mapper +public interface MemberCardTypeConvert { + + MemberCardTypeConvert INSTANCE = Mappers.getMapper(MemberCardTypeConvert.class); + + List convertList(List list); +} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/membercardtype/PaidMemberCardTypeMapper.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/membercardtype/PaidMemberCardTypeMapper.java index 3a5127c..958bc77 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/membercardtype/PaidMemberCardTypeMapper.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/membercardtype/PaidMemberCardTypeMapper.java @@ -7,6 +7,8 @@ import cn.iocoder.yudao.module.member.controller.admin.membercardtype.vo.PaidMem import cn.iocoder.yudao.module.member.dal.dataobject.membercardtype.PaidMemberCardTypeDO; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 会员卡类型 Mapper * @@ -26,4 +28,7 @@ public interface PaidMemberCardTypeMapper extends BaseMapperX selectListByStatus(Integer status){ + return selectList(PaidMemberCardTypeDO::getStatus, status); + } } \ 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/membercardtype/PaidMemberCardTypeService.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/membercardtype/PaidMemberCardTypeService.java index c7f382a..8f79e8a 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/membercardtype/PaidMemberCardTypeService.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/membercardtype/PaidMemberCardTypeService.java @@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.member.controller.admin.membercardtype.vo.PaidMem import cn.iocoder.yudao.module.member.dal.dataobject.membercardtype.PaidMemberCardTypeDO; import javax.validation.Valid; +import java.util.List; /** * 会员卡类型 Service 接口 @@ -52,4 +53,6 @@ public interface PaidMemberCardTypeService { */ PageResult getcardPage(PaidMemberCardTypePageReqVO pageReqVO); + List getCardTypeList (Integer status); + } \ 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/membercardtype/PaidMemberCardTypeServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/membercardtype/PaidMemberCardTypeServiceImpl.java index d6a01c0..8e7480a 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/membercardtype/PaidMemberCardTypeServiceImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/membercardtype/PaidMemberCardTypeServiceImpl.java @@ -11,6 +11,8 @@ import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; +import java.util.List; + import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.CARD_NOT_EXISTS; @@ -68,4 +70,11 @@ public class PaidMemberCardTypeServiceImpl implements PaidMemberCardTypeService return cardMapper.selectPage(pageReqVO); } + @Override + public List getCardTypeList(Integer status) { + List list = cardMapper.selectListByStatus(status); + return list; + } + + } \ No newline at end of file -- 2.45.2