Commit 84270a6f by qiuchaofei

1.系统显示schema做排序

parent 5f3baaa4
...@@ -4,7 +4,7 @@ import com.keymobile.metadata.metadataRelation.pojo.BaseNode; ...@@ -4,7 +4,7 @@ import com.keymobile.metadata.metadataRelation.pojo.BaseNode;
import org.neo4j.ogm.annotation.NodeEntity; import org.neo4j.ogm.annotation.NodeEntity;
@NodeEntity(label = "Neo4jSchema") @NodeEntity(label = "Neo4jSchema")
public class Neo4jSchema extends BaseNode { public class Neo4jSchema extends BaseNode implements Comparable<Neo4jSchema> {
public String getLabel() { public String getLabel() {
return label; return label;
...@@ -15,4 +15,24 @@ public class Neo4jSchema extends BaseNode { ...@@ -15,4 +15,24 @@ public class Neo4jSchema extends BaseNode {
} }
//分层 //分层
private String label; private String label;
@Override
public int compareTo(Neo4jSchema o) {
//先按照年龄排序
Integer i = o.getName().compareTo(this.getName());
if (i == 0) {
//如果Name相等,则按照id排序
i = o.getId().compareTo(this.getId());
if (i == 0) {
//如果id相等,则按照CnName排序
i = o.getCnName().compareTo(this.getCnName());
}
}
/**
* i等于0的时候表示相等;
* i等于1的时候表示大于;
* i等于-1的时候表示小于;
*/
return i;
}
} }
...@@ -43,6 +43,17 @@ public class SystemServiceImpl implements ISystemService { ...@@ -43,6 +43,17 @@ public class SystemServiceImpl implements ISystemService {
catch (Exception e){ catch (Exception e){
e.printStackTrace(); e.printStackTrace();
} }
System.out.println("排序前:");
for(Neo4jSchema neo4jSchema:neo4jSchemaList){
System.out.println("排序前:"+neo4jSchema.getName());
}
Collections.sort(neo4jSchemaList);
System.out.println("排序后:");
for(Neo4jSchema neo4jSchema:neo4jSchemaList){
System.out.println("排序后:"+neo4jSchema.getName());
}
for(Neo4jSchema neo4jSchema:neo4jSchemaList){ for(Neo4jSchema neo4jSchema:neo4jSchemaList){
ReturnNode returnNode = new ReturnNode(); ReturnNode returnNode = new ReturnNode();
......
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