feat: mybatisplus分页失效修复

This commit is contained in:
张松 2024-12-11 11:35:59 +08:00
parent 496df13b1e
commit 0756092e4d
5 changed files with 23 additions and 11 deletions

View File

@ -215,10 +215,6 @@
<groupId>org.mybatis</groupId> <groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId> <artifactId>mybatis-spring</artifactId>
</exclusion> </exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</exclusion>
</exclusions> </exclusions>
</dependency> </dependency>

View File

@ -0,0 +1,15 @@
package com.chaozhanggui.system.cashierservice.config;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class MyBatisPlusConfig {
@Bean
public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor();
}
}

View File

@ -122,7 +122,7 @@ public class TbShopPermission extends Model<TbShopPermission> {
* @return 主键值 * @return 主键值
*/ */
@Override @Override
protected Serializable pkVal() { public Serializable pkVal() {
return this.id; return this.id;
} }
} }

View File

@ -70,7 +70,7 @@ public class TbShopStaffPermission extends Model<TbShopStaffPermission> {
* @return 主键值 * @return 主键值
*/ */
@Override @Override
protected Serializable pkVal() { public Serializable pkVal() {
return this.id; return this.id;
} }
} }

View File

@ -494,7 +494,8 @@ public class TbCallServiceImpl implements TbCallService {
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
LambdaQueryChainWrapper<TbCallQueue> query = callQueueService.lambdaQuery()
LambdaQueryWrapper<TbCallQueue> query = new LambdaQueryWrapper<TbCallQueue>()
.eq(TbCallQueue::getShopId, shopId) .eq(TbCallQueue::getShopId, shopId)
.eq(TbCallQueue::getCreateDay, DateUtil.today()) .eq(TbCallQueue::getCreateDay, DateUtil.today())
.in(TbCallQueue::getCallTableId, tableIds); .in(TbCallQueue::getCallTableId, tableIds);
@ -504,10 +505,10 @@ public class TbCallServiceImpl implements TbCallService {
}else { }else {
query.in(TbCallQueue::getState, 0, 1); query.in(TbCallQueue::getState, 0, 1);
} }
Page<TbCallQueue> pageInfo = query
.orderByAsc(TbCallQueue::getCreateTime) Page<TbCallQueue> pageInfo = callQueueService.page(new Page<>(page, size),
.orderByDesc(TbCallQueue::getState) query.orderByAsc(TbCallQueue::getCreateTime)
.page(new Page<>(page, size)); .orderByDesc(TbCallQueue::getState));
List<TbCallQueue> list1 = pageInfo.getRecords(); List<TbCallQueue> list1 = pageInfo.getRecords();