lixing преди 3 години
родител
ревизия
6653682974

+ 14 - 0
fm-common/src/main/java/com/persagy/fm/common/model/vo/DuplicateVO.java

@@ -0,0 +1,14 @@
+package com.persagy.fm.common.model.vo;
+
+import lombok.Data;
+
+/**
+ * 校验是否重复vo
+ *
+ * @author lixing
+ * @version V1.0 2021/4/7 7:36 下午
+ **/
+@Data
+public class DuplicateVO {
+    private Boolean duplicate;
+}

+ 17 - 0
fm-common/src/main/java/com/persagy/fm/common/utils/ListUtil.java

@@ -4,6 +4,7 @@ import org.apache.poi.ss.formula.functions.T;
 import org.assertj.core.util.Lists;
 import org.springframework.util.CollectionUtils;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -54,4 +55,20 @@ public class ListUtil {
     public static <T> List<T> getDeletedList(List<T> listBefore, List<T> listAfter) {
         return getAddedList(listAfter, listBefore);
     }
+
+    public static <T> Boolean listChanged(List<T> listBefore, List<T> listAfter) {
+        if (listBefore == null) {
+            return listAfter == null;
+        }
+        if (listAfter == null) {
+            return true;
+        }
+        return listBefore.retainAll(listAfter) || listAfter.retainAll(listBefore);
+    }
+
+//    public static void main(String[] args) {
+//        ArrayList<String> list1 = Lists.newArrayList("1", "2", "3");
+//        ArrayList<String> list2 = Lists.newArrayList("1", "2", "3");
+//        System.out.println(listChanged(list1, list2));
+//    }
 }

+ 10 - 0
fm-common/src/main/java/com/persagy/fm/common/utils/ResultHelper.java

@@ -52,6 +52,16 @@ public class ResultHelper {
     }
 
     /**
+     * 单个数据
+     * @param content
+     * @param <T>
+     * @return
+     */
+    public static <T> CommonResult<T> single(T content, String desc) {
+        return new CommonResult(ResponseCode.A00000.getCode(), desc, content);
+    }
+
+    /**
      * 多个数据 - 列表
      * @param records
      * @param <T>