mybatis 模糊查询 mapper.xml的写法

1. sql中字符串拼接

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

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

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

猜你喜欢

转载自www.cnblogs.com/qingmuchuanqi48/p/11853983.html