mybaitis动态sql利用bind标签代替%拼接完成模糊查询
Oracle中使用bind的写法
<select id="selectUser" resultType="user" parameterType="user"> <bind name="pattern" value="'%' + username + '%'" /> select id,sex,age,username,password from user where username LIKE #{pattern} </select>
Oracle中不使用bind的写法
<select id="selectUser" resultType="user" parameterType="user"> select id,sex,age,username,password from user where username LIKE CONCAT(CONCAT('%',#{username}),'%') </select>