<if test="state !=null">
<if test="state !=''">
and a.state = #{state}
</if>
</if>
<if test="states !=null">
<if test="states !=''">
and a.state in
<foreach collection="states" item="state"
separator="," open="(" close=")">
#{state}
</foreach>
</if>
</if>
两个 #{state} 都执行了第一个值