若依框架使用的是mybatis-plus 分页插件。
参考原文
分页功能 (dromara.org)
1、从controller开始,使用PageQuery接收分页参数
@GetMapping("/companyInfo/listPlantEquipment")
public TableDataInfo<WbPlantEquipmentDTO> listPlantEquipment(Long companyId, PageQuery pageQuery) {
return wbCompanyInfoService.queryPlantEquipment(companyId, pageQuery);
}
2.Service层
TableDataInfo<WbPlantEquipmentDTO> queryPlantEquipment(Long companyId, PageQuery pageQuery);
@Override
public TableDataInfo<WbPlantEquipmentDTO> queryPlantEquipment(Long companyId, PageQuery pageQuery) {
TableDataInfo.build(baseMapper.queryPlantEquipment(companyId, pageQuery.build()));
}
3、mapper
Page<WbPlantEquipmentDTO> queryPlantEquipment( Long companyId, Page<Object> build);
xml
<select id="queryPlantEquipment" resultType="org.dromara.system.domain.dto.WbPlantEquipmentDTO">
select *
from wb_company_info where id=#{companyId}
</select>