67,550
社区成员




public class Blog {
private int id;
private String name;
private String pwd;
private Author author;
private List<Post> posts;
public class Post {
private int id;
private String post_message;
private int blog_id;
<mapper namespace="org.mybatis.example.BlogMapper">
<resultMap type="Blog" id="blogResultMap">
<id property="id" column="id"/>
<result property="name" column="name"/>
<collection property="posts" javaType="ArrayList" ofType="Post" resultMap="postResultMap"/>
</resultMap>
<resultMap type="Post" id="postResultMap">
<id property="id" column="id"/>
<result property="post_message" column="post_message"/>
<result property="blog_id" column="blog_id"/>
</resultMap>
<select id="selectAll" parameterType="int" resultMap="blogResultMap">
select p.id,p.post_message,p.blog_id,b.id,b.name,b.pwd
from blog b left outer join post p on b.id = p.blog_id where b.id = #{id}
</select>