diff --git a/src/main/java/com/ly/doc/helper/ParamsBuildHelper.java b/src/main/java/com/ly/doc/helper/ParamsBuildHelper.java index 2dbdc181..e60dbcd2 100644 --- a/src/main/java/com/ly/doc/helper/ParamsBuildHelper.java +++ b/src/main/java/com/ly/doc/helper/ParamsBuildHelper.java @@ -707,6 +707,12 @@ public static List buildMapParam(String[] globGicName, String pre, int .orElse(DocGlobalConstants.DEFAULT_MAP_KEY_DESC)) .setVersion(DocGlobalConstants.DEFAULT_VERSION) .setPid(null == keyParentId ? pid : keyParentId); + + Object enumValueWithJsonValue = JavaClassUtil.getEnumValueWithJsonValue(mapKeyClass, projectBuilder, + enumConstant); + if (jsonRequest && enumValueWithJsonValue != null) { + apiParam.setField(pre + enumValueWithJsonValue); + } apiParam.setId(apiParam.getPid() + paramList.size() + 1); if (null == keyParentId) { keyParentId = apiParam.getPid(); diff --git a/src/main/java/com/ly/doc/template/IRestDocTemplate.java b/src/main/java/com/ly/doc/template/IRestDocTemplate.java index 437abb23..069bf6d9 100644 --- a/src/main/java/com/ly/doc/template/IRestDocTemplate.java +++ b/src/main/java/com/ly/doc/template/IRestDocTemplate.java @@ -1247,7 +1247,7 @@ else if (JavaClassValidateUtil.isMap(fullyQualifiedName)) { paramList.addAll(ParamsBuildHelper.buildMapParam(gicNameArr, DocGlobalConstants.EMPTY, 0, String.valueOf(required), Boolean.FALSE, new HashMap<>(16), builder, groupClasses, - docJavaMethod.getJsonViewClasses(), 0, Boolean.FALSE, 1, null)); + docJavaMethod.getJsonViewClasses(), 0, jsonRequest, 1, null)); // is map without Gic if (JavaClassValidateUtil.isMap(typeName)) { diff --git a/src/main/java/com/ly/doc/utils/JavaClassUtil.java b/src/main/java/com/ly/doc/utils/JavaClassUtil.java index 31e3b96f..b25514b8 100644 --- a/src/main/java/com/ly/doc/utils/JavaClassUtil.java +++ b/src/main/java/com/ly/doc/utils/JavaClassUtil.java @@ -408,7 +408,7 @@ public static Object getDefaultEnumValue(JavaClass javaClass, ProjectDocConfigBu * @return Object The enum value, whose type depends on the specific enum definition * @throws RuntimeException If the enum constants do not exist */ - private static Object getEnumValueWithJsonValue(JavaClass javaClass, ProjectDocConfigBuilder builder, + public static Object getEnumValueWithJsonValue(JavaClass javaClass, ProjectDocConfigBuilder builder, JavaField enumConstant) { String methodName = findMethodWithJsonValue(javaClass); if (Objects.nonNull(methodName)) {