diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/level/MemberLevelController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/level/MemberLevelController.java index af4153b22f..5a031321ff 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/level/MemberLevelController.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/level/MemberLevelController.java @@ -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> getLevelPage(@Valid MemberLevelPageReqVO pageVO) { - PageResult pageResult = levelService.getLevelPage(pageVO); - return success(MemberLevelConvert.INSTANCE.convertPage(pageResult)); + public CommonResult> getLevelList(@Valid MemberLevelListReqVO pageVO) { + List result = levelService.getLevelList(pageVO); + return success(MemberLevelConvert.INSTANCE.convertList(result)); } } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/level/vo/level/MemberLevelPageReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/level/vo/level/MemberLevelListReqVO.java similarity index 71% rename from yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/level/vo/level/MemberLevelPageReqVO.java rename to yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/level/vo/level/MemberLevelListReqVO.java index d9a6b5b666..87502b278a 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/level/vo/level/MemberLevelPageReqVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/level/vo/level/MemberLevelListReqVO.java @@ -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; diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/level/MemberLevelConvert.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/level/MemberLevelConvert.java index ec2549462d..4788bf365e 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/level/MemberLevelConvert.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/level/MemberLevelConvert.java @@ -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 convertList(List list); - PageResult convertPage(PageResult page); - List convertSimpleList(List list); } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/level/MemberLevelMapper.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/level/MemberLevelMapper.java index b0eb77d124..a7be2fd644 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/level/MemberLevelMapper.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/level/MemberLevelMapper.java @@ -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 { - default PageResult selectPage(MemberLevelPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() + default List selectList(MemberLevelListReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() .likeIfPresent(MemberLevelDO::getName, reqVO.getName()) .eqIfPresent(MemberLevelDO::getStatus, reqVO.getStatus()) .orderByAsc(MemberLevelDO::getLevel)); diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/level/MemberLevelService.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/level/MemberLevelService.java index e59e205c9e..11c75cd65a 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/level/MemberLevelService.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/level/MemberLevelService.java @@ -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 getLevelList(Collection ids); /** - * 获得会员等级分页 + * 获得会员等级列表 * - * @param pageReqVO 分页查询 - * @return 会员等级分页 + * @param listReqVO 查询参数 + * @return 会员等级列表 */ - PageResult getLevelPage(MemberLevelPageReqVO pageReqVO); + List getLevelList(MemberLevelListReqVO listReqVO); /** diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/level/MemberLevelServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/level/MemberLevelServiceImpl.java index 1cc7f474cc..6120b711a2 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/level/MemberLevelServiceImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/level/MemberLevelServiceImpl.java @@ -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 getLevelPage(MemberLevelPageReqVO pageReqVO) { - return levelMapper.selectPage(pageReqVO); + public List getLevelList(MemberLevelListReqVO listReqVO) { + return levelMapper.selectList(listReqVO); } @Override diff --git a/yudao-module-member/yudao-module-member-biz/src/test/java/cn/iocoder/yudao/module/member/service/level/MemberLevelServiceImplTest.java b/yudao-module-member/yudao-module-member-biz/src/test/java/cn/iocoder/yudao/module/member/service/level/MemberLevelServiceImplTest.java index 9763c2f6fe..abcf5ff8d7 100644 --- a/yudao-module-member/yudao-module-member-biz/src/test/java/cn/iocoder/yudao/module/member/service/level/MemberLevelServiceImplTest.java +++ b/yudao-module-member/yudao-module-member-biz/src/test/java/cn/iocoder/yudao/module/member/service/level/MemberLevelServiceImplTest.java @@ -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 pageResult = levelService.getLevelPage(reqVO); + List 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