sunyj 8 лет назад
Родитель
Сommit
95129eadbe

+ 15 - 0
kanban-auth/src/main/java/com/uas/kanban/model/User.java

@@ -8,6 +8,7 @@ import org.mongodb.morphia.annotations.IndexOptions;
 import org.mongodb.morphia.annotations.Indexed;
 
 import java.util.List;
+import java.util.Objects;
 
 /**
  * 用户
@@ -87,6 +88,20 @@ public class User extends BaseEntity {
                 "} " + super.toString();
     }
 
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null || getClass() != obj.getClass() || !(obj instanceof User)) {
+            return false;
+        }
+        User other = (User) obj;
+        return Objects.equals(code, other.getCode()) && Objects.equals(name, other.getName())
+                && Objects.equals(password, other.getPassword()) && Objects.equals(role, other.getRole())
+                && Objects.equals(panelCodes, other.getPanelCodes());
+    }
+
     /**
      * 角色
      *

+ 15 - 0
kanban-console/src/main/java/com/uas/kanban/model/DataSource.java

@@ -7,6 +7,8 @@ import org.mongodb.morphia.annotations.Entity;
 import org.mongodb.morphia.annotations.IndexOptions;
 import org.mongodb.morphia.annotations.Indexed;
 
+import java.util.Objects;
+
 /**
  * 数据源
  *
@@ -101,4 +103,17 @@ public class DataSource extends BaseEntity {
                 "} " + super.toString();
     }
 
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null || getClass() != obj.getClass() || !(obj instanceof DataSource)) {
+            return false;
+        }
+        DataSource other = (DataSource) obj;
+        return Objects.equals(code, other.getCode()) && Objects.equals(name, other.getName())
+                && Objects.equals(driverClassName, other.getDriverClassName()) && Objects.equals(url, other.getUrl())
+                && Objects.equals(username, other.getUsername()) && Objects.equals(password, other.getPassword());
+    }
 }