fix: 优化通用查询注解解析器

This commit is contained in:
Charles7c 2023-03-31 21:31:07 +08:00
parent 9f25925d46
commit a623acd4a5

View File

@ -142,7 +142,8 @@ public class QueryHelper {
String property = queryAnnotation.property();
fieldName = StrUtil.blankToDefault(property, fieldName);
String columnName = StrUtil.toUnderlineCase(fieldName);
switch (queryAnnotation.type()) {
Query.Type queryType = queryAnnotation.type();
switch (queryType) {
case EQUAL:
queryWrapper.eq(columnName, fieldValue);
break;
@ -163,7 +164,9 @@ public class QueryHelper {
break;
case BETWEEN:
List<Object> between = new ArrayList<>((List<Object>)fieldValue);
if (between.size() >= 2) {
queryWrapper.between(columnName, between.get(0), between.get(1));
}
break;
case LEFT_LIKE:
queryWrapper.likeLeft(columnName, fieldValue);
@ -191,7 +194,7 @@ public class QueryHelper {
queryWrapper.isNotNull(columnName);
break;
default:
break;
throw new IllegalArgumentException(String.format("暂不支持 [%s] 查询类型", queryType));
}
}
}