From 24a670e9e7eb3aed60997a9da01c99dfcbcbe652 Mon Sep 17 00:00:00 2001 From: PQZ <pangqingzhou@gmail.com> Date: Mon, 17 Mar 2025 15:47:03 +0800 Subject: [PATCH] 1 --- .../controller/MemberUserController.java | 25 ++++++++++--------- .../ruoyi/member/mapper/MemberUserMapper.java | 19 +++++++++++--- .../member/service/IMemberUserService.java | 19 +++++++++++--- .../service/impl/MemberUserServiceImpl.java | 16 ++++++++++++ .../mapper/member/MemberUserMapper.xml | 9 +++++++ 5 files changed, 70 insertions(+), 18 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/member/controller/MemberUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/member/controller/MemberUserController.java index 93f259d..d78fc2c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/member/controller/MemberUserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/member/controller/MemberUserController.java @@ -4,16 +4,12 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; @@ -36,18 +32,23 @@ public class MemberUserController extends BaseController @Autowired private IMemberUserService memberUserService; + /** * 查询会员列表 */ - @PreAuthorize("@ss.hasPermi('member:member:list')") + @PreAuthorize("@ss.hasPermi('base:user:list')") @GetMapping("/list") - public AjaxResult list(MemberUser memberUser) + public AjaxResult list(MemberUser memberUser, + @RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { - - List<MemberUser> list = memberUserService.list(); + Page<MemberUser> page = new Page<>(pageNum, pageSize); + IPage<MemberUser> list = memberUserService.queryListPage(memberUser,page); return success(list); } + + /** * 导出会员列表 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/member/mapper/MemberUserMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/member/mapper/MemberUserMapper.java index 1e07ed0..bed3cb0 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/member/mapper/MemberUserMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/member/mapper/MemberUserMapper.java @@ -1,18 +1,31 @@ package com.ruoyi.member.mapper; import java.util.List; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.member.domain.MemberUser; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 会员Mapper接口 - * + * * @author pqz * @date 2025-03-17 */ @Mapper -public interface MemberUserMapper extends BaseMapper<MemberUser> -{ +public interface MemberUserMapper extends BaseMapper<MemberUser> { + /** + * 分页查询会员 + * + * @param entity {@link MemberUser} + * @param page 分页参数 + * @return com.baomidou.mybatisplus.core.metadata.IPage<com.ruoyi.member.domain.MemberUser> + * @author PQZ + * @date 15:34 2025/3/17 + **/ + IPage<MemberUser> queryListPage(@Param("entity") MemberUser entity, Page<MemberUser> page); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/member/service/IMemberUserService.java b/ruoyi-admin/src/main/java/com/ruoyi/member/service/IMemberUserService.java index 0e56d9e..60f90fd 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/member/service/IMemberUserService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/member/service/IMemberUserService.java @@ -1,16 +1,29 @@ package com.ruoyi.member.service; import java.util.List; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.member.domain.MemberUser; /** * 会员Service接口 - * + * * @author pqz * @date 2025-03-17 */ -public interface IMemberUserService extends IService<MemberUser> -{ +public interface IMemberUserService extends IService<MemberUser> { + + /** + * 分页列表查询 + * + * @param pageReqVO {@link MemberUser} + * @param page 分页参数 + * @return com.baomidou.mybatisplus.core.metadata.IPage<com.ruoyi.member.domain.MemberUser> + * @author PQZ + * @date 15:32 2025/3/17 + **/ + IPage<MemberUser> queryListPage(MemberUser pageReqVO, Page<MemberUser> page); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/member/service/impl/MemberUserServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/member/service/impl/MemberUserServiceImpl.java index 999a815..54e824d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/member/service/impl/MemberUserServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/member/service/impl/MemberUserServiceImpl.java @@ -1,6 +1,9 @@ package com.ruoyi.member.service.impl; import java.util.List; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.utils.DateUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -22,4 +25,17 @@ public class MemberUserServiceImpl extends ServiceImpl<MemberUserMapper,MemberUs private MemberUserMapper memberUserMapper; + /** + * 分页列表查询 + * + * @param pageReqVO {@link MemberUser} + * @param page 分页参数 + * @return com.baomidou.mybatisplus.core.metadata.IPage<com.ruoyi.member.domain.MemberUser> + * @author PQZ + * @date 15:32 2025/3/17 + **/ + @Override + public IPage<MemberUser> queryListPage(MemberUser pageReqVO, Page<MemberUser> page) { + return memberUserMapper.queryListPage(pageReqVO, page); + } } diff --git a/ruoyi-admin/src/main/resources/mapper/member/MemberUserMapper.xml b/ruoyi-admin/src/main/resources/mapper/member/MemberUserMapper.xml index 89fb4e8..00ceb94 100644 --- a/ruoyi-admin/src/main/resources/mapper/member/MemberUserMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/member/MemberUserMapper.xml @@ -28,5 +28,14 @@ select id, user_type, identity_type, user_id, tel, t_remaining, t_total_num, t_fans_num, t_open_disturb, t_recipient_name, t_recipient_image, b_points, creator, create_time, updater, update_time, del_flag from dl_member_user </sql> + <select id="queryListPage" parameterType="MemberUser" resultMap="MemberUserResult"> + <include refid="selectMemberUserVo"/> + <where> + <if test="entity.userType != null and entity.userType != ''"> and user_type = #{entity.userType}</if> + <if test="entity.identityType != null and entity.identityType != ''"> and identity_type = #{entity.identityType}</if> + <if test="entity.bPoints != null "> and b_points = #{entity.bPoints}</if> + </where> + </select> + </mapper> \ No newline at end of file