公共类修改

beetlsql3-dev
Mlxa0324 3 years ago
parent d26fc5faa0
commit 0e23f04c6d

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

Loading…
Cancel
Save