<!--
动态SQL===开始
--><!--<if>--><select id="findUserInfoByUserNameWithIf" parameterType="UserInfo" resultType="UserInfo">
select * from user
<if test="userName != null and userName != ''">
where userName like concat(concat('%', #{userName}),'%')</if></select><!--<where>、<if>元素配合使用 --><select id="findUserInfoByUserNameAndStatus" parameterType="UserInfo" resultType="UserInfo">
select * from user u
<where><if test="userName != null and userName != ''">
u.userName like concat(concat("%", #{userName}),"%")</if><if test="status > -1">
and u.status = #{status}</if></where></select><!--<set>、<if>元素配合使用--><update id="updateUserInfoWithSetAndIf" parameterType="UserInfo">
update user
<set><if test="userName != null and userName != ''">
userName = #{userName},</if><if test="password != null and password !=''">
password = #{password}</if></set>
where id = #{id}</update><!--<trim>元素替换<where>元素--><select id="findUserInfoByUserNameWithIfAndTrim" parameterType="UserInfo" resultType="UserInfo">
select * from user
<trim prefix="where" prefixOverrides="and|or"><if test="userName != null and userName != ''">
userName like concat(concat("%", #{userName}),"%")</if><if test="status > -1">
and status = #{status}</if></trim></select><!--<trim>元素替换<set>元素--><update id="updateUserInfoWithIfAndTrim" parameterType="UserInfo">
update user
<trim prefix="set" prefixOverrides=","><if test="userName != null and userName != ''">
userName = #{userName},</if><if test="password != null and password != ''">
password = #{password}</if></trim>
where id = #{id}</update><!--<choose>、<when>、<otherwise>元素的使用--><select id="findUserInfoWithChoose" parameterType="UserInfo" resultType="UserInfo">
select * from user
<where><choose><when test="userName != null and userName != ''">
userName like concat(concat("%", #{userName}),"%")</when><when test="status > -1">
and status = #{status}</when><otherwise></otherwise></choose></where></select><!--<foreach>元素之list--><select id="findUserInfoByIdsWithForeachForList" parameterType="Integer" resultType="UserInfo">
select * from user where id in
<foreach collection="list" item="ids" open="(" separator="," close=")">
#{ids}</foreach></select><!--<foreach>元素之array--><select id="findUserInfoByIdsWithForeachForArray" parameterType="int" resultType="UserInfo">
select * from user where id in
<foreach collection="array" item="ids" open="(" separator="," close=")">
#{ids}</foreach></select><!--
动态SQL===结束
-->