修复cutomField继承参数失效问题
This commit is contained in:
parent
46f058486a
commit
385ab90606
|
@ -151,11 +151,11 @@ public class ParamsBuildHelper {
|
||||||
boolean strRequired = false;
|
boolean strRequired = false;
|
||||||
int annotationCounter = 0;
|
int annotationCounter = 0;
|
||||||
CustomField customResponseField = responseFieldMap.get(fieldName);
|
CustomField customResponseField = responseFieldMap.get(fieldName);
|
||||||
if (customResponseField != null && simpleName.equals(customResponseField.getOwnerClassName()) && (customResponseField.isIgnore()) && isResp) {
|
if (customResponseField != null && JavaClassUtil.isTargetChildClass(simpleName,customResponseField.getOwnerClassName()) && (customResponseField.isIgnore()) && isResp) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
CustomField customRequestField = projectBuilder.getCustomReqFieldMap().get(fieldName);
|
CustomField customRequestField = projectBuilder.getCustomReqFieldMap().get(fieldName);
|
||||||
if (customRequestField != null && simpleName.equals(customRequestField.getOwnerClassName()) && (customRequestField.isIgnore()) && !isResp) {
|
if (customRequestField != null && JavaClassUtil.isTargetChildClass(simpleName,customRequestField.getOwnerClassName())&& (customRequestField.isIgnore()) && !isResp) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
an:
|
an:
|
||||||
|
@ -211,18 +211,18 @@ public class ParamsBuildHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//cover required
|
//cover required
|
||||||
if (customRequestField != null && !isResp && simpleName.equals(customRequestField.getOwnerClassName())
|
if (customRequestField != null && !isResp && JavaClassUtil.isTargetChildClass(simpleName,customRequestField.getOwnerClassName())
|
||||||
&& customRequestField.isRequire()) {
|
&& customRequestField.isRequire()) {
|
||||||
strRequired = true;
|
strRequired = true;
|
||||||
}
|
}
|
||||||
//cover comment
|
//cover comment
|
||||||
String comment = "";
|
String comment = "";
|
||||||
if (null != customRequestField && StringUtil.isNotEmpty(customRequestField.getDesc())
|
if (null != customRequestField && StringUtil.isNotEmpty(customRequestField.getDesc())
|
||||||
&& simpleName.equals(customRequestField.getOwnerClassName()) && !isResp) {
|
&& JavaClassUtil.isTargetChildClass(simpleName,customRequestField.getOwnerClassName()) && !isResp) {
|
||||||
comment = customRequestField.getDesc();
|
comment = customRequestField.getDesc();
|
||||||
}
|
}
|
||||||
if (null != customResponseField && StringUtil.isNotEmpty(customResponseField.getDesc())
|
if (null != customResponseField && StringUtil.isNotEmpty(customResponseField.getDesc())
|
||||||
&& simpleName.equals(customResponseField.getOwnerClassName()) && isResp) {
|
&& JavaClassUtil.isTargetChildClass(simpleName,customResponseField.getOwnerClassName()) && isResp) {
|
||||||
comment = customResponseField.getDesc();
|
comment = customResponseField.getDesc();
|
||||||
}
|
}
|
||||||
if (StringUtils.isBlank(comment)) {
|
if (StringUtils.isBlank(comment)) {
|
||||||
|
|
|
@ -494,4 +494,19 @@ public class JavaClassUtil {
|
||||||
return returnType;
|
return returnType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isTargetChildClass(String sourceClass,String targetClass){
|
||||||
|
try {
|
||||||
|
Class c = Class.forName(sourceClass);
|
||||||
|
while (c != null){
|
||||||
|
if(c.getName().equals(targetClass)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
c = c.getSuperclass();
|
||||||
|
}
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue