SQL注入是项目开发中很重要的一个概念,初级中级面试的概率非常高,需要重点掌握!
喜欢听我叨叨的,直接点击看视频
1 准备工作
本次演示使用的是目前最热门的Java快速开发架构:SpringBoot2.3.4 + Mybatis + Mysql8
先准备一张测试表:
drop table if exists `test`;
create table `test` (
id bigint not null comment 'id',
name varchar(50) comment '名称',
primary key (`id`)
) engine=innodb default charset=utf8mb4 comment='测试';
insert into `test` (id, name) values (1, 'test1');
insert into `test` (id, name) values (2, 'test2');
TestController:
@RequestMapping("/find")
public List<Test> test(@RequestBody Map<String, String> map) {
return testService.find(map.get("id"));
}