qq_40682032
qq_40682032
2017-11-29 06:41

mybatis多对多查询如果最下层为空那么前一层有数据查不出是为什么

  • select
  • mybatis

resultMap id="selectMessageManyBean" type="Community"
id column="coId" property="id"
result column="name" property="name"
result column="described" property="described"
id column="id" property="id"
result column="community_id" property="communityId"
result column="content" property="content"
result column="create_date" property="createDate"
result column="del_flag" property="delFlag"
result column="answer_number" property="answerNumber"
collection property="communityMessageRevertList" ofType="ComunityessageRevert">
id column="detail_id" property="id"
result column="content" property="content"
result column="title" property="title"
result column="photo" property="photo"
collection
collection
resultMap

    select 
    t1.id coId,
    t1.name,
    t1.described,
    t2.id,
    t2.community_id communityId,
    t2.content,
    t2.create_date createDate,
    t2.del_flag delFlag,
    t2.answer_number answerNumber,
    t3.id detail_id,
    t3.content,
    t3.title,
    t3.photo
    from ec_community t1,
    ec_community_message t2,
    ec_community_message_revert t3
    where t1.id = #{id} AND t2.community_id = t1.id  AND t2.id = t3.message_id 
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答