首页 > 技术文章 > MyBatis——模糊查询

whx20100101 2018-10-17 20:59 原文

在mybatis中可以使用三种模糊查询的方式:

<!-- 模糊查询 -->
    <select id="selectListByTitle" parameterType="java.lang.String" resultType="com.yijian.mybatis.pojo.User">
        <!-- 三种方法都可以 -->
        select * from user where userName like '%${value}%' 

        select * from user where userName like "%"#{userName}"%" 

        select * from user where userName like concat("%",#{userName},"%")
    </select>

 

推荐阅读