|
|
@ -1,7 +1,7 @@
|
|
|
|
package com.ibeetl.admin.core.service;
|
|
|
|
package com.ibeetl.admin.core.service;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
import cn.hutool.core.exceptions.UtilException;
|
|
|
|
import cn.hutool.core.lang.Assert;
|
|
|
|
import cn.hutool.core.util.*;
|
|
|
|
import cn.hutool.core.util.*;
|
|
|
|
import com.ibeetl.admin.core.annotation.Dict;
|
|
|
|
import com.ibeetl.admin.core.annotation.Dict;
|
|
|
|
import com.ibeetl.admin.core.annotation.DictDeep;
|
|
|
|
import com.ibeetl.admin.core.annotation.DictDeep;
|
|
|
@ -417,17 +417,16 @@ public class CoreBaseService<T> {
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
String display = "";
|
|
|
|
String display = "";
|
|
|
|
Method methodByName = ReflectUtil.getMethodByName(field.getType(), "get" + StrUtil.upperFirst(dict.value()));
|
|
|
|
Method methodByName = ReflectUtil.getMethodByName(bean.getClass(), "get" + StrUtil.upperFirst(dict.value()));
|
|
|
|
|
|
|
|
Assert.notNull(methodByName, field.getName() + " 缺少getter方法");
|
|
|
|
Object enumValue = ReflectUtil.invoke(field.get(ext), methodByName);
|
|
|
|
Object enumValue = ReflectUtil.invoke(field.get(ext), methodByName);
|
|
|
|
if (ObjectUtil.isNotEmpty(enumValue)) {
|
|
|
|
if (ObjectUtil.isNotEmpty(enumValue)) {
|
|
|
|
display = String.valueOf(enumValue);
|
|
|
|
display = String.valueOf(enumValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ext.set(field.getName() + dict.suffix(), display);
|
|
|
|
ext.set(field.getName() + dict.suffix(), display);
|
|
|
|
} catch (UtilException e) {
|
|
|
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
|
|
|
throw new RuntimeException(field.getName() + " 缺少getter方法");
|
|
|
|
log.error("@DictEnum 注解解析异常: {}", e.getMessage());
|
|
|
|
} catch (Exception e) {
|
|
|
|
} finally {
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
field.setAccessible(false);
|
|
|
|
field.setAccessible(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|