qq_40682032
2017-11-29 06:41mybatis多对多查询如果最下层为空那么前一层有数据查不出是为什么
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条回答
为你推荐
- Spring boot+mybatis项目新增删除查询都没有问题,但是更新时没有错误数据库里面的数据为什么没有修改?
- spring
- mysql
- intellij-idea
- 3个回答
- tk-mybatis可以进行多表关联查询吗?
- spring
- java
- 1个回答
- 已配置ResultMap,但Mybatis查询结果List长度正确,值为空
- eclipse
- java
- java-ee
- spring
- 5个回答
- mybatis 一对一嵌套查询,并没有执行两次sql
- java
- java-ee
- eclipse
- 2个回答
- mybatis查询小于24小时之内生成的数据 mapper编写
- mybatis
- 4个回答