mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 00:58:24 +08:00
Merge branch 'main' of https://github.com/mybatis-flex/mybatis-flex
This commit is contained in:
commit
eefded34f9
@ -50,7 +50,12 @@ class WrapperUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// not Brackets
|
// not Brackets
|
||||||
else {
|
else if (condition instanceof OperatorSelectCondition) {
|
||||||
|
if (list == null) {
|
||||||
|
list = new ArrayList<>();
|
||||||
|
}
|
||||||
|
list.add(((OperatorSelectCondition) condition).getQueryWrapper());
|
||||||
|
} else {
|
||||||
Object value = condition.getValue();
|
Object value = condition.getValue();
|
||||||
if (value instanceof QueryWrapper) {
|
if (value instanceof QueryWrapper) {
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
|
|||||||
@ -77,13 +77,22 @@ public class EnumWrapper<E extends Enum<E>> {
|
|||||||
if (!(methodName.startsWith("get") && methodName.length() > 3)) {
|
if (!(methodName.startsWith("get") && methodName.length() > 3)) {
|
||||||
throw new IllegalStateException("Can not find get method \"" + methodName + "()\" in enum: " + enumClass.getName());
|
throw new IllegalStateException("Can not find get method \"" + methodName + "()\" in enum: " + enumClass.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String enumValueFieldName;
|
||||||
|
if (methodName.startsWith("get")) {
|
||||||
|
enumValueFieldName = StringUtil.firstCharToLowerCase(enumValueMethod.getName().substring(3));
|
||||||
|
} else {
|
||||||
|
enumValueFieldName = enumValueMethod.getName().toLowerCase();
|
||||||
|
}
|
||||||
|
enumValueField = ClassUtil.getFirstField(enumClass, field -> enumValueFieldName.equals(field.getName()));
|
||||||
|
if (enumValueField != null) {
|
||||||
|
propertyType = ClassUtil.getWrapType(enumValueField.getType());
|
||||||
|
} else {
|
||||||
|
throw new IllegalStateException("Can not find field \"" + enumValueFieldName + "()\" in enum: " + enumClass.getName());
|
||||||
|
}
|
||||||
|
|
||||||
this.getterMethod = enumValueMethod;
|
this.getterMethod = enumValueMethod;
|
||||||
this.hasEnumValueAnnotation = true;
|
this.hasEnumValueAnnotation = true;
|
||||||
Class<?> returnType = enumValueMethod.getReturnType();
|
|
||||||
if (returnType.isPrimitive()) {
|
|
||||||
returnType = ConvertUtil.primitiveToBoxed(returnType);
|
|
||||||
}
|
|
||||||
this.propertyType = returnType;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user