springboot+mybatisplus实现多表联查分页

1 配置分页插件

创新互联公司主营松溪网站建设的网络公司,主营网站建设方案,重庆App定制开发,松溪h5微信平台小程序开发搭建,松溪网站营销推广欢迎松溪等地区企业咨询

public class MybatisPlusConfig {
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        return new PaginationInterceptor();
    }
    @Bean
    public PerformanceInterceptor performanceInterceptor() {
        PerformanceInterceptor performanceInterceptor = new PerformanceInterceptor();
        Properties properties = new Properties();
        properties.setProperty("format", "true");
        performanceInterceptor.setProperties(properties);
        return performanceInterceptor;
    }
}

2 创建返回实体VO

@ApiModel(value = "员工得分信息")
public class AgentOutVo {
    @ApiModelProperty(value = "所在单位")
    private String unit;
    略……
    @ApiModelProperty(value = "申诉状态")
    private String appealState;
}

3 service层
接口

public interface IAgentScoreService {
    List queryAgentOutMapByPage(Map params);
}

实现

public class AgentScoreServiceImpl extends ServiceImpl implements IAgentScoreService {
    @Autowired
    private AgentScoreMapper agentScoreMapper;
    @Override
    public List queryAgentOutMapByPage(Map params) {
        return agentScoreMapper.selectAgentOutMap(new Query(params).getPage(),params); 
    }
}

4 mapper

public interface AgentScoreMapper extends BaseMapper {
    List selectAgentOutMap(Page pagination, @Param("params") Map params);//params 接收前端对象
}

5 resources/mapper/


分享文章:springboot+mybatisplus实现多表联查分页
标题网址:http://pwwzsj.com/article/jppehj.html