We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ae7c8d3 commit 2d4d531Copy full SHA for 2d4d531
README.md
@@ -173,4 +173,9 @@ SET FOREIGN_KEY_CHECKS = 1;
173
174
SQL注入修复方式采用预处理方式,修复见代码。Mybatis的`#{}`也是预处理方式处理SQL注入。
175
176
-在使用了mybatis框架后,需要进行排序功能时,在mapper.xml文件中编写sql语句时,注意orderBy后的变量要使用${},而不用#{}。因为`#{}`变量是经过预编译的,${}没有经过预编译。虽然${}存在sql注入的风险,但orderBy必须使用`${}`,因为`#{}`会多出单引号`''`导致sql语句失效。为防止sql注入只能自己判断输入的值是否是否存在SQL。
+在使用了mybatis框架后,需要进行排序功能时,在mapper.xml文件中编写sql语句时,注意orderBy后的变量要使用${},而不用#{}。因为`#{}`变量是经过预编译的,${}没有经过预编译。虽然${}存在sql注入的风险,但orderBy必须使用`${}`,因为`#{}`会多出单引号`''`导致sql语句失效。为防止sql注入只能自己判断输入的值是否是否存在SQL。
177
+
178
+```sql
179
+select * from users order by 'id' desc -- 排序无效,默认升序
180
+select * from users order by id desc -- 降序
181
+```
0 commit comments