mybatis中的模糊查询

mybatis中的模糊查询

<select id="query" resultType="User" parameterType="java.util.HashMap">
select
<include refid="selectId" />
from user
<where>
<if test="t.userName != null and t.userName != ''">
userName like '%${t.userName}%'
</if>
<if test="t.userNickname != null and t.userNickname != ''">
and userNickname like '%${t.userNickname}%'
</if>
</where>
</select>

你可能感兴趣的:(mybatis)