(后端)mybatis 模糊查询 mapper.xml的写法(转)

原文地址:https://blog.csdn.net/sc6231565/article/details/46412765 

1. sql中字符串拼接

   SELECT * FROM tableName WHERE name LIKE CONCAT(CONCAT('%', #{text}), '%');

 

2. 使用 ${...} 代替 #{...}

   SELECT * FROM tableName WHERE name LIKE '%${text}%'; 

posted on 2018-04-04 12:08  六一儿童节  阅读(216)  评论(0编辑  收藏  举报

导航