会员权益列表 #50

Merged
root merged 1 commits from khy1 into master 2024-10-17 11:24:10 +08:00
6 changed files with 96 additions and 0 deletions

View File

@ -0,0 +1,37 @@
package cn.iocoder.yudao.module.member.controller.app.benefit;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.member.controller.app.benefit.vo.AppMemberBenefitRespVO;
import cn.iocoder.yudao.module.member.convert.benefit.MemberBenefitConvert;
import cn.iocoder.yudao.module.member.dal.dataobject.memberbenefit.PaidMemberBenefitDO;
import cn.iocoder.yudao.module.member.service.memberbenefit.PaidMemberBenefitService;
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.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "用户 App - 付费会员权益")
@RestController
@RequestMapping("/member/benefit")
@Validated
public class AppMemberBenefitController {
@Resource
private PaidMemberBenefitService paidMemberBenefitService;
@GetMapping("/list")
@Operation(summary = "获得会员权益列表")
public CommonResult<List<AppMemberBenefitRespVO>> getPaidMemberBenefitPage() {
List<PaidMemberBenefitDO> list = paidMemberBenefitService.getMemberBenefitList(CommonStatusEnum.DISABLE.getStatus());
return success(MemberBenefitConvert.INSTANCE.convertList(list));
}
}

View File

@ -0,0 +1,23 @@
package cn.iocoder.yudao.module.member.controller.app.benefit.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "用户 App - 会员权益 Response VOO")
@Data
public class AppMemberBenefitRespVO {
@Schema(description = "权益名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
private String benName;
@Schema(description = "展示名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
private String showName;
@Schema(description = "图标地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn")
private String iconUrl;
@Schema(description = "描述")
private String intro;
}

View File

@ -0,0 +1,19 @@
package cn.iocoder.yudao.module.member.convert.benefit;
import cn.iocoder.yudao.module.member.controller.app.benefit.vo.AppMemberBenefitRespVO;
import cn.iocoder.yudao.module.member.dal.dataobject.memberbenefit.PaidMemberBenefitDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* 会员权益 Convert
*/
@Mapper
public interface MemberBenefitConvert {
MemberBenefitConvert INSTANCE = Mappers.getMapper(MemberBenefitConvert.class);
List<AppMemberBenefitRespVO> convertList(List<PaidMemberBenefitDO> list);
}

View File

@ -29,4 +29,8 @@ public interface PaidMemberBenefitMapper extends BaseMapperX<PaidMemberBenefitDO
.orderByDesc(PaidMemberBenefitDO::getId));
}
default List<PaidMemberBenefitDO> selectListByStatus(Integer status){
return selectList(PaidMemberBenefitDO::getStatus, status);
}
}

View File

@ -59,4 +59,11 @@ public interface PaidMemberBenefitService {
* @return void
*/
void updatePaidMemberBenefitStatus(PaidMemberBenefitStatusReqVO req);
/**
* 查询付费会员列表
* @param status
* @return
*/
List<PaidMemberBenefitDO> getMemberBenefitList(Integer status);
}

View File

@ -82,4 +82,10 @@ public class PaidMemberBenefitServiceImpl implements PaidMemberBenefitService {
paidMemberBenefitMapper.updateById(new PaidMemberBenefitDO().setId(req.getId()).setStatus(req.getStatus()));
}
@Override
public List<PaidMemberBenefitDO> getMemberBenefitList(Integer status) {
List<PaidMemberBenefitDO> list = paidMemberBenefitMapper.selectListByStatus(status);
return list;
}
}