mybatisPlus实现分页

转载自:Springboot中MyBatisplus使用IPage和Page分页_page和ipage_super_.的博客-CSDN博客

(1)Controller

public class InterController {
	@Autowired
	private InterService interService;
 
	@GetMapping("/test")
	public IPage test() {
		Integer currentPage = 1; //当前页数:显示第一页数据
		Integer pageSize = 2;    //每页显示多少:每页显示2条数据
		Page page = new Page(currentPage, pageSize);
		IPage findList = interService.findlistpage(page);
		return findList;
	}
}

(2)Service


@Service
public class InterService {
	@Autowired
	private InterDao interDao;
 
	public IPage findlistpage(Page page) {
		return interDao.selectMapsPage(page, null);
	}
}

(3)Dao

public interface InterDao extends BaseMapper {
	IPage selectMapsPage(Page page, QueryWrapper>> wrapper);
}

(4)XML





 
	
	

你可能感兴趣的:(mybatis,java,前端,服务器)