mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-08 16:57:09 +08:00
refactor: 优化部分错误提示信息和代码注释
This commit is contained in:
@@ -67,7 +67,7 @@ public class SqlInjectionUtils {
|
||||
* 检查参数是否存在 SQL 注入
|
||||
*
|
||||
* @param value 检查参数
|
||||
* @return true:非法;false:合法
|
||||
* @return true:存在;false:不存在
|
||||
*/
|
||||
public static boolean check(String value) {
|
||||
return check(value, null);
|
||||
@@ -78,7 +78,7 @@ public class SqlInjectionUtils {
|
||||
*
|
||||
* @param value 检查参数
|
||||
* @param customKeyword 自定义关键字
|
||||
* @return true:非法;false:合法
|
||||
* @return true:存在;false:不存在
|
||||
*/
|
||||
public static boolean check(String value, String customKeyword) {
|
||||
if (CharSequenceUtil.isBlank(value)) {
|
||||
@@ -114,7 +114,7 @@ public class SqlInjectionUtils {
|
||||
*
|
||||
* @param value 检查参数
|
||||
* @param keywords 关键字列表
|
||||
* @return true:非法;false:合法
|
||||
* @return true:存在;false:不存在
|
||||
*/
|
||||
private static boolean checkKeyword(String value, String[] keywords) {
|
||||
for (String keyword : keywords) {
|
||||
|
@@ -92,7 +92,7 @@ public class QueryWrapperHelper {
|
||||
if (sort != null && sort.isSorted()) {
|
||||
for (Sort.Order order : sort) {
|
||||
String field = CharSequenceUtil.toUnderlineCase(order.getProperty());
|
||||
ValidationUtils.throwIf(SqlInjectionUtils.check(field), "排序字段包含非法字符");
|
||||
ValidationUtils.throwIf(SqlInjectionUtils.check(field), "排序字段包含无效字符");
|
||||
queryWrapper.orderBy(field, order.isAscending());
|
||||
}
|
||||
}
|
||||
|
@@ -104,7 +104,7 @@ public class QueryWrapperHelper {
|
||||
if (sort != null && sort.isSorted()) {
|
||||
for (Sort.Order order : sort) {
|
||||
String field = CharSequenceUtil.toUnderlineCase(order.getProperty());
|
||||
ValidationUtils.throwIf(SqlInjectionUtils.check(field), "排序字段包含非法字符");
|
||||
ValidationUtils.throwIf(SqlInjectionUtils.check(field), "排序字段包含无效字符");
|
||||
queryWrapper.orderBy(true, order.isAscending(), field);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user