会员: 统一用户等级记录、用户经验记录 命名

This commit is contained in:
owen 2023-08-22 20:49:25 +08:00
parent bdb38c4157
commit ca51056c00
24 changed files with 182 additions and 184 deletions

View File

@ -22,7 +22,7 @@ create table member_level
) )
comment '会员等级'; comment '会员等级';
create table member_level_log create table member_level_record
( (
id bigint auto_increment comment '编号' primary key, id bigint auto_increment comment '编号' primary key,
user_id bigint default 0 not null comment '用户编号', user_id bigint default 0 not null comment '用户编号',
@ -42,9 +42,9 @@ create table member_level_log
) )
comment '会员等级记录'; comment '会员等级记录';
create index idx_user_id on member_level_log (user_id) comment '会员等级记录-用户编号'; create index idx_user_id on member_level_record (user_id) comment '会员等级记录-用户编号';
create table member_experience_log create table member_experience_record
( (
id bigint auto_increment comment '编号' primary key, id bigint auto_increment comment '编号' primary key,
user_id bigint default 0 not null comment '用户编号', user_id bigint default 0 not null comment '用户编号',
@ -63,8 +63,8 @@ create table member_experience_log
) )
comment '会员经验记录'; comment '会员经验记录';
create index idx_user_id on member_experience_log (user_id) comment '会员经验记录-用户编号'; create index idx_user_id on member_experience_record (user_id) comment '会员经验记录-用户编号';
create index idx_user_biz_type on member_experience_log (user_id, biz_type) comment '会员经验记录-用户业务类型'; create index idx_user_biz_type on member_experience_record (user_id, biz_type) comment '会员经验记录-用户业务类型';
-- 增加字典 -- 增加字典
insert system_dict_type(name, type) values ('会员经验业务类型', 'member_experience_biz_type'); insert system_dict_type(name, type) values ('会员经验业务类型', 'member_experience_biz_type');

View File

@ -2,11 +2,11 @@ package cn.iocoder.yudao.module.member.controller.admin.level;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.controller.admin.level.vo.experience.MemberExperienceLogPageReqVO; import cn.iocoder.yudao.module.member.controller.admin.level.vo.experience.MemberExperienceRecordPageReqVO;
import cn.iocoder.yudao.module.member.controller.admin.level.vo.experience.MemberExperienceLogRespVO; import cn.iocoder.yudao.module.member.controller.admin.level.vo.experience.MemberExperienceRecordRespVO;
import cn.iocoder.yudao.module.member.convert.level.MemberExperienceLogConvert; import cn.iocoder.yudao.module.member.convert.level.MemberExperienceRecordConvert;
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberExperienceLogDO; import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberExperienceRecordDO;
import cn.iocoder.yudao.module.member.service.level.MemberExperienceLogService; import cn.iocoder.yudao.module.member.service.level.MemberExperienceRecordService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
@ -22,31 +22,30 @@ import javax.validation.Valid;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
// TODO @疯狂要不 Log 改成 Record PointRecord 保持一致
@Tag(name = "管理后台 - 会员经验记录") @Tag(name = "管理后台 - 会员经验记录")
@RestController @RestController
@RequestMapping("/member/experience-log") @RequestMapping("/member/experience-record")
@Validated @Validated
public class MemberExperienceLogController { public class MemberExperienceRecordController {
@Resource @Resource
private MemberExperienceLogService experienceLogService; private MemberExperienceRecordService experienceLogService;
@GetMapping("/get") @GetMapping("/get")
@Operation(summary = "获得会员经验记录") @Operation(summary = "获得会员经验记录")
@Parameter(name = "id", description = "编号", required = true, example = "1024") @Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('member:experience-log:query')") @PreAuthorize("@ss.hasPermission('member:experience-record:query')")
public CommonResult<MemberExperienceLogRespVO> getExperienceLog(@RequestParam("id") Long id) { public CommonResult<MemberExperienceRecordRespVO> getExperienceLog(@RequestParam("id") Long id) {
MemberExperienceLogDO experienceLog = experienceLogService.getExperienceLog(id); MemberExperienceRecordDO experienceLog = experienceLogService.getExperienceLog(id);
return success(MemberExperienceLogConvert.INSTANCE.convert(experienceLog)); return success(MemberExperienceRecordConvert.INSTANCE.convert(experienceLog));
} }
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得会员经验记录分页") @Operation(summary = "获得会员经验记录分页")
@PreAuthorize("@ss.hasPermission('member:experience-log:query')") @PreAuthorize("@ss.hasPermission('member:experience-record:query')")
public CommonResult<PageResult<MemberExperienceLogRespVO>> getExperienceLogPage(@Valid MemberExperienceLogPageReqVO pageVO) { public CommonResult<PageResult<MemberExperienceRecordRespVO>> getExperienceLogPage(@Valid MemberExperienceRecordPageReqVO pageVO) {
PageResult<MemberExperienceLogDO> pageResult = experienceLogService.getExperienceLogPage(pageVO); PageResult<MemberExperienceRecordDO> pageResult = experienceLogService.getExperienceLogPage(pageVO);
return success(MemberExperienceLogConvert.INSTANCE.convertPage(pageResult)); return success(MemberExperienceRecordConvert.INSTANCE.convertPage(pageResult));
} }
} }

