Bladeren bron

修正分页错误

huwhois 4 jaren geleden
bovenliggende
commit
7da348616d

+ 1 - 4
src/main/java/io/renren/modules/admin/controller/MeetingController.java

@ -70,10 +70,7 @@ public class MeetingController {
70 70
    @RequestMapping("/listtest")
71 71
    @RequiresPermissions("admin:meeting:list")
72 72
    public R listtest(@RequestParam Map<String, Object> params){
73
        String key = (String) params.get("key");
74
        int p = Integer.valueOf(params.get("page").toString());
75
        int l = Integer.valueOf(params.get("limit").toString());
76
        PageUtils page = meetingService.queryList(p, l, key);
73
        PageUtils page = meetingService.myQueryPage(params);
77 74

78 75
        return R.ok().put("page", page);
79 76
    }

+ 2 - 2
src/main/java/io/renren/modules/admin/dao/AttendersDao.java

@ -19,8 +19,8 @@ import org.apache.ibatis.annotations.Update;
19 19
 */
20 20
@Mapper
21 21
public interface AttendersDao extends BaseMapper<AttendersEntity> {
22
    @Select("SELECT a.id, m.truename as name, m.organization, m.phone, a.intention, a.room, a.transfer, a.note, a.modify_time, a.servicer, e.truename as servicerName, a.type_id as typeId, (select t.name from types_of_attenders t WHERE t.id=a.type_id) as typeName, (SELECT p.is_pay FROM  payment p WHERE p.attenders_id=a.id) as  isPay  FROM attenders a JOIN member m ON a.member_id=m.id LEFT JOIN employee e ON e.id=a.servicer  WHERE a.is_del=0 AND a.meeting_id=#{meetingId} AND (m.truename Like '%${truename}%' OR m.organization LIKE '%${organization}%') limit #{page},#{limit};")
23
    List<Map<String, Object>> getMapList(Long meetingId, String truename, String organization, int page, int limit);
22
    @Select("SELECT a.id, m.truename as name, m.organization, m.phone, a.intention, a.room, a.transfer, a.note, a.modify_time, a.servicer, e.truename as servicerName, a.type_id as typeId, (select t.name from types_of_attenders t WHERE t.id=a.type_id) as typeName, (SELECT p.is_pay FROM  payment p WHERE p.attenders_id=a.id) as  isPay  FROM attenders a JOIN member m ON a.member_id=m.id LEFT JOIN employee e ON e.id=a.servicer  WHERE a.is_del=0 AND a.meeting_id=#{meetingId} AND (m.truename Like '%${truename}%' OR m.organization LIKE '%${organization}%') limit #{startLimt},#{endLimt};")
23
    List<Map<String, Object>> getPageList(Long meetingId, String truename, String organization, int startLimt, int endLimt);
24 24

25 25
    @Select("SELECT count(*) FROM attenders a JOIN member m ON a.member_id=m.id LEFT JOIN employee e ON e.id=a.servicer  WHERE a.is_del=0 AND a.meeting_id=#{meetingId} AND (m.truename Like '%${truename}%' OR m.organization LIKE '%${organization}%');")
26 26
    int getCounts(Long meetingId, String truename, String organization);

+ 2 - 2
src/main/java/io/renren/modules/admin/dao/LectureDao.java

@ -18,8 +18,8 @@ import org.apache.ibatis.annotations.Select;
18 18
 */
19 19
@Mapper
20 20
public interface LectureDao extends BaseMapper<LectureEntity> {
21
    @Select("select l.id,a.id a_id,a.meeting_id,l.topic,l.branch_id,l.speech_time,m.truename,m.position,m.job_title,m.organization from attenders a join lecture l on a.id=l.attenders_id join member m on m.id=a.member_id where a.meeting_id=#{meetingId} and a.is_del=0 and l.is_del=0 and (l.topic like '%${key1}' or m.truename like '%${key2}%') limit #{page},#{limit};")
22
    List<Map<String, Object>> getPageList(Long meetingId, String key1, String key2, int page, int limit);
21
    @Select("select l.id,a.id a_id,a.meeting_id,l.topic,l.branch_id,l.speech_time,m.truename,m.position,m.job_title,m.organization from attenders a join lecture l on a.id=l.attenders_id join member m on m.id=a.member_id where a.meeting_id=#{meetingId} and a.is_del=0 and l.is_del=0 and (l.topic like '%${key1}' or m.truename like '%${key2}%') limit #{startLimt},#{endLimt};")
22
    List<Map<String, Object>> getPageList(Long meetingId, String key1, String key2, int startLimt, int endLimt);
23 23
24 24
    @Select("select count(*) from attenders a join lecture l on a.id=l.attenders_id join member m on m.id=a.member_id where a.meeting_id=#{meetingId} and a.is_del=0 and l.is_del=0 and (l.topic like '%${key1}%' or m.truename like '%${key2}%'); ")
25 25
    int getCounts(Long meetingId, String key1, String key2);

+ 2 - 2
src/main/java/io/renren/modules/admin/dao/MeetingDao.java

@ -23,8 +23,8 @@ public interface MeetingDao extends BaseMapper<MeetingEntity> {
23 23
    int updateStatus(Long id, Integer isCheck);
24 24

25 25
    @Select("select m.id,c.companyname,m.name_cn,m.address,m.start_time from meeting as m left JOIN company as c on m.company_id = c.id where m.is_del = 0 and (m.name_cn LIKE '%${key}%' or m.name_en LIKE '%${key2}%') limit #{page},#{limit} ")
26
    List<Map<String, Object>> queryCN(int page, int limit, String key, String key2);
26
    List<Map<String, Object>> getPageList(int page, int limit, String key, String key2);
27 27

28 28
    @Select("select count(*) from meeting  where is_del = 0 and (name_cn LIKE '%${key}%' or name_en LIKE '%${key2}%')")
29
    Integer queryCNCOUNTS(String key, String key2);
29
    Integer getCounts(String key, String key2);
30 30
}

+ 2 - 2
src/main/java/io/renren/modules/admin/dao/PaperDao.java

@ -18,8 +18,8 @@ import org.apache.ibatis.annotations.Select;
18 18
 */
19 19
@Mapper
20 20
public interface PaperDao extends BaseMapper<PaperEntity> {
21
    @Select("select p.id,p.title,a.id a_id,m.truename,m.phone,m.email,p.paperurl,p.create_time from attenders a join paper p on a.id=p.attenders_id join member m on m.id=a.member_id where a.meeting_id=#{meetingId} and a.is_del =0 and p.is_del = 0 and (p.title like '%${key1}%' or m.truename LIKE '%${key2}%') limit #{page},#{limit};")
22
    List<Map<String, Object>> getPageList(Long meetingId, int page, int limit, String key1, String key2);
21
    @Select("select p.id,p.title,a.id a_id,m.truename,m.phone,m.email,p.paperurl,p.create_time from attenders a join paper p on a.id=p.attenders_id join member m on m.id=a.member_id where a.meeting_id=#{meetingId} and a.is_del =0 and p.is_del = 0 and (p.title like '%${key1}%' or m.truename LIKE '%${key2}%') limit #{startLimt},#{endLimt};")
22
    List<Map<String, Object>> getPageList(Long meetingId, int startLimt, int endLimt, String key1, String key2);
23 23
24 24
    @Select("select count(p.id) from attenders a join paper p on a.id=p.attenders_id join member m on m.id=a.member_id where a.meeting_id=#{meetingId} and a.is_del =0 and p.is_del = 0 and (p.title like '%${key1}%' or m.truename LIKE '%${key2}%');")
25 25
    int getCounts(Long meetingId, String key1, String key2);

+ 3 - 3
src/main/java/io/renren/modules/admin/dao/PaymentDao.java

@ -19,11 +19,11 @@ import java.util.Map;
19 19
 */
20 20
@Mapper
21 21
public interface PaymentDao extends BaseMapper<PaymentEntity> {
22
    @Select("select p.id, p.order_id orderId, mem.truename, mem.organization, p.pay_type payType, mem.phone, mem.email, p.pay_time payTime,p.is_pay isPay from attenders join payment p on attenders.id=p.attenders_id join member mem on mem.id=attenders.member_id where p.meeting_id=#{meetingId} and attenders.is_del=0 and p.is_del=0 and (mem.truename like '%${name}%' or p.order_id like '%${order}%') limit #{page},#{limit};")
23
    List<Map<String, Object>> myQueryPage(Long meetingId, String name, String order, int page, int limit);
22
    @Select("select p.id, p.order_id orderId, mem.truename, mem.organization, p.pay_type payType, mem.phone, mem.email, p.pay_time payTime,p.is_pay isPay from attenders join payment p on attenders.id=p.attenders_id join member mem on mem.id=attenders.member_id where p.meeting_id=#{meetingId} and attenders.is_del=0 and p.is_del=0 and (mem.truename like '%${name}%' or p.order_id like '%${order}%') limit #{startLimt},#{endLimt};")
23
    List<Map<String, Object>> getPageList(Long meetingId, String name, String order, int startLimt, int endLimt);
24 24
25 25
    @Select("select count(*) from attenders join payment p on attenders.id=p.attenders_id join member mem on mem.id=attenders.member_id where p.meeting_id=#{meetingId} and attenders.is_del=0 and p.is_del=0 and (mem.truename like '%${name}%' or p.order_id like '%${order}%');")
26
    int myQueryPageCounts(Long meetingId, String name, String order);
26
    int getCounts(Long meetingId, String name, String order);
27 27
28 28
    @Select("select p.id, p.order_id orderId, mem.truename, mem.organization, p.pay_type payType, mem.phone, mem.email, p.pay_time payTime,p.is_pay isPay from attenders join payment p on attenders.id=p.attenders_id join member mem on mem.id=attenders.member_id where p.meeting_id=#{meetingId} and attenders.is_del=0 and p.is_del=0 and (mem.truename like '%${name}%' or p.order_id like '%${order}%');")
29 29
    List<Map<String, Object>> getMapList(Long meetingId, String name, String order);

+ 1 - 1
src/main/java/io/renren/modules/admin/service/MeetingService.java

@ -20,7 +20,7 @@ public interface MeetingService extends IService<MeetingEntity> {
20 20
	/**
21 21
	 * 	带单位分页
22 22
	 */
23
	PageUtils queryList(int page, int limit, String key);
23
	PageUtils myQueryPage(Map<String, Object> params);
24 24

25 25
	/**
26 26
	 * 更新审核状态

+ 4 - 3
src/main/java/io/renren/modules/admin/service/impl/AttendersServiceImpl.java

@ -43,11 +43,12 @@ public class AttendersServiceImpl extends ServiceImpl<AttendersDao, AttendersEnt
43 43
            page = 0;
44 44
        }
45 45
        int limit = params.containsKey("limit") ? Integer.valueOf((String) params.get("limit")) : 10;
46

47
        List<Map<String, Object>> list = baseMapper.getMapList(meetingId, key, key, page, limit);
46
        int startLimt = page * limit;
47
        int endLimt = startLimt + limit;
48
        List<Map<String, Object>> list = baseMapper.getPageList(meetingId, key, key, startLimt, endLimt);
48 49
        int total = baseMapper.getCounts(meetingId, key, key);
49 50

50
        return new PageUtils(list, total, limit, page);
51
        return new PageUtils(list, total, limit, page+1);
51 52
    }
52 53

53 54
    @Override

+ 0 - 11
src/main/java/io/renren/modules/admin/service/impl/EmployeeServiceImpl.java

@ -1,10 +1,6 @@
1 1
package io.renren.modules.admin.service.impl;
2 2

3
import com.baomidou.mybatisplus.core.conditions.Wrapper;
4
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
import javafx.scene.control.Pagination;
6 3
import org.apache.commons.lang.StringUtils;
7
import org.springframework.beans.factory.annotation.Autowired;
8 4
import org.springframework.stereotype.Service;
9 5

10 6
import java.util.Arrays;
@ -25,8 +21,6 @@ import io.renren.modules.admin.service.EmployeeService;
25 21
@Service("employeeService")
26 22
public class EmployeeServiceImpl extends ServiceImpl<EmployeeDao, EmployeeEntity> implements EmployeeService {
27 23

28
    @Autowired
29
    private EmployeeService employeeService;
30 24
    @Override
31 25
    public PageUtils queryPage(Map<String, Object> params) {
32 26
        String key = (String) params.get("key");
@ -73,11 +67,6 @@ public class EmployeeServiceImpl extends ServiceImpl<EmployeeDao, EmployeeEntity
73 67
        return new PageUtils(mList,total,limit,page);
74 68
    }
75 69

76
//    @Override
77
//    public IPage<EmployeeEntity> selectMyPage(Page page, Wrapper<EmployeeEntity> queryWrapper) {
78
//        return baseMapper.selectMyPage(page,queryWrapper);
79
//    }
80

81 70
    @Override
82 71
    public List<Map<String, Object>> selectNameList(String truename) {
83 72
        return baseMapper.selectNameList(truename);

+ 8 - 4
src/main/java/io/renren/modules/admin/service/impl/LectureServiceImpl.java

@ -33,14 +33,18 @@ public class LectureServiceImpl extends ServiceImpl<LectureDao, LectureEntity> i
33 33
    public PageUtils myQueryPage(Map<String, Object> params) {
34 34
        Long meetingId = Long.valueOf((String) params.get("meetingId"));
35 35
        String key = params.containsKey("page") ? (String) params.get("key") : "";
36
        int page = params.containsKey("page") ? Integer.valueOf(params.get("page").toString()) : 0;
36
        int page = params.containsKey("page") ? Integer.valueOf(params.get("page").toString()) - 1: 0;
37 37
        int limit =  params.containsKey("limit") ? Integer.valueOf(params.get("limit").toString()) : 10;
38
39
        List<Map<String, Object>> lectureList=baseMapper.getPageList(meetingId, key, key, page, limit);
38
        if (page < 0) {
39
            page = 0;
40
        }
41
        int startLimt = page * limit;
42
        int endLimt = startLimt + limit;
43
        List<Map<String, Object>> lectureList=baseMapper.getPageList(meetingId, key, key, startLimt, endLimt);
40 44
        int mc = baseMapper.getCounts(meetingId, key, key);
41 45
    
42 46
43
        return new  PageUtils(lectureList, mc, limit, page);
47
        return new  PageUtils(lectureList, mc, limit, page+1);
44 48
    }
45 49
46 50
    @Override

+ 13 - 5
src/main/java/io/renren/modules/admin/service/impl/MeetingServiceImpl.java

@ -29,11 +29,19 @@ public class MeetingServiceImpl extends ServiceImpl<MeetingDao, MeetingEntity> i
29 29
    }
30 30

31 31
    @Override
32
    public PageUtils queryList(int page, int limit, String key) {
33
        List<Map<String, Object>> mList=baseMapper.queryCN(page, limit, key, key);
34
        Integer mc = baseMapper.queryCNCOUNTS(key, key);
35

36
        return new PageUtils(mList, mc, limit, page);
32
    public PageUtils myQueryPage(Map<String, Object> params) {
33
        String key = (String) params.get("key");
34
        int page = params.containsKey("page") ? Integer.valueOf((String) params.get("page")) - 1 : 0;
35
        int limit = params.containsKey("limit") ? Integer.valueOf((String) params.get("limit")) : 10;
36
        if (page < 0) {
37
            page = 0;
38
        }
39
        int startLimt = page * limit;
40
        int endLimt = startLimt + limit;        
41
        List<Map<String, Object>> mList=baseMapper.getPageList(startLimt, endLimt, key, key);
42
        Integer mc = baseMapper.getCounts(key, key);
43

44
        return new PageUtils(mList, mc, limit, page+1);
37 45
    }
38 46

39 47
    @Override

+ 7 - 3
src/main/java/io/renren/modules/admin/service/impl/PaperServiceImpl.java

@ -37,11 +37,15 @@ public class PaperServiceImpl extends ServiceImpl<PaperDao, PaperEntity> impleme
37 37
        String key = params.containsKey("page") ? (String) params.get("key") : "";
38 38
        int page = params.containsKey("page") ? Integer.valueOf(params.get("page").toString()) : 0;
39 39
        int limit =  params.containsKey("limit") ? Integer.valueOf(params.get("limit").toString()) : 10;
40
41
        List<Map<String, Object>> pList=baseMapper.getPageList(meetingId, page, limit, key, key);
40
        if (page < 0) {
41
            page = 0;
42
        }
43
        int startLimt = page * limit;
44
        int endLimt = startLimt + limit;
45
        List<Map<String, Object>> pList=baseMapper.getPageList(meetingId, startLimt, endLimt, key, key);
42 46
        int mc = baseMapper.getCounts(meetingId, key, key);
43 47
    
44 48
45
        return new  PageUtils(pList, mc, limit, page);
49
        return new  PageUtils(pList, mc, limit, page+1);
46 50
    }
47 51
}

+ 6 - 4
src/main/java/io/renren/modules/admin/service/impl/PaymentServiceImpl.java

@ -37,14 +37,16 @@ public class PaymentServiceImpl extends ServiceImpl<PaymentDao, PaymentEntity> i
37 37
        String key = (String) params.get("key");
38 38
39 39
        int page = params.containsKey("page") ? Integer.valueOf((String) params.get("page")) - 1 : 0;
40
        int limit = params.containsKey("limit") ? Integer.valueOf((String) params.get("limit")) : 10;
40 41
        if (page < 0) {
41 42
            page = 0;
42 43
        }
43
        int limit = params.containsKey("limit") ? Integer.valueOf((String) params.get("limit")) : 10;
44
        List<Map<String, Object>> list = baseMapper.myQueryPage(meetingId, key, key, page, limit); 
45
        int total = baseMapper.myQueryPageCounts(meetingId, key, key);
44
        int startLimt = page * limit;
45
        int endLimt = startLimt + limit;
46
        List<Map<String, Object>> list = baseMapper.getPageList(meetingId, key, key, startLimt, endLimt); 
47
        int total = baseMapper.getCounts(meetingId, key, key);
46 48
47
        return new PageUtils(list, total, limit, page);
49
        return new PageUtils(list, total, limit, page+1);
48 50
    }
49 51
50 52
    @Override