Mybatis中xml文件支持模糊查询

1、第一中办法是在传入之前将参数拼接成%x%的形式

2、第二种办法:

<select id="queryMessageList" parameterType="xz.Learn.Bean.Message"  resultMap="MessageResult">
    select * from message where 1=1
    <if test="command!=null and !&quot;&quot;.equals(command.trim())">
        and COMMAND=#{command}
    </if>
    <if test="description!=null and !&quot;&quot;.equals(description.trim())">
        and DESCRIPTION like '%'||#{description}||'%'
    </if>
  </select>

 

你可能感兴趣的:(Mybatis中xml文件支持模糊查询)