代码栗子:
<select id="select" resultType="com.***">
select * from A where 1=1
<if test="sss != null and sss != ''">
and sss = #{sss}
</if>
<if test="kkk != null and kkk != ''">
and kkk = #{kkk}
</if>
<if test="ttt != null and ttt.size() > 0">
and ttt in
<foreach collection="ttt" item="ttt" index="index" open="(" close=")" separator=",">
#{ttt}
</foreach>
</if>
</select>