mybatis的模糊查询格式
Posted xh_Blog
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mybatis的模糊查询格式相关的知识,希望对你有一定的参考价值。
mybatis的模糊查询格式;
<select id="xxx" parameterType="com.model.xxx" resultMap="BaseResultMap"> select * from users WHERE 1=1 <if test="name != null and name != ‘‘" > and name like CONCAT(‘%‘,#{name,jdbcType=VARCHAR},‘%‘) </if> <if test="identity != null and identity != ‘‘" > and identity like CONCAT(‘%‘,#{identity,jdbcType=VARCHAR},‘%‘) </if> <if test="phon != null and phon != ‘‘" > and phon like CONCAT(‘%‘,#{phon,jdbcType=VARCHAR},‘%‘) </if> </select>
以上是关于mybatis的模糊查询格式的主要内容,如果未能解决你的问题,请参考以下文章