mybatis动态注入#{}和${}的区别

今天做客户管理系统时候遇到一个问题是关于#{}和${}的
对于这两个有点混淆,所以百度一下
在这里插入图片描述
1 #是将传入的值当做字符串的形式, eg:select id,name,age from student where id
=#{id},当前端把 id 值 1,传入到后台的时候,就相当于 select id,name,age from student
where id =‘1’.
2 是 将 传 入 的 数 据 直 接 显 示 生 成 s q l 语 句 , e g : s e l e c t i d , n a m e , a g e f r o m s t u d e n t w h e r e i d = 是将传入的数据直接显示生成 sql 语句, eg:select id,name,age from student where id = sqleg:selectid,name,agefromstudentwhereid={id},当前端把 id 值 1,传入到后台的时候,就相当于 select id,name,age from
student where id = 1.

这是博客链接https://blog.csdn.net/rongxue2599/article/details/79662959

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值