[求助]mybatis查询结果集封装后的数据比在数据库直接查出来的少了一条

下面是日志信息,可以看出一共查到了3条数据

020-06-22 18:56:31.584  WARN 19976 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool        : HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=49m22s617ms985µs100ns).
2020-06-22 18:57:06.022 DEBUG 19976 --- [nio-8080-exec-7] c.p.m.BlogMapper.selectBlogByReTyTiPa    : ==>  Preparing: select b.blogId,b.title ,b.author,b.context,b.recommend,b.published, b.createDate,b.updateDate, t.tagText,t.tagId, ty.typeId,ty.typeText from blog b left join blog_tag bt on bt.blogId=b.blogId left join tag t on t.tagId=bt.tagId left join type ty on ty.typeId=b.typeId where b.recommend=? limit ? , 5 
2020-06-22 18:57:06.023 DEBUG 19976 --- [nio-8080-exec-7] c.p.m.BlogMapper.selectBlogByReTyTiPa    : ==> Parameters: true(Boolean), 5(Integer)
2020-06-22 18:57:06.028 DEBUG 19976 --- [nio-8080-exec-7] c.p.m.BlogMapper.selectBlogByReTyTiPa    : <==      Total: 3
2020-06-22 18:57:06.028 DEBUG 19976 --- [nio-8080-exec-7] c.psj.mapper.BlogMapper.selectBlogCount  : ==>  Preparing: select count(*) from blog 
2020-06-22 18:57:06.029 DEBUG 19976 --- [nio-8080-exec-7] c.psj.mapper.BlogMapper.selectBlogCount  : ==> Parameters: 
2020-06-22 18:57:06.030 DEBUG 19976 --- [nio-8080-exec-7] c.psj.mapper.BlogMapper.selectBlogCount  : <==      Total: 1

下面是idea中debug的查看到的结果集,只有两条
[求助]mybatis查询结果集封装后的数据比在数据库直接查出来的少了一条_第1张图片
下面是Blog对象和数据库的映射

    <!--博客映射-->
    <resultMap id="BlogMap" type="Blog">
        <id property="blogId" column="blogId"></id>
        <result property="title" column="title"/>
        <result property="context" column="context"/>
        <result property="author" column="author"/>
        <result property="createDate" column="createDate" />
        <result property="updateDate" column="updateDate"/>
        <result property="recommend" column="recommend" />
        <result property="published" column="published"/>
        <result property="firstPicture" column="firstPicture"/>
        <result property="flag" column="flag"/>
        <result property="description" column="description"/>
        <result property="shareStatement" column="shareStatement"/>
        <result property="appreciation" column="appreciation"/>
        <result property="commentabled" column="commentabled"/>
        <association property="type" resultMap="TypeMap"/>
        <collection property="comments"
                    ofType="Comment" resultMap="CommentMap"/> 
        <collection property="tags"  javaType="List" ofType="Tag" resultMap="TagMap"/>
    </resultMap>

下面是sql语句

    
    <select id="selectBlogByReTyTiPa" resultMap="BlogMap">
        select b.blogId,b.title ,b.author,b.context,b.recommend,b.published,
                    b.createDate,b.updateDate,
               t.tagText,t.tagId,
               ty.typeId,ty.typeText
        from blog b
        left join blog_tag bt on bt.blogId=b.blogId
        left join tag t on t.tagId=bt.tagId
        left join type ty on ty.typeId=b.typeId
        where
        <if test="blog.title!='' and blog.title!=null">
          b.title like concat('%',#{blog.title},'%') and
        if>
        <if test="blog.typeId!='' and blog.typeId!=null">
            b.typeId=#{blog.typeId} and
        if>
        b.recommend=#{blog.recommend}

        limit #{offset} , 5
    select>

下面是cmd里直接用sql语句查询的结果,的确有三条数据
[求助]mybatis查询结果集封装后的数据比在数据库直接查出来的少了一条_第2张图片
数据库表结构和数据
在这里插入图片描述
我尝试搜过类似的问题,但是没有得到解决.
有人知道是怎么回事么?

你可能感兴趣的:(mybatis)