mysql 映射插件中 $ # 的区别
$简单的字符串替换,应用场景: 传数据库对象:如表名 select * from ${tableA} where.......
tableA传入 user_info_tab ---------> select * from user_info_tab
#预编译 对替换的字段总是加上 ‘’
select * from tableB where t_user_id =#{userId}
传入 xiamingqing之后
select * from tableB where t_user_id ='xiamingqing'
如果是 select * from tableB where t_user_id =${userId}
传入 xiamingqing之后
select * from tableB where t_user_id =xiamingqing
补充:
$的场景是 使用 表名或者列表的时候使用
select ${col1},${col2} from ${table} 在这种情况下使用

浙公网安备 33010602011771号