From 109e0f57a78b6034b68c243f95c6564edb5e9204 Mon Sep 17 00:00:00 2001 From: pan <1029559041@qq.com> Date: Mon, 1 Jun 2020 09:38:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=88=91=E7=9A=84=E5=A5=BD?= =?UTF-8?q?=E5=8F=8B=E3=80=81=E6=88=91=E7=9A=84=E7=95=99=E8=A8=80=E5=88=86?= =?UTF-8?q?=E9=A1=B5=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/share/help/dao/LeaveWordMapper.java | 2 +- src/main/java/com/share/help/service/LeaveWordService.java | 1 + src/main/java/com/share/help/service/UserService.java | 1 + src/main/resources/application.yaml | 4 ++-- src/main/resources/mapping/FriendMapper.xml | 2 +- src/main/resources/mapping/LeaveWordMapper.xml | 1 + src/test/java/com/share/help/HelpApplicationTests.java | 2 +- 7 files changed, 8 insertions(+), 5 deletions(-) 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