mybatis中获取参数

1、${parameter}方式:

  parameter是数字时用;模糊查询%${parameter}%时用。

  例:select * from account where userId = ${parameter}; ==> select * from account where userId = 123;

         select * from account where userId like %${parameter}%; ==> select * from account where userId like %123%; ==> 如果模糊的字段是字符串就在外面加个引号

2、#{parameter}方式:

  这种方式获取的是字符串形式的结果。

  例:select * from account where userId = #{parameter}; ==> select * from account where userId = '123';

原文地址:https://www.cnblogs.com/suhfj-825/p/7927356.html