diff --git a/src/main/java/com/share/help/dao/LeaveWordMapper.java b/src/main/java/com/share/help/dao/LeaveWordMapper.java index 15c0a03..8eb34b8 100644 --- a/src/main/java/com/share/help/dao/LeaveWordMapper.java +++ b/src/main/java/com/share/help/dao/LeaveWordMapper.java @@ -24,7 +24,7 @@ public interface LeaveWordMapper { List select(@Param("start") long start,@Param("count") long count,@Param("userId") String userId); // 统计留言列表分页数 - @Select("select count(*) as count,ceil(count(*)/#{pageSize}) as totalPage from leave_word where target_user_id=#{userId}") + @Select("select count(*) as count,ceil(count(*)/#{pageSize}) as totalPage,#{pageSize} as pageSize from leave_word where target_user_id=#{userId}") Page> count(@Param("pageSize") Integer pageSize,@Param("userId") String userId); /** diff --git a/src/main/java/com/share/help/service/LeaveWordService.java b/src/main/java/com/share/help/service/LeaveWordService.java index 0583fb2..323c610 100644 --- a/src/main/java/com/share/help/service/LeaveWordService.java +++ b/src/main/java/com/share/help/service/LeaveWordService.java @@ -45,6 +45,7 @@ public class LeaveWordService { */ public JSONResponse>> query(FindLeaveWordForm findLeaveWordForm){ Page> listPage=leaveWordMapper.count(pageSize,findLeaveWordForm.getUserId()); + listPage.setCurrentPage(findLeaveWordForm.getCurrentPage()); List leaveWordRes=leaveWordMapper.select((findLeaveWordForm.getCurrentPage()-1)*pageSize,pageSize,findLeaveWordForm.getUserId()); for(LeaveWordRes wordRes:leaveWordRes){ if(LeaveWordType.friend!=wordRes.getType()&&wordRes.getActivityId()!=null){ diff --git a/src/main/java/com/share/help/service/UserService.java b/src/main/java/com/share/help/service/UserService.java index 9b86388..65ab69d 100644 --- a/src/main/java/com/share/help/service/UserService.java +++ b/src/main/java/com/share/help/service/UserService.java @@ -216,6 +216,7 @@ public class UserService{ */ public JSONResponse>> searchFriend(SearchFrom searchFrom) { Page> page=friendMapper.count(searchFrom.getUserId(),searchFrom.getName(),searchFrom.getServiceAddress(),friendSize); + page.setCurrentPage(searchFrom.getCurrentPage()); List list=friendMapper.getFriend(searchFrom.getUserId(),searchFrom.getName(),searchFrom.getServiceAddress(),(searchFrom.getCurrentPage()-1)*friendSize,friendSize); page.setBody(list); return new JSONResponse>>(DefaultRes.ok,Result.OK).setBody(page); diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index bbdd507..765c598 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -40,7 +40,7 @@ user: #分页配置 page-size: #留言列表 - leave-word: 3 + leave-word: 5 #活动列表 activity: # 分页大小 @@ -56,7 +56,7 @@ page-size: # 单行显示数量 row-size: 3 #好友列表 - friend: 3 + friend: 5 #管理员列表 manager: 10 diff --git a/src/main/resources/mapping/FriendMapper.xml b/src/main/resources/mapping/FriendMapper.xml index 901fc34..5bf3670 100644 --- a/src/main/resources/mapping/FriendMapper.xml +++ b/src/main/resources/mapping/FriendMapper.xml @@ -25,7 +25,7 @@ \ No newline at end of file diff --git a/src/test/java/com/share/help/HelpApplicationTests.java b/src/test/java/com/share/help/HelpApplicationTests.java index 9ec50bd..f84f7c7 100644 --- a/src/test/java/com/share/help/HelpApplicationTests.java +++ b/src/test/java/com/share/help/HelpApplicationTests.java @@ -312,7 +312,7 @@ class HelpApplicationTests { //更新活动信息 @Test public void testUpdateActivity(){ - Assertions.assertTrue(activityMapper.updateActivity(66L,"44","", imageName)); + Assertions.assertTrue(activityMapper.updateActivity(66L,"44","", null)); } @Test