From b939331cf60d3bb36ee8aa208cf05c3a5a04415f Mon Sep 17 00:00:00 2001 From: Crunchy <3114200645@qq.com> Date: 星期二, 06 八月 2024 12:46:03 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- framework/src/main/java/com/yuanchu/mom/common/PrintChina.java | 28 +++++++++++++++------------- 1 files changed, 15 insertions(+), 13 deletions(-) diff --git a/framework/src/main/java/com/yuanchu/mom/common/PrintChina.java b/framework/src/main/java/com/yuanchu/mom/common/PrintChina.java index 0b84598..8bcc710 100644 --- a/framework/src/main/java/com/yuanchu/mom/common/PrintChina.java +++ b/framework/src/main/java/com/yuanchu/mom/common/PrintChina.java @@ -12,7 +12,7 @@ public class PrintChina { - public static <T> List<Map<String, String>> printChina(Class<T> tClass) { + public static <T> List<Map<String, Object>> printChina(Class<T> tClass) { //灏嗗疄浣撶被鐨勫睘鎬у拰娉ㄩ噴杞崲鎴愬弬鏁� List<Field> fieldList = new ArrayList<>(); while (tClass != null){ @@ -21,29 +21,31 @@ } Field[] fields = new Field[fieldList.size()]; fieldList.toArray(fields); - ArrayList<Map<String, String>> list = new ArrayList<>(); + ArrayList<Map<String, Object>> list = new ArrayList<>(); for (Field field : fields) { - Map<String, String> soundVo = new HashMap<>(); + Map<String, Object> soundVo = new HashMap<>(); boolean bool = field.isAnnotationPresent(ApiModelProperty.class); boolean bool2 = field.isAnnotationPresent(ValueTableShow.class); - if (bool) { - int order; - if (bool2){ - order = field.getAnnotation(ValueTableShow.class).value(); - }else{ - continue; + if (bool2) { + int order = field.getAnnotation(ValueTableShow.class).value(); + String value = field.getAnnotation(ValueTableShow.class).name(); + int width = field.getAnnotation(ValueTableShow.class).width(); + if (bool){ + value = value.isEmpty() ? field.getAnnotation(ApiModelProperty.class).value() : value; } - String value = field.getAnnotation(ApiModelProperty.class).value(); soundVo.put("label", field.getName()); soundVo.put("value", value); + if(width>0){ + soundVo.put("width", width); + } soundVo.put("order", order + ""); - if(list.size() == 0){ + if(list.isEmpty()){ list.add(soundVo); }else{ boolean isAdd = false; for (int i = 0; i < list.size(); i++) { - Map<String, String> map = list.get(i); - if(order < Integer.parseInt(map.get("order"))){ + Map<String, Object> map = list.get(i); + if(order < Integer.parseInt(map.get("order").toString())){ list.add(i, soundVo); isAdd = true; break; -- Gitblit v1.9.3