<select id="getlike" parameterType="ConditionUser" resultType="User"> select * from d_user where <if test="name != null"> <!-- 如下格式 --> name like ‘%‘ #{name} ‘%‘ and </if> age between #{minAge} and #{maxAge} </select>
原文:http://www.cnblogs.com/moonmars/p/6629337.html