标签:
mybatis 的动态sql语句是基于OGNL表达式的。 分以下几类:
<if test="itemOid != null">
item_oid = #{itemOid}
</if> //item_oid 为表的列名,itemOid为传入参数的属性名<choose>
<when test="title != null">
and title = #{title}
</when>
<when test="content != null">
and content = #{content}
</when>
<otherwise>
and owner = "owner1"
</otherwise>
</choose><trim prefix="where" prefixOverrides="and |or" suffix=""> </trim>
<where>
<if test="title != null">
and title = #{title}
</if>
<if test="content != null">
and content = #{content}
</if>
</where><set>
<if test="title != null">
title = #{title},
</if>
<if test="content != null">
content = #{content},
</if>
<if test="owner != null">
owner = #{owner}
</if>
</set>where id in
<foreach collection="list" index="index" item="temp" open="(" separator="," close=")">
#{temp}
</foreach>标签:
原文地址:http://my.oschina.net/u/1384818/blog/482195