IBatis3.0 中一点典型特性
keyProperty="blogid" >
insert into Blog(author,subject,content, publishTime,blogid)
values(#{author}#,#{subject}#,#{content}#,#{publishTime}#,#{blogid})
</insert> <selectKey keyProperty="blogid" resultType="int" order="BEFORE">
select seq_order.nextval() from dual
</selectKey>
insert into Blog(author,subject,content, publishTime,blogid)
values(#{author}#,#{subject}#,#{content}#,#{publishTime}#,#{blogid})
</insert>
<!--
多表查询的使用
-->
<select id="selectBlogDetails" parameterType="int" resultMap="blogResultMap" >
select
B.id as blogid,
A.author as author
from Blog B
left outer join Author A
on B.author_id=A.id
where B.id=#{id}
</select>
<!--select * from Blog
where state='ACTIVE'
<if test="title!=null">
and title like #{title}
</if>
<if test="author!=null and author.name!=null">
and title like #{author.name}
</if>
</select>
<select id="findActionBlogLike" parameterType="Blog" resultType="Blog">
select * from Blog where state='ACTIVE'
<choose>
<when test="title!=null">
and title like #{title }
</when>
<when test="author!=null and author.name!=null">
and title like #{author.name}
</when>
<otherwise>
and featured=1
</otherwise>
</choose>
</select>
?