管理后台分页修复

master
pan 4 years ago
parent 711000eb5a
commit 9494e563d5
  1. 2
      src/main/java/com/share/help/dao/ActivityMapper.java
  2. 2
      src/main/java/com/share/help/dao/ManagerMapper.java
  3. 8
      src/main/java/com/share/help/service/ManagerService.java
  4. 2
      src/main/resources/mapping/ActivityMapper.xml
  5. 2
      src/main/resources/mapping/UserMapper.xml

@ -68,7 +68,7 @@ public interface ActivityMapper {
//统计分页信息 //统计分页信息
Page<List<SeekHelpSum>> seekHelpCount(@Param("pageSize") Integer pageSize,@Param("userId") String userId); Page<List<SeekHelpSum>> seekHelpCount(@Param("pageSize") Integer pageSize,@Param("userId") String userId);
//查找管理员信息 //管理员查找活动信息
List<ManagerActivityRes> queryActivity(@Param("start") Integer start, @Param("count") Integer count); List<ManagerActivityRes> queryActivity(@Param("start") Integer start, @Param("count") Integer count);
//分页信息 //分页信息

@ -41,7 +41,7 @@ public interface ManagerMapper {
* @param pageSize 分页大小 * @param pageSize 分页大小
* @return 返回分页结果 * @return 返回分页结果
*/ */
@Select("select count(*) as count,ceil(count(*)/#{pageSize}) as totalPage from manager") @Select("select count(*) as count,ceil(count(*)/#{pageSize}) as totalPage,#{pageSize} as pageSize from manager")
Page<List<ManagerRes>> count(@Param("pageSize") int pageSize); Page<List<ManagerRes>> count(@Param("pageSize") int pageSize);
/** /**

@ -32,7 +32,7 @@ public class ManagerService {
private int pageSize; private int pageSize;
//用户分页配置 //用户分页配置
@Value("${page-size.user.page-size}") @Value("${page-size.manager}")
private int userPageSize; private int userPageSize;
@Autowired @Autowired
@ -93,7 +93,7 @@ public class ManagerService {
Page<List<ManagerRes>> page=managerMapper.count(pageSize); Page<List<ManagerRes>> page=managerMapper.count(pageSize);
List<ManagerRes> list=managerMapper.list((queryManager.getCurrentPage()-1)*pageSize,pageSize); List<ManagerRes> list=managerMapper.list((queryManager.getCurrentPage()-1)*pageSize,pageSize);
page.setBody(list); page.setBody(list);
page.setCurrentPage(queryManager.getCurrentPage());
return new JSONResponse<DefaultRes, Page<List<ManagerRes>>>(DefaultRes.ok,Result.OK).setBody(page); return new JSONResponse<DefaultRes, Page<List<ManagerRes>>>(DefaultRes.ok,Result.OK).setBody(page);
} }
@ -133,6 +133,7 @@ public class ManagerService {
*/ */
public JSONResponse<DefaultRes,Page<List<UserEntity>>> find(FindUserForm findUserForm){ public JSONResponse<DefaultRes,Page<List<UserEntity>>> find(FindUserForm findUserForm){
Page<List<UserEntity>> page=userMapper.countUserByManager(userPageSize,findUserForm.getUserTypes(),findUserForm.getInfo(),findUserForm.getServiceAddress()); Page<List<UserEntity>> page=userMapper.countUserByManager(userPageSize,findUserForm.getUserTypes(),findUserForm.getInfo(),findUserForm.getServiceAddress());
page.setCurrentPage(findUserForm.getCurrentPage());
List<UserEntity> userEntityList=userMapper.getPage((findUserForm.getCurrentPage()-1)* userPageSize, userPageSize,findUserForm.getUserTypes(), List<UserEntity> userEntityList=userMapper.getPage((findUserForm.getCurrentPage()-1)* userPageSize, userPageSize,findUserForm.getUserTypes(),
findUserForm.getInfo(),findUserForm.getServiceAddress()); findUserForm.getInfo(),findUserForm.getServiceAddress());
page.setBody(userEntityList); page.setBody(userEntityList);
@ -146,7 +147,8 @@ public class ManagerService {
*/ */
public JSONResponse<DefaultRes, Page<List<ManagerActivityRes>>> findActivity(FindActivityForm findActivityForm) { public JSONResponse<DefaultRes, Page<List<ManagerActivityRes>>> findActivity(FindActivityForm findActivityForm) {
Page<List<ManagerActivityRes>> page=activityMapper.countActivity(pageSize); Page<List<ManagerActivityRes>> page=activityMapper.countActivity(pageSize);
page.setBody(activityMapper.queryActivity((findActivityForm.getCurrentPage()-1),pageSize)); page.setCurrentPage(findActivityForm.getCurrentPage());
page.setBody(activityMapper.queryActivity((findActivityForm.getCurrentPage()-1)*pageSize,pageSize));
return new JSONResponse<DefaultRes, Page<List<ManagerActivityRes>>>(DefaultRes.ok,Result.OK).setBody(page); return new JSONResponse<DefaultRes, Page<List<ManagerActivityRes>>>(DefaultRes.ok,Result.OK).setBody(page);
} }

@ -68,7 +68,7 @@
<select id="countActivity" resultType="com.share.help.res.Page"> <select id="countActivity" resultType="com.share.help.res.Page">
select count(*) as count,ceil(count(*)/#{pageSize}) as totalPage from activity select count(*) as count,ceil(count(*)/#{pageSize}) as totalPage,#{pageSize} as pageSize from activity
</select> </select>
<!-- 管理员查找活动信息--> <!-- 管理员查找活动信息-->

@ -33,7 +33,7 @@
</select> </select>
<sql id="countSql"> <sql id="countSql">
select count(*) as count,ceil(count(*)/#{pageSize}) as totalPage from user select count(*) as count,ceil(count(*)/#{pageSize}) as totalPage,#{pageSize} as pageSize from user
<where> <where>
<if test='userTypes.size>0'> <if test='userTypes.size>0'>
and user_type in and user_type in

Loading…
Cancel
Save