View File

@ -2,11 +2,11 @@ package cn.iocoder.yudao.module.member.controller.admin.level;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.controller.admin.level.vo.log.MemberLevelLogPageReqVO; import cn.iocoder.yudao.module.member.controller.admin.level.vo.log.MemberLevelRecordPageReqVO;
import cn.iocoder.yudao.module.member.controller.admin.level.vo.log.MemberLevelLogRespVO; import cn.iocoder.yudao.module.member.controller.admin.level.vo.log.MemberLevelRecordRespVO;
import cn.iocoder.yudao.module.member.convert.level.MemberLevelLogConvert; import cn.iocoder.yudao.module.member.convert.level.MemberLevelRecordConvert;
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelLogDO; import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelRecordDO;
import cn.iocoder.yudao.module.member.service.level.MemberLevelLogService; import cn.iocoder.yudao.module.member.service.level.MemberLevelRecordService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
@ -22,30 +22,29 @@ import javax.validation.Valid;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
// TODO @疯狂是不是不用这个 controller因为日志只是为了记录db 可以查询和审计即可目前暂时不需要开放出来
@Tag(name = "管理后台 - 会员等级记录") @Tag(name = "管理后台 - 会员等级记录")
@RestController @RestController
@RequestMapping("/member/level-log") @RequestMapping("/member/level-record")
@Validated @Validated
public class MemberLevelLogController { public class MemberLevelRecordController {
@Resource @Resource
private MemberLevelLogService levelLogService; private MemberLevelRecordService levelLogService;
@GetMapping("/get") @GetMapping("/get")
@Operation(summary = "获得会员等级记录") @Operation(summary = "获得会员等级记录")
@Parameter(name = "id", description = "编号", required = true, example = "1024") @Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('member:level-log:query')") @PreAuthorize("@ss.hasPermission('member:level-record:query')")
public CommonResult<MemberLevelLogRespVO> getLevelLog(@RequestParam("id") Long id) { public CommonResult<MemberLevelRecordRespVO> getLevelLog(@RequestParam("id") Long id) {
MemberLevelLogDO levelLog = levelLogService.getLevelLog(id); MemberLevelRecordDO levelLog = levelLogService.getLevelLog(id);
return success(MemberLevelLogConvert.INSTANCE.convert(levelLog)); return success(MemberLevelRecordConvert.INSTANCE.convert(levelLog));
} }
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得会员等级记录分页") @Operation(summary = "获得会员等级记录分页")
@PreAuthorize("@ss.hasPermission('member:level-log:query')") @PreAuthorize("@ss.hasPermission('member:level-record:query')")
public CommonResult<PageResult<MemberLevelLogRespVO>> getLevelLogPage(@Valid MemberLevelLogPageReqVO pageVO) { public CommonResult<PageResult<MemberLevelRecordRespVO>> getLevelLogPage(@Valid MemberLevelRecordPageReqVO pageVO) {
PageResult<MemberLevelLogDO> pageResult = levelLogService.getLevelLogPage(pageVO); PageResult<MemberLevelRecordDO> pageResult = levelLogService.getLevelLogPage(pageVO);
return success(MemberLevelLogConvert.INSTANCE.convertPage(pageResult)); return success(MemberLevelRecordConvert.INSTANCE.convertPage(pageResult));
} }
} }

