帮忙看下mybatis查出的数据为什么是一条
若以下回答无法解决问题,邀请你更新回答
1个回答
2016-08-04
展开全部
<resultMap id="articleResultMap" type="Article">
<id property="id" column="id" />
<result property="title" column="title" />
<result property="content" column="content" />
</resultMap>
<resultMap id="articleResultMap" type="Article">
<id property="id" column="id" />
<result property="username" column="userName" />
<result property="useraddress" column="userAddress" />
<collection property="articles" column="ID" javaType="ArrayList" ofType="java.lang.Object" select="select-articles-user" />
</resultMap>
<select id="getUserArticles" parameterType="int" resultMap="resultUserArticleList">
select u.id,u.username,u.useraddress from test_user u where u.id=#{id}
</select>
<select id="select-articles-user" parameterType="int" resultMap="articleResultMap">
select id,title,content from test_article where id = #{ID}
</select>
<id property="id" column="id" />
<result property="title" column="title" />
<result property="content" column="content" />
</resultMap>
<resultMap id="articleResultMap" type="Article">
<id property="id" column="id" />
<result property="username" column="userName" />
<result property="useraddress" column="userAddress" />
<collection property="articles" column="ID" javaType="ArrayList" ofType="java.lang.Object" select="select-articles-user" />
</resultMap>
<select id="getUserArticles" parameterType="int" resultMap="resultUserArticleList">
select u.id,u.username,u.useraddress from test_user u where u.id=#{id}
</select>
<select id="select-articles-user" parameterType="int" resultMap="articleResultMap">
select id,title,content from test_article where id = #{ID}
</select>
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询