Commit a60854fc authored by KeYong's avatar KeYong

修改知识库档案存储bug

parent 7a38866b
......@@ -13,7 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.lang.reflect.Field;
import java.util.Date;
/**
......@@ -75,7 +75,7 @@ public class MetaHandler implements MetaObjectHandler {
this.setFieldValByName("recDate", currentDate, metaObject);
}
//以下为装备中转移过来的
if (isExistField("userId", entity)) {
if (isExistField("userId", entity) && isStringField(metaObject,"userId")) {
this.setFieldValByName("userId", String.valueOf(agencyUserModel.getUserId()), metaObject);
}
if (isExistField("creatorId", entity)) {
......@@ -118,6 +118,18 @@ public class MetaHandler implements MetaObjectHandler {
return jsonObj.containsKey(field);
}
private Boolean isStringField(MetaObject metaObject, String fieldName) {
Class clazz = metaObject.getOriginalObject().getClass();
Field[] fields = clazz.getDeclaredFields();
for (Field field : fields) {
if (fieldName.equals(field.getName()) && ("class java.lang.String").equals(field.getGenericType().toString())) {
return true;
}
}
return false;
}
/**
* 更新拦截
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment