问题描述:
实体类有文章,标签。一篇文章有多个标签
对应的数据库表有m_blog,m_tag和m_blog_tag



BlogMapper如下:
<resultMap id="blog_tag" type="com.fanta.entity.Blog">
<result property="bid" column="bid"/>
<result property="user_id" column="user_id"/>
<result property="title" column="title"/>
<result property="description" column="description"/>
<result property="content" column="content"/>
<result property="created

本文介绍了在使用Mybatis进行一对多关系映射时遇到的分页问题,当一篇文章有多个标签时,导致分页结果不准确。文章提出了两种解决方案:一是将查询拆分为两个单独的SQL语句,二是通过调整Controller实现预期的分页效果。通过这两种方式,可以正确地展示每页5篇文章的分页结果。
最低0.47元/天 解锁文章
2055





