|
|
@@ -82,11 +82,11 @@ public class JsonResourceUtil {
|
|
|
/**
|
|
|
* 拼接字段
|
|
|
*/
|
|
|
- public static String joinFiled(Map<String, Map<String,Object>> mapMap,JSONArray array) {
|
|
|
+ public static String joinFiled(Map<String, Map<String, Object>> mapMap, JSONArray array) {
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
array.forEach(it -> {
|
|
|
String filedName = it.toString();
|
|
|
- if (null== mapMap.get(filedName)||mapMap.get(filedName).isEmpty()) {
|
|
|
+ if (null == mapMap.get(filedName) || mapMap.get(filedName).isEmpty()) {
|
|
|
sb.append(it).append(",");
|
|
|
} else {
|
|
|
sb.append(mapMap.get(filedName).get("filed")).append(",");
|
|
|
@@ -98,11 +98,11 @@ public class JsonResourceUtil {
|
|
|
/**
|
|
|
* 拼接title
|
|
|
*/
|
|
|
- public static List<String> joinTitle(Map<String, Map<String,Object>> mapMap,JSONArray array) {
|
|
|
+ public static List<String> joinTitle(Map<String, Map<String, Object>> mapMap, JSONArray array) {
|
|
|
List<String> titles = new ArrayList<>(20);
|
|
|
array.forEach(it -> {
|
|
|
String titleName = it.toString();
|
|
|
- if (null== mapMap.get(titleName)||mapMap.get(titleName).isEmpty()) {
|
|
|
+ if (null == mapMap.get(titleName) || mapMap.get(titleName).isEmpty()) {
|
|
|
titles.add(it.toString());
|
|
|
} else {
|
|
|
titles.add(mapMap.get(it.toString()).get("comment").toString());
|
|
|
@@ -114,9 +114,24 @@ public class JsonResourceUtil {
|
|
|
/**
|
|
|
* 拼接字段
|
|
|
*/
|
|
|
- public static String joinAllFiled(Map<String, Map<String,Object>> mapMap) {
|
|
|
+ public static String joinAllFiled(Map<String, Map<String, Object>> mapMap) {
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
mapMap.forEach((k, v) -> sb.append(v.get("filed")).append(","));
|
|
|
return sb.deleteCharAt(sb.length() - 1).toString();
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取字段名称JSON
|
|
|
+ */
|
|
|
+ public static List<JSONObject> getFieldsNames(Map<String, Map<String, Object>> mapMap) {
|
|
|
+ List<JSONObject> list = new ArrayList<>();
|
|
|
+ mapMap.forEach((k, v) -> {
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("code",k);
|
|
|
+ jsonObject.put("name", v.get("comment"));
|
|
|
+ list.add(jsonObject);
|
|
|
+ });
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
}
|