Mybatis中if标签的使用
代码如下:
<select id="selectOrder" resultMap="BaseResultMap" parameterType="com.tuanzi.order.entity.Indent">
select
*
from indent
<where>
<if test="name != null">
name like CONCAT("%",#{name},"%")
</if>
<if test="phone != null">
and phone like CONCAT("%",#{phone},"%")
</if>
<if test="number != null">
and number like CONCAT("%",#{number},"%")
</if>
</where>
</select>