View File

@ -10,7 +10,7 @@ import javax.validation.constraints.NotNull;
* 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成 * 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
*/ */
@Data @Data
public class MemberExperienceLogBaseVO { public class MemberExperienceRecordBaseVO {
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3638") @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3638")
@NotNull(message = "用户编号不能为空") @NotNull(message = "用户编号不能为空")

View File

@ -15,7 +15,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
public class MemberExperienceLogPageReqVO extends PageParam { public class MemberExperienceRecordPageReqVO extends PageParam {
@Schema(description = "用户编号", example = "3638") @Schema(description = "用户编号", example = "3638")
private Long userId; private Long userId;

View File

@ -11,7 +11,7 @@ import java.time.LocalDateTime;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
public class MemberExperienceLogRespVO extends MemberExperienceLogBaseVO { public class MemberExperienceRecordRespVO extends MemberExperienceRecordBaseVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "19610") @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "19610")
private Long id; private Long id;

View File

@ -10,7 +10,7 @@ import javax.validation.constraints.NotNull;
* 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成 * 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
*/ */
@Data @Data
public class MemberLevelLogBaseVO { public class MemberLevelRecordBaseVO {
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "25923") @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "25923")
@NotNull(message = "用户编号不能为空") @NotNull(message = "用户编号不能为空")

View File

@ -15,7 +15,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
public class MemberLevelLogPageReqVO extends PageParam { public class MemberLevelRecordPageReqVO extends PageParam {
@Schema(description = "用户编号", example = "25923") @Schema(description = "用户编号", example = "25923")
private Long userId; private Long userId;

View File

@ -11,7 +11,7 @@ import java.time.LocalDateTime;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
public class MemberLevelLogRespVO extends MemberLevelLogBaseVO { public class MemberLevelRecordRespVO extends MemberLevelRecordBaseVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8741") @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8741")
private Long id; private Long id;

View File

@ -1,27 +0,0 @@
package cn.iocoder.yudao.module.member.convert.level;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.controller.admin.level.vo.experience.MemberExperienceLogRespVO;
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberExperienceLogDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* 会员经验记录 Convert
*
* @author owen
*/
@Mapper
public interface MemberExperienceLogConvert {
MemberExperienceLogConvert INSTANCE = Mappers.getMapper(MemberExperienceLogConvert.class);
MemberExperienceLogRespVO convert(MemberExperienceLogDO bean);
List<MemberExperienceLogRespVO> convertList(List<MemberExperienceLogDO> list);
PageResult<MemberExperienceLogRespVO> convertPage(PageResult<MemberExperienceLogDO> page);
}

View File

@ -0,0 +1,27 @@
package cn.iocoder.yudao.module.member.convert.level;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.controller.admin.level.vo.experience.MemberExperienceRecordRespVO;
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberExperienceRecordDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* 会员经验记录 Convert
*
* @author owen
*/
@Mapper
public interface MemberExperienceRecordConvert {
MemberExperienceRecordConvert INSTANCE = Mappers.getMapper(MemberExperienceRecordConvert.class);
MemberExperienceRecordRespVO convert(MemberExperienceRecordDO bean);
List<MemberExperienceRecordRespVO> convertList(List<MemberExperienceRecordDO> list);
PageResult<MemberExperienceRecordRespVO> convertPage(PageResult<MemberExperienceRecordDO> page);
}

View File

@ -1,27 +0,0 @@
package cn.iocoder.yudao.module.member.convert.level;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.controller.admin.level.vo.log.MemberLevelLogRespVO;
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelLogDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* 会员等级记录 Convert
*
* @author owen
*/
@Mapper
public interface MemberLevelLogConvert {
MemberLevelLogConvert INSTANCE = Mappers.getMapper(MemberLevelLogConvert.class);
MemberLevelLogRespVO convert(MemberLevelLogDO bean);
List<MemberLevelLogRespVO> convertList(List<MemberLevelLogDO> list);
PageResult<MemberLevelLogRespVO> convertPage(PageResult<MemberLevelLogDO> page);
}

View File

@ -0,0 +1,27 @@
package cn.iocoder.yudao.module.member.convert.level;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.controller.admin.level.vo.log.MemberLevelRecordRespVO;
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelRecordDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* 会员等级记录 Convert
*
* @author owen
*/
@Mapper
public interface MemberLevelRecordConvert {
MemberLevelRecordConvert INSTANCE = Mappers.getMapper(MemberLevelRecordConvert.class);
MemberLevelRecordRespVO convert(MemberLevelRecordDO bean);
List<MemberLevelRecordRespVO> convertList(List<MemberLevelRecordDO> list);
PageResult<MemberLevelRecordRespVO> convertPage(PageResult<MemberLevelRecordDO> page);
}

View File

@ -12,15 +12,15 @@ import lombok.*;
* *
* @author owen * @author owen
*/ */
@TableName("member_experience_log") @TableName("member_experience_record")
@KeySequence("member_experience_log_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写 @KeySequence("member_experience_record_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class MemberExperienceLogDO extends BaseDO { public class MemberExperienceRecordDO extends BaseDO {
/** /**
* 编号 * 编号

View File

@ -13,15 +13,15 @@ import lombok.*;
* *
* @author owen * @author owen
*/ */
@TableName("member_level_log") @TableName("member_level_record")
@KeySequence("member_level_log_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写 @KeySequence("member_level_record_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class MemberLevelLogDO extends BaseDO { public class MemberLevelRecordDO extends BaseDO {
/** /**
* 编号 * 编号

View File

@ -1,28 +0,0 @@
package cn.iocoder.yudao.module.member.dal.mysql.level;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.member.controller.admin.level.vo.experience.MemberExperienceLogPageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberExperienceLogDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 会员经验记录 Mapper
*
* @author owen
*/
@Mapper
public interface MemberExperienceLogMapper extends BaseMapperX<MemberExperienceLogDO> {
default PageResult<MemberExperienceLogDO> selectPage(MemberExperienceLogPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<MemberExperienceLogDO>()
.eqIfPresent(MemberExperienceLogDO::getUserId, reqVO.getUserId())
.eqIfPresent(MemberExperienceLogDO::getBizId, reqVO.getBizId())
.eqIfPresent(MemberExperienceLogDO::getBizType, reqVO.getBizType())
.eqIfPresent(MemberExperienceLogDO::getTitle, reqVO.getTitle())
.betweenIfPresent(MemberExperienceLogDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(MemberExperienceLogDO::getId));
}
}

View File

@ -0,0 +1,28 @@
package cn.iocoder.yudao.module.member.dal.mysql.level;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.member.controller.admin.level.vo.experience.MemberExperienceRecordPageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberExperienceRecordDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 会员经验记录 Mapper
*
* @author owen
*/
@Mapper
public interface MemberExperienceRecordMapper extends BaseMapperX<MemberExperienceRecordDO> {
default PageResult<MemberExperienceRecordDO> selectPage(MemberExperienceRecordPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<MemberExperienceRecordDO>()
.eqIfPresent(MemberExperienceRecordDO::getUserId, reqVO.getUserId())
.eqIfPresent(MemberExperienceRecordDO::getBizId, reqVO.getBizId())
.eqIfPresent(MemberExperienceRecordDO::getBizType, reqVO.getBizType())
.eqIfPresent(MemberExperienceRecordDO::getTitle, reqVO.getTitle())
.betweenIfPresent(MemberExperienceRecordDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(MemberExperienceRecordDO::getId));
}
}

View File

@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.member.dal.mysql.level;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.member.controller.admin.level.vo.log.MemberLevelLogPageReqVO; import cn.iocoder.yudao.module.member.controller.admin.level.vo.log.MemberLevelRecordPageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelLogDO; import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelRecordDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
/** /**
@ -13,14 +13,14 @@ import org.apache.ibatis.annotations.Mapper;
* @author owen * @author owen
*/ */
@Mapper @Mapper
public interface MemberLevelLogMapper extends BaseMapperX<MemberLevelLogDO> { public interface MemberLevelRecordMapper extends BaseMapperX<MemberLevelRecordDO> {
default PageResult<MemberLevelLogDO> selectPage(MemberLevelLogPageReqVO reqVO) { default PageResult<MemberLevelRecordDO> selectPage(MemberLevelRecordPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<MemberLevelLogDO>() return selectPage(reqVO, new LambdaQueryWrapperX<MemberLevelRecordDO>()
.eqIfPresent(MemberLevelLogDO::getUserId, reqVO.getUserId()) .eqIfPresent(MemberLevelRecordDO::getUserId, reqVO.getUserId())
.eqIfPresent(MemberLevelLogDO::getLevelId, reqVO.getLevelId()) .eqIfPresent(MemberLevelRecordDO::getLevelId, reqVO.getLevelId())
.betweenIfPresent(MemberLevelLogDO::getCreateTime, reqVO.getCreateTime()) .betweenIfPresent(MemberLevelRecordDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(MemberLevelLogDO::getId)); .orderByDesc(MemberLevelRecordDO::getId));
} }
} }

View File

@ -1,8 +1,8 @@
package cn.iocoder.yudao.module.member.service.level; package cn.iocoder.yudao.module.member.service.level;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.controller.admin.level.vo.experience.MemberExperienceLogPageReqVO; import cn.iocoder.yudao.module.member.controller.admin.level.vo.experience.MemberExperienceRecordPageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberExperienceLogDO; import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberExperienceRecordDO;
import cn.iocoder.yudao.module.member.enums.MemberExperienceBizTypeEnum; import cn.iocoder.yudao.module.member.enums.MemberExperienceBizTypeEnum;
import java.util.Collection; import java.util.Collection;
@ -13,7 +13,7 @@ import java.util.List;
* *
* @author owen * @author owen
*/ */
public interface MemberExperienceLogService { public interface MemberExperienceRecordService {
/** /**
* 获得会员经验记录 * 获得会员经验记录
@ -21,7 +21,7 @@ public interface MemberExperienceLogService {
* @param id 编号 * @param id 编号
* @return 会员经验记录 * @return 会员经验记录
*/ */
MemberExperienceLogDO getExperienceLog(Long id); MemberExperienceRecordDO getExperienceLog(Long id);
/** /**
* 获得会员经验记录列表 * 获得会员经验记录列表
@ -29,7 +29,7 @@ public interface MemberExperienceLogService {
* @param ids 编号 * @param ids 编号
* @return 会员经验记录列表 * @return 会员经验记录列表
*/ */
List<MemberExperienceLogDO> getExperienceLogList(Collection<Long> ids); List<MemberExperienceRecordDO> getExperienceLogList(Collection<Long> ids);
/** /**
* 获得会员经验记录分页 * 获得会员经验记录分页
@ -37,7 +37,7 @@ public interface MemberExperienceLogService {
* @param pageReqVO 分页查询 * @param pageReqVO 分页查询
* @return 会员经验记录分页 * @return 会员经验记录分页
*/ */
PageResult<MemberExperienceLogDO> getExperienceLogPage(MemberExperienceLogPageReqVO pageReqVO); PageResult<MemberExperienceRecordDO> getExperienceLogPage(MemberExperienceRecordPageReqVO pageReqVO);
/** /**
* 创建 手动调整 经验变动记录 * 创建 手动调整 经验变动记录

View File

@ -2,9 +2,9 @@ package cn.iocoder.yudao.module.member.service.level;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.controller.admin.level.vo.experience.MemberExperienceLogPageReqVO; import cn.iocoder.yudao.module.member.controller.admin.level.vo.experience.MemberExperienceRecordPageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberExperienceLogDO; import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberExperienceRecordDO;
import cn.iocoder.yudao.module.member.dal.mysql.level.MemberExperienceLogMapper; import cn.iocoder.yudao.module.member.dal.mysql.level.MemberExperienceRecordMapper;
import cn.iocoder.yudao.module.member.enums.MemberExperienceBizTypeEnum; import cn.iocoder.yudao.module.member.enums.MemberExperienceBizTypeEnum;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -20,24 +20,24 @@ import java.util.List;
*/ */
@Service @Service
@Validated @Validated
public class MemberExperienceLogServiceImpl implements MemberExperienceLogService { public class MemberExperienceRecordServiceImpl implements MemberExperienceRecordService {
@Resource @Resource
private MemberExperienceLogMapper experienceLogMapper; private MemberExperienceRecordMapper experienceLogMapper;
@Override @Override
public MemberExperienceLogDO getExperienceLog(Long id) { public MemberExperienceRecordDO getExperienceLog(Long id) {
return experienceLogMapper.selectById(id); return experienceLogMapper.selectById(id);
} }
@Override @Override
public List<MemberExperienceLogDO> getExperienceLogList(Collection<Long> ids) { public List<MemberExperienceRecordDO> getExperienceLogList(Collection<Long> ids) {
return experienceLogMapper.selectBatchIds(ids); return experienceLogMapper.selectBatchIds(ids);
} }
@Override @Override
public PageResult<MemberExperienceLogDO> getExperienceLogPage(MemberExperienceLogPageReqVO pageReqVO) { public PageResult<MemberExperienceRecordDO> getExperienceLogPage(MemberExperienceRecordPageReqVO pageReqVO) {
return experienceLogMapper.selectPage(pageReqVO); return experienceLogMapper.selectPage(pageReqVO);
} }
@ -50,7 +50,7 @@ public class MemberExperienceLogServiceImpl implements MemberExperienceLogServic
@Override @Override
public void createBizLog(Long userId, int experience, int totalExperience, MemberExperienceBizTypeEnum bizType, String bizId) { public void createBizLog(Long userId, int experience, int totalExperience, MemberExperienceBizTypeEnum bizType, String bizId) {
MemberExperienceLogDO experienceLogDO = new MemberExperienceLogDO(); MemberExperienceRecordDO experienceLogDO = new MemberExperienceRecordDO();
experienceLogDO.setUserId(userId); experienceLogDO.setUserId(userId);
experienceLogDO.setExperience(experience); experienceLogDO.setExperience(experience);
experienceLogDO.setTotalExperience(totalExperience); experienceLogDO.setTotalExperience(totalExperience);

View File

@ -1,9 +1,9 @@
package cn.iocoder.yudao.module.member.service.level; package cn.iocoder.yudao.module.member.service.level;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.controller.admin.level.vo.log.MemberLevelLogPageReqVO; import cn.iocoder.yudao.module.member.controller.admin.level.vo.log.MemberLevelRecordPageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelDO; import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelDO;
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelLogDO; import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelRecordDO;
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO; import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
import java.util.Collection; import java.util.Collection;
@ -14,7 +14,7 @@ import java.util.List;
* *
* @author owen * @author owen
*/ */
public interface MemberLevelLogService { public interface MemberLevelRecordService {
/** /**
* 删除会员等级记录 * 删除会员等级记录
@ -29,7 +29,7 @@ public interface MemberLevelLogService {
* @param id 编号 * @param id 编号
* @return 会员等级记录 * @return 会员等级记录
*/ */
MemberLevelLogDO getLevelLog(Long id); MemberLevelRecordDO getLevelLog(Long id);
/** /**
* 获得会员等级记录列表 * 获得会员等级记录列表
@ -37,7 +37,7 @@ public interface MemberLevelLogService {
* @param ids 编号 * @param ids 编号
* @return 会员等级记录列表 * @return 会员等级记录列表
*/ */
List<MemberLevelLogDO> getLevelLogList(Collection<Long> ids); List<MemberLevelRecordDO> getLevelLogList(Collection<Long> ids);
/** /**
* 获得会员等级记录分页 * 获得会员等级记录分页
@ -45,7 +45,7 @@ public interface MemberLevelLogService {
* @param pageReqVO 分页查询 * @param pageReqVO 分页查询
* @return 会员等级记录分页 * @return 会员等级记录分页
*/ */
PageResult<MemberLevelLogDO> getLevelLogPage(MemberLevelLogPageReqVO pageReqVO); PageResult<MemberLevelRecordDO> getLevelLogPage(MemberLevelRecordPageReqVO pageReqVO);
/** /**
* 创建记录 取消等级 * 创建记录 取消等级

View File

@ -1,11 +1,11 @@
package cn.iocoder.yudao.module.member.service.level; package cn.iocoder.yudao.module.member.service.level;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.controller.admin.level.vo.log.MemberLevelLogPageReqVO; import cn.iocoder.yudao.module.member.controller.admin.level.vo.log.MemberLevelRecordPageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelDO; import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelDO;
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelLogDO; import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelRecordDO;
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO; import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
import cn.iocoder.yudao.module.member.dal.mysql.level.MemberLevelLogMapper; import cn.iocoder.yudao.module.member.dal.mysql.level.MemberLevelRecordMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -23,10 +23,10 @@ import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.LEVEL_LOG_
*/ */
@Service @Service
@Validated @Validated
public class MemberLevelLogServiceImpl implements MemberLevelLogService { public class MemberLevelRecordServiceImpl implements MemberLevelRecordService {
@Resource @Resource
private MemberLevelLogMapper levelLogMapper; private MemberLevelRecordMapper levelLogMapper;
@Override @Override
public void deleteLevelLog(Long id) { public void deleteLevelLog(Long id) {
@ -43,23 +43,23 @@ public class MemberLevelLogServiceImpl implements MemberLevelLogService {
} }
@Override @Override
public MemberLevelLogDO getLevelLog(Long id) { public MemberLevelRecordDO getLevelLog(Long id) {
return levelLogMapper.selectById(id); return levelLogMapper.selectById(id);
} }
@Override @Override
public List<MemberLevelLogDO> getLevelLogList(Collection<Long> ids) { public List<MemberLevelRecordDO> getLevelLogList(Collection<Long> ids) {
return levelLogMapper.selectBatchIds(ids); return levelLogMapper.selectBatchIds(ids);
} }
@Override @Override
public PageResult<MemberLevelLogDO> getLevelLogPage(MemberLevelLogPageReqVO pageReqVO) { public PageResult<MemberLevelRecordDO> getLevelLogPage(MemberLevelRecordPageReqVO pageReqVO) {
return levelLogMapper.selectPage(pageReqVO); return levelLogMapper.selectPage(pageReqVO);
} }
@Override @Override
public void createCancelLog(Long userId, String reason) { public void createCancelLog(Long userId, String reason) {
MemberLevelLogDO levelLogDO = new MemberLevelLogDO(); MemberLevelRecordDO levelLogDO = new MemberLevelRecordDO();
levelLogDO.setUserId(userId); levelLogDO.setUserId(userId);
levelLogDO.setRemark(reason); levelLogDO.setRemark(reason);
levelLogDO.setDescription("管理员取消"); levelLogDO.setDescription("管理员取消");
@ -71,7 +71,7 @@ public class MemberLevelLogServiceImpl implements MemberLevelLogService {
@Override @Override
public void createAdjustLog(MemberUserDO user, MemberLevelDO level, int experience, String reason) { public void createAdjustLog(MemberUserDO user, MemberLevelDO level, int experience, String reason) {
MemberLevelLogDO levelLogDO = new MemberLevelLogDO(); MemberLevelRecordDO levelLogDO = new MemberLevelRecordDO();
levelLogDO.setUserId(user.getId()); levelLogDO.setUserId(user.getId());
levelLogDO.setLevelId(level.getId()); levelLogDO.setLevelId(level.getId());
levelLogDO.setLevel(level.getLevel()); levelLogDO.setLevel(level.getLevel());
@ -88,7 +88,7 @@ public class MemberLevelLogServiceImpl implements MemberLevelLogService {
@Override @Override
public void createAutoUpgradeLog(MemberUserDO user, MemberLevelDO level) { public void createAutoUpgradeLog(MemberUserDO user, MemberLevelDO level) {
MemberLevelLogDO levelLogDO = new MemberLevelLogDO(); MemberLevelRecordDO levelLogDO = new MemberLevelRecordDO();
levelLogDO.setUserId(user.getId()); levelLogDO.setUserId(user.getId());
levelLogDO.setLevelId(level.getId()); levelLogDO.setLevelId(level.getId());
levelLogDO.setLevel(level.getLevel()); levelLogDO.setLevel(level.getLevel());
@ -102,7 +102,7 @@ public class MemberLevelLogServiceImpl implements MemberLevelLogService {
notifyMember(user.getId(), levelLogDO); notifyMember(user.getId(), levelLogDO);
} }
private void notifyMember(Long userId, MemberLevelLogDO level) { private void notifyMember(Long userId, MemberLevelRecordDO level) {
//todo: 给会员发消息 //todo: 给会员发消息
} }

View File

@ -42,9 +42,9 @@ public class MemberLevelServiceImpl implements MemberLevelService {
@Resource @Resource
private MemberLevelMapper levelMapper; private MemberLevelMapper levelMapper;
@Resource @Resource
private MemberLevelLogService memberLevelLogService; private MemberLevelRecordService memberLevelRecordService;
@Resource @Resource
private MemberExperienceLogService memberExperienceLogService; private MemberExperienceRecordService memberExperienceRecordService;
@Resource @Resource
private MemberUserMapper memberUserMapper; private MemberUserMapper memberUserMapper;
@ -203,7 +203,7 @@ public class MemberLevelServiceImpl implements MemberLevelService {
experience = -user.getExperience(); experience = -user.getExperience();
// 取消了会员的等级 // 取消了会员的等级
memberLevelLogService.createCancelLog(user.getId(), updateReqVO.getReason()); memberLevelRecordService.createCancelLog(user.getId(), updateReqVO.getReason());
memberUserMapper.updateUserLevelToNull(user.getId()); memberUserMapper.updateUserLevelToNull(user.getId());
} else { } else {
MemberLevelDO level = validateLevelExists(updateReqVO.getLevelId()); MemberLevelDO level = validateLevelExists(updateReqVO.getLevelId());
@ -212,7 +212,7 @@ public class MemberLevelServiceImpl implements MemberLevelService {
// 会员当前的经验 = 等级的升级经验 // 会员当前的经验 = 等级的升级经验
totalExperience = level.getExperience(); totalExperience = level.getExperience();
memberLevelLogService.createAdjustLog(user, level, experience, updateReqVO.getReason()); memberLevelRecordService.createAdjustLog(user, level, experience, updateReqVO.getReason());
// 更新会员表上的等级编号经验值 // 更新会员表上的等级编号经验值
updateUserLevelIdAndExperience(user.getId(), updateReqVO.getLevelId(), totalExperience); updateUserLevelIdAndExperience(user.getId(), updateReqVO.getLevelId(), totalExperience);
@ -220,7 +220,7 @@ public class MemberLevelServiceImpl implements MemberLevelService {
// 记录会员经验变动 // 记录会员经验变动
memberExperienceLogService.createAdjustLog(user.getId(), experience, totalExperience); memberExperienceRecordService.createAdjustLog(user.getId(), experience, totalExperience);
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ -239,7 +239,7 @@ public class MemberLevelServiceImpl implements MemberLevelService {
int userExperience = NumberUtil.max(user.getExperience() + experience, 0); int userExperience = NumberUtil.max(user.getExperience() + experience, 0);
// 创建经验记录 // 创建经验记录
memberExperienceLogService.createBizLog(userId, experience, userExperience, bizType, bizId); memberExperienceRecordService.createBizLog(userId, experience, userExperience, bizType, bizId);
// 计算会员等级 // 计算会员等级
Long levelId = calcLevel(user, userExperience); Long levelId = calcLevel(user, userExperience);
@ -284,7 +284,7 @@ public class MemberLevelServiceImpl implements MemberLevelService {
} }
// 保存等级变更记录 // 保存等级变更记录
memberLevelLogService.createAutoUpgradeLog(user, matchLevel); memberLevelRecordService.createAutoUpgradeLog(user, matchLevel);
return matchLevel.getId(); return matchLevel.getId();
} }
} }

View File

@ -41,9 +41,9 @@ public class MemberLevelServiceImplTest extends BaseDbUnitTest {
private MemberLevelMapper levelMapper; private MemberLevelMapper levelMapper;
@MockBean @MockBean
private MemberLevelLogService memberLevelLogService; private MemberLevelRecordService memberLevelRecordService;
@MockBean @MockBean
private MemberExperienceLogService memberExperienceLogService; private MemberExperienceRecordService memberExperienceRecordService;
@Test @Test
public void testCreateLevel_success() { public void testCreateLevel_success() {