会员: 会员等级取消分页功能
This commit is contained in:
parent
dc382d80bb
commit
4132cf1437
|
@ -1,7 +1,6 @@
|
|||
package cn.iocoder.yudao.module.member.controller.admin.level;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.level.vo.level.*;
|
||||
import cn.iocoder.yudao.module.member.convert.level.MemberLevelConvert;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelDO;
|
||||
|
@ -70,13 +69,12 @@ public class MemberLevelController {
|
|||
return success(MemberLevelConvert.INSTANCE.convertSimpleList(list));
|
||||
}
|
||||
|
||||
// TODO @疯狂:是不是不做分页,直接 list 就好啦;返回的时候,按照经验排序下哈;
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得会员等级分页")
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得会员等级列表")
|
||||
@PreAuthorize("@ss.hasPermission('member:level:query')")
|
||||
public CommonResult<PageResult<MemberLevelRespVO>> getLevelPage(@Valid MemberLevelPageReqVO pageVO) {
|
||||
PageResult<MemberLevelDO> pageResult = levelService.getLevelPage(pageVO);
|
||||
return success(MemberLevelConvert.INSTANCE.convertPage(pageResult));
|
||||
public CommonResult<List<MemberLevelRespVO>> getLevelList(@Valid MemberLevelListReqVO pageVO) {
|
||||
List<MemberLevelDO> result = levelService.getLevelList(pageVO);
|
||||
return success(MemberLevelConvert.INSTANCE.convertList(result));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
package cn.iocoder.yudao.module.member.controller.admin.level.vo.level;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@Schema(description = "管理后台 - 会员等级分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MemberLevelPageReqVO extends PageParam {
|
||||
public class MemberLevelListReqVO {
|
||||
|
||||
@Schema(description = "等级名称", example = "芋艿")
|
||||
private String name;
|
|
@ -1,6 +1,5 @@
|
|||
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.level.MemberLevelCreateReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.level.vo.level.MemberLevelRespVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.level.vo.level.MemberLevelSimpleRespVO;
|
||||
|
@ -29,7 +28,5 @@ public interface MemberLevelConvert {
|
|||
|
||||
List<MemberLevelRespVO> convertList(List<MemberLevelDO> list);
|
||||
|
||||
PageResult<MemberLevelRespVO> convertPage(PageResult<MemberLevelDO> page);
|
||||
|
||||
List<MemberLevelSimpleRespVO> convertSimpleList(List<MemberLevelDO> list);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
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.level.MemberLevelPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.level.vo.level.MemberLevelListReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
@ -17,8 +16,8 @@ import java.util.List;
|
|||
@Mapper
|
||||
public interface MemberLevelMapper extends BaseMapperX<MemberLevelDO> {
|
||||
|
||||
default PageResult<MemberLevelDO> selectPage(MemberLevelPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<MemberLevelDO>()
|
||||
default List<MemberLevelDO> selectList(MemberLevelListReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<MemberLevelDO>()
|
||||
.likeIfPresent(MemberLevelDO::getName, reqVO.getName())
|
||||
.eqIfPresent(MemberLevelDO::getStatus, reqVO.getStatus())
|
||||
.orderByAsc(MemberLevelDO::getLevel));
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
package cn.iocoder.yudao.module.member.service.level;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.level.vo.level.MemberLevelCreateReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.level.vo.level.MemberLevelPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.level.vo.level.MemberLevelListReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.level.vo.level.MemberLevelUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.user.vo.MemberUserUpdateLevelReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelDO;
|
||||
|
@ -59,12 +58,12 @@ public interface MemberLevelService {
|
|||
List<MemberLevelDO> getLevelList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得会员等级分页
|
||||
* 获得会员等级列表
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 会员等级分页
|
||||
* @param listReqVO 查询参数
|
||||
* @return 会员等级列表
|
||||
*/
|
||||
PageResult<MemberLevelDO> getLevelPage(MemberLevelPageReqVO pageReqVO);
|
||||
List<MemberLevelDO> getLevelList(MemberLevelListReqVO listReqVO);
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,9 +4,8 @@ import cn.hutool.core.collection.CollUtil;
|
|||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.level.vo.level.MemberLevelCreateReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.level.vo.level.MemberLevelPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.level.vo.level.MemberLevelListReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.level.vo.level.MemberLevelUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.user.vo.MemberUserUpdateLevelReqVO;
|
||||
import cn.iocoder.yudao.module.member.convert.level.MemberLevelConvert;
|
||||
|
@ -173,8 +172,8 @@ public class MemberLevelServiceImpl implements MemberLevelService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public PageResult<MemberLevelDO> getLevelPage(MemberLevelPageReqVO pageReqVO) {
|
||||
return levelMapper.selectPage(pageReqVO);
|
||||
public List<MemberLevelDO> getLevelList(MemberLevelListReqVO listReqVO) {
|
||||
return levelMapper.selectList(listReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,7 +5,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|||
import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils;
|
||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.level.vo.level.MemberLevelCreateReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.level.vo.level.MemberLevelPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.level.vo.level.MemberLevelListReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.level.vo.level.MemberLevelUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelDO;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.level.MemberLevelMapper;
|
||||
|
@ -121,7 +121,7 @@ public class MemberLevelServiceImplTest extends BaseDbUnitTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetLevelPage() {
|
||||
public void testGetLevelList() {
|
||||
// mock 数据
|
||||
MemberLevelDO dbLevel = randomPojo(MemberLevelDO.class, o -> { // 等会查询到
|
||||
o.setName("黄金会员");
|
||||
|
@ -133,16 +133,15 @@ public class MemberLevelServiceImplTest extends BaseDbUnitTest {
|
|||
// 测试 status 不匹配
|
||||
levelMapper.insert(cloneIgnoreId(dbLevel, o -> o.setStatus(0)));
|
||||
// 准备参数
|
||||
MemberLevelPageReqVO reqVO = new MemberLevelPageReqVO();
|
||||
MemberLevelListReqVO reqVO = new MemberLevelListReqVO();
|
||||
reqVO.setName("黄金会员");
|
||||
reqVO.setStatus(1);
|
||||
|
||||
// 调用
|
||||
PageResult<MemberLevelDO> pageResult = levelService.getLevelPage(reqVO);
|
||||
List<MemberLevelDO> list = levelService.getLevelList(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbLevel, pageResult.getList().get(0));
|
||||
assertEquals(1, list.size());
|
||||
assertPojoEquals(dbLevel, list.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue