|
<select id=”findActiveBlogWithTitleLike” parameterType=”Blog” resultType=”Blog”> SELECT * FROM BLOG WHERE state = ?ACTIVE? <if test=”title != null”> AND title like #{title} </if></select>
.... SELECT * FROM BLOG <where> <if test=”state != null”> state = #{state} </if> <if test=”title != null”> AND title like #{title} </if> <if test=”author != null and author.name != null”> AND title like #{author.name} </if> </where></select><update id="updateAuthorIfNecessary" parameterType="domain.blog.Author"> update Author <set> <if test="username != null">username=#{username},</if> <if test="password != null">password=#{password},</if> <if test="email != null">email=#{email},</if> <if test="bio != null">bio=#{bio}</if> </set> where id=#{id}</update>
<if test=”state != null”> state = #{state} </if>
<if test=”state > 0 ”> state = #{state} </if>
<if test=”createdTime < 2009-10-23 ”> readonly = true </if>
<if test=”state > 0 ”> state = #{state} </if> <if test=”createdTime < 2009-10-23 ”> readonly = true </if> <paramsMapping> <map paramName="state" propName="blogState" /> <map paramName="createdTime" dataType="datetime|yyyy-MM-dd" /> </paramsMapping>
<select id=”findActiveBlogLike” 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>
<select id=”findActiveBlogLike” parameterType=”Blog” resultType=”Blog”> SELECT * FROM BLOG WHERE state = "ACTIVE" <choose> <when test=”title.trim().length() > 0”> AND title like #{title} </when> <when test=”author.getName().length() > 0”> AND title like #{author.name} </when> <otherwise> AND featured = 1 </otherwise> </choose></select>
<if test=”(state > 0 and order ~= 'desc') or (id > 10 and name == 'abc') ”> state = #{state}</if>
其他的哪?
联系客服