一、if标签
<select id="selectByMoney" resultType="demo.entity.User">
select * from t_user
<where>
<if test="money != null and money != ''">
and money>1000
</if>
</where>
</select>
二、foreach标签
<select id="selectUserByIds" resultType="demo.entity.User">
select * from t_user
<where>
<foreach collection="ids" open="and id in(" item="id" separator="," close=")">
#{id}
</foreach>
</where>
</select>
三、sql标签
<sql id="sql_temp">
select id ,user_name, passwd, money from t_user
</sql>
<select id="login" resultType="demo.entity.User">
<include refid="sql_temp"></include> where user_name=
</select>