Commit e0cfa5af by lepdou

bugfix cluster sort

parent 35f07cfb
......@@ -16,7 +16,7 @@ import org.hibernate.annotations.Where;
@Table(name = "Cluster")
@SQLDelete(sql = "Update Cluster set isDeleted = 1 where id = ?")
@Where(clause = "isDeleted = 0")
public class Cluster extends BaseEntity {
public class Cluster extends BaseEntity implements Comparable<Cluster>{
@Column(name = "Name", nullable = false)
private String name;
......@@ -43,4 +43,12 @@ public class Cluster extends BaseEntity {
public String toString() {
return toStringHelper().add("name", name).add("appId", appId).toString();
}
@Override
public int compareTo(Cluster o) {
if (o == null){
return 1;
}
return (int) (getId() - o.getId());
}
}
......@@ -46,6 +46,7 @@ public class ClusterService {
}
List<Cluster> clusters = clusterRepository.findByAppId(appId);
Collections.sort(clusters);
if (clusters == null) {
return Collections.emptyList();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment