Merge pull request '会员类型列表' (#49) from khy into master
All checks were successful
continuous-integration/drone/push Build is passing

Reviewed-on: #49
This commit is contained in:
root 2024-10-17 09:28:44 +08:00
commit 2c875571ee
7 changed files with 101 additions and 1 deletions

View File

@ -11,7 +11,11 @@
<el-input v-model="formData.name" placeholder="请输入会员卡名称" /> <el-input v-model="formData.name" placeholder="请输入会员卡名称" />
</el-form-item> </el-form-item>
<el-form-item label="会员有效期(天)" prop="vid"> <el-form-item label="会员有效期(天)" prop="vid">
<el-input v-model="formData.vid" placeholder="请输入会员有效期(天)" /> <el-input
v-model="formData.vid"
placeholder="请输入会员有效期(天)"
:disabled="formData.id !== undefined && formData.name === '永久'"
/>
</el-form-item> </el-form-item>
<el-form-item label="会员卡原价" prop="originalPrice"> <el-form-item label="会员卡原价" prop="originalPrice">
<el-input v-model="formData.originalPrice" placeholder="请输入会员卡原价" /> <el-input v-model="formData.originalPrice" placeholder="请输入会员卡原价" />

View File

@ -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<AppMemberCardTypeRespVO>> list() {
/** 查询状态为启用的会员卡类型列表*/
List<PaidMemberCardTypeDO> list = cardService.getCardTypeList(CommonStatusEnum.DISABLE.getStatus());
return success(MemberCardTypeConvert.INSTANCE.convertList(list));
}
}

View File

@ -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;
}

View File

@ -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<AppMemberCardTypeRespVO> convertList(List<PaidMemberCardTypeDO> list);
}

View File

@ -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 cn.iocoder.yudao.module.member.dal.dataobject.membercardtype.PaidMemberCardTypeDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* 会员卡类型 Mapper * 会员卡类型 Mapper
* *
@ -26,4 +28,7 @@ public interface PaidMemberCardTypeMapper extends BaseMapperX<PaidMemberCardType
.orderByDesc(PaidMemberCardTypeDO::getId)); .orderByDesc(PaidMemberCardTypeDO::getId));
} }
default List<PaidMemberCardTypeDO> selectListByStatus(Integer status){
return selectList(PaidMemberCardTypeDO::getStatus, status);
}
} }

View File

@ -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 cn.iocoder.yudao.module.member.dal.dataobject.membercardtype.PaidMemberCardTypeDO;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.List;
/** /**
* 会员卡类型 Service 接口 * 会员卡类型 Service 接口
@ -52,4 +53,6 @@ public interface PaidMemberCardTypeService {
*/ */
PageResult<PaidMemberCardTypeDO> getcardPage(PaidMemberCardTypePageReqVO pageReqVO); PageResult<PaidMemberCardTypeDO> getcardPage(PaidMemberCardTypePageReqVO pageReqVO);
List<PaidMemberCardTypeDO> getCardTypeList (Integer status);
} }

View File

@ -11,6 +11,8 @@ import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.CARD_NOT_EXISTS; 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); return cardMapper.selectPage(pageReqVO);
} }
@Override
public List<PaidMemberCardTypeDO> getCardTypeList(Integer status) {
List<PaidMemberCardTypeDO> list = cardMapper.selectListByStatus(status);
return list;
}
} }