mybaties的xml文件定义模糊查询的"%"

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_40646143/article/details/81944283

传值messageContent进入mapper.xml

<if test="messageContent != null">
                <bind name="messageContent" value="'%'+messageContent.trim()+'%'"/>
                and MESSAGE.MESSAGE_CONTENT like #{messageContent,jdbcType= VARCHAR }
            </if>

传进来的值直接被加上了"%%"

就能通过字段模糊查询

猜你喜欢

转载自blog.csdn.net/qq_40646143/article/details/81944283