Commit 659913ee authored by zhaobiyan's avatar zhaobiyan

会员积分模块

parent 4dd96931
package cn.iocoder.yudao.module.member.api.memberUserScore;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.member.convert.memberUserScore.MemberUserScoreConvert;
import cn.iocoder.yudao.module.member.dal.dataobject.memberUserScore.MemberUserScoreDO;
import cn.iocoder.yudao.module.member.service.memberUserScore.MemberUserScoreService;
import cn.iocoder.yudao.module.member.vo.memberUserScore.MemberUserScoreBackVO;
import cn.iocoder.yudao.module.member.vo.memberUserScore.MemberUserScoreQueryVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
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 javax.validation.Valid;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Validated
@RestController
@Api(tags = "管理后台 - 会员积分")
@RequestMapping("/member/user-score")
public class MemberUserScoreController {
@Resource
private MemberUserScoreService userScoreService;
@GetMapping("/page")
@ApiOperation("获得会员积分分页")
@PreAuthorize("@ss.hasPermission('member:user-score:query')")
public CommonResult<PageResult<MemberUserScoreBackVO>> getUserScorePage(@Valid MemberUserScoreQueryVO query, PageVO page) {
PageResult<MemberUserScoreBackVO> pageResult = userScoreService.getUserScorePage(query, page);
return success(pageResult);
}
}
package cn.iocoder.yudao.module.member.convert.memberUserScore;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* 会员积分 Convert
* @author 系统管理员
*/
@Mapper
public interface MemberUserScoreConvert {
/*****转换MapStruct*****/
MemberUserScoreConvert INSTANCE = Mappers.getMapper(MemberUserScoreConvert.class);
}
package cn.iocoder.yudao.module.member.dal.dataobject.memberUserScore;
public class MemberUserScoreBackDO {
}
package cn.iocoder.yudao.module.member.dal.dataobject.memberUserScore;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
/**
* 会员积分 DO
*
* @author 系统管理员
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("member_user_score")
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MemberUserScoreDO extends BaseDO {
/**
* 主键
*/
@TableId
private Long id;
/**
* 会员id
*/
private Long memberId;
/**
* 持有积分
*/
private Integer holdScore;
/**
* 已使用积分
*/
private Integer usedScore;
/**
* 过期积分
*/
private Integer expiredScore;
}
package cn.iocoder.yudao.module.member.dal.mysql.memberUserScore;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.member.dal.dataobject.memberUserScore.MemberUserScoreDO;
import cn.iocoder.yudao.module.member.vo.memberUserScore.MemberUserScoreQueryVO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 会员积分 Mapper
* @author 系统管理员
*/
@Mapper
public interface MemberUserScoreMapper extends AbstractMapper<MemberUserScoreDO> {
@Override
default PageResult<MemberUserScoreDO> selectPage(PageVO page, Object object) {
if (object instanceof MemberUserScoreQueryVO) {
MemberUserScoreQueryVO vo = (MemberUserScoreQueryVO)object;
return selectPage(page, new LambdaQuery<MemberUserScoreDO>()
.eqIfPresent(MemberUserScoreDO::getMemberId, vo.getMemberId())
.eqIfPresent(MemberUserScoreDO::getHoldScore, vo.getHoldScore())
.eqIfPresent(MemberUserScoreDO::getUsedScore, vo.getUsedScore())
.eqIfPresent(MemberUserScoreDO::getExpiredScore, vo.getExpiredScore())
.betweenIfPresent(MemberUserScoreDO::getCreateTime, vo.getBeginCreateTime(), vo.getEndCreateTime())
.orderByDesc(MemberUserScoreDO::getId));
}
return null;
}
@Override
default List<MemberUserScoreDO> selectList(Object object) {
if (object instanceof MemberUserScoreQueryVO) {
MemberUserScoreQueryVO vo = (MemberUserScoreQueryVO)object;
return selectList(new LambdaQuery<MemberUserScoreDO>()
.eqIfPresent(MemberUserScoreDO::getMemberId, vo.getMemberId())
.eqIfPresent(MemberUserScoreDO::getHoldScore, vo.getHoldScore())
.eqIfPresent(MemberUserScoreDO::getUsedScore, vo.getUsedScore())
.eqIfPresent(MemberUserScoreDO::getExpiredScore, vo.getExpiredScore())
.betweenIfPresent(MemberUserScoreDO::getCreateTime, vo.getBeginCreateTime(), vo.getEndCreateTime())
.orderByDesc(MemberUserScoreDO::getId));
}
return null;
}
}
package cn.iocoder.yudao.module.member.service.memberUserScore;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import cn.iocoder.yudao.module.member.vo.memberUserScore.*;
import cn.iocoder.yudao.module.member.dal.dataobject.memberUserScore.MemberUserScoreDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
/**
* 会员积分 Service 接口
*
* @author 系统管理员
*/
public interface MemberUserScoreService extends IService<MemberUserScoreDO> {
/**
* 删除会员积分
* @param id 编号
*/
void deleteUserScore(Long id);
/**
* 获得会员积分
* @param id 编号
* @return 会员积分
*/
MemberUserScoreDO getUserScore(Long id);
/**
* 获得会员积分列表
* @param ids 编号
* @return 会员积分列表
*/
List<MemberUserScoreDO> getUserScoreList(Collection<Long> ids);
/**
* 获得会员积分分页
* @param page 分页查询
* @param query 查询
* @return 会员积分分页
*/
PageResult<MemberUserScoreBackVO> getUserScorePage(MemberUserScoreQueryVO query, PageVO page);
/**
* 获得会员积分列表, 用于 Excel 导出
* @param query 查询
* @return 会员积分列表
*/
List<MemberUserScoreDO> getUserScoreList(MemberUserScoreQueryVO query);
}
package cn.iocoder.yudao.module.member.service.memberUserScore;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.member.convert.memberUserScore.MemberUserScoreConvert;
import cn.iocoder.yudao.module.member.dal.dataobject.memberUserScore.MemberUserScoreDO;
import cn.iocoder.yudao.module.member.dal.mysql.memberUserScore.MemberUserScoreMapper;
import cn.iocoder.yudao.module.member.vo.memberUserScore.MemberUserScoreBackVO;
import cn.iocoder.yudao.module.member.vo.memberUserScore.MemberUserScoreQueryVO;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;
/**
* 会员积分 Service 实现类
*
* @author 系统管理员
*/
@Service
@Validated
public class MemberUserScoreServiceImpl extends AbstractService<MemberUserScoreMapper, MemberUserScoreDO> implements MemberUserScoreService {
@Resource
private MemberUserScoreMapper userScoreMapper;
@Override
public void deleteUserScore(Long id) {
// 删除
userScoreMapper.deleteById(id);
}
@Override
public MemberUserScoreDO getUserScore(Long id) {
return userScoreMapper.selectById(id);
}
@Override
public List<MemberUserScoreDO> getUserScoreList(Collection<Long> ids) {
return userScoreMapper.selectBatchIds(ids);
}
@Override
public PageResult<MemberUserScoreBackVO> getUserScorePage(MemberUserScoreQueryVO query, PageVO page) {
PageResult<MemberUserScoreBackVO> pageResult = new PageResult<>();
pageResult.set
return pageResult;
}
@Override
public List<MemberUserScoreDO> getUserScoreList(MemberUserScoreQueryVO query) {
return userScoreMapper.selectList(query);
}
}
package cn.iocoder.yudao.module.member.vo.memberUserScore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author zhaobiyan
*/
@Data
@ApiModel("管理后台 - 会员积分查询 VO")
public class MemberUserScoreBackVO {
@ApiModelProperty(value = "会员id")
private String id;
@ApiModelProperty(value = "会员昵称")
private String nickname;
@ApiModelProperty(value = "联系方式")
private String areaCodeMobile;
@ApiModelProperty(value = "国家")
private String countryName;
@ApiModelProperty(value = "当前积分")
private Integer holdScore;
@ApiModelProperty(value = "已兑换积分")
private Integer usedScore;
@ApiModelProperty(value = "会员注册时间")
private Date createTime;
}
package cn.iocoder.yudao.module.member.vo.memberUserScore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* @author zhaobiyan
*/
@Data
@ApiModel("管理后台 - 会员积分查询 VO")
public class MemberUserScoreQueryVO {
@ApiModelProperty(value = "关键词")
private String key;
@ApiModelProperty(value = "国家")
private String country;
@ApiModelProperty(value = "当前积分")
private Integer holdScore;
@ApiModelProperty(value = "当前积分操作")
private Integer holdScoreOperate;
@ApiModelProperty(value = "已使用积分")
private Integer usedScore;
@ApiModelProperty(value = "已使用积分操作")
private Integer usedScoreOperate;
@ApiModelProperty(value = "会员创建时间开始")
private Date memberCreateTimeStart;
@ApiModelProperty(value = "会员创建时间结束")
private Date memberCreateTimeEnd;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment