From 12a7366453912e6901270be6be6183816df67e9a Mon Sep 17 00:00:00 2001 From: leej1012 Date: Thu, 12 Sep 2024 14:43:06 +0800 Subject: [PATCH] Update bad node --- .../src/main/java/com/github/ontio/mapper/BadNodeMapper.java | 2 +- .../src/main/java/com/github/ontio/model/dao/BadNode.java | 2 ++ .../java/com/github/ontio/service/impl/NodesServiceImpl.java | 2 +- .../src/main/resources/db/migration/V1.85__tbl_bad_node.sql | 1 + .../Explorer/src/main/resources/mapper/BadNodeMapper.xml | 4 ++-- 5 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 back-end-projects/Explorer/src/main/resources/db/migration/V1.85__tbl_bad_node.sql diff --git a/back-end-projects/Explorer/src/main/java/com/github/ontio/mapper/BadNodeMapper.java b/back-end-projects/Explorer/src/main/java/com/github/ontio/mapper/BadNodeMapper.java index 133a2f37..13e8e542 100644 --- a/back-end-projects/Explorer/src/main/java/com/github/ontio/mapper/BadNodeMapper.java +++ b/back-end-projects/Explorer/src/main/java/com/github/ontio/mapper/BadNodeMapper.java @@ -10,6 +10,6 @@ @Repository public interface BadNodeMapper extends Mapper { - List selectBadNodeByCycle(int cycle); + List selectBadNodeByCycle(int cycle); } \ No newline at end of file diff --git a/back-end-projects/Explorer/src/main/java/com/github/ontio/model/dao/BadNode.java b/back-end-projects/Explorer/src/main/java/com/github/ontio/model/dao/BadNode.java index ba4c5fbd..c18e1074 100644 --- a/back-end-projects/Explorer/src/main/java/com/github/ontio/model/dao/BadNode.java +++ b/back-end-projects/Explorer/src/main/java/com/github/ontio/model/dao/BadNode.java @@ -23,5 +23,7 @@ public class BadNode { @Column(name = "public_key") private String publicKey; + private String name; + private Integer cycle; } \ No newline at end of file diff --git a/back-end-projects/Explorer/src/main/java/com/github/ontio/service/impl/NodesServiceImpl.java b/back-end-projects/Explorer/src/main/java/com/github/ontio/service/impl/NodesServiceImpl.java index e421a32b..332fb34d 100644 --- a/back-end-projects/Explorer/src/main/java/com/github/ontio/service/impl/NodesServiceImpl.java +++ b/back-end-projects/Explorer/src/main/java/com/github/ontio/service/impl/NodesServiceImpl.java @@ -1299,7 +1299,7 @@ public ResponseBean getMaxNodeDataCycle() { } public ResponseBean getBadNode(Integer cycle) { - List nodeList = badNodeMapper.selectBadNodeByCycle(cycle); + List nodeList = badNodeMapper.selectBadNodeByCycle(cycle); return new ResponseBean(ErrorInfo.SUCCESS.code(), ErrorInfo.SUCCESS.desc(), nodeList); } } diff --git a/back-end-projects/Explorer/src/main/resources/db/migration/V1.85__tbl_bad_node.sql b/back-end-projects/Explorer/src/main/resources/db/migration/V1.85__tbl_bad_node.sql new file mode 100644 index 00000000..20664879 --- /dev/null +++ b/back-end-projects/Explorer/src/main/resources/db/migration/V1.85__tbl_bad_node.sql @@ -0,0 +1 @@ +ALTER TABLE `tbl_bad_node` ADD COLUMN `name` varchar(70) NOT NULL DEFAULT '' COMMENT '节点名称' AFTER `public_key`; \ No newline at end of file diff --git a/back-end-projects/Explorer/src/main/resources/mapper/BadNodeMapper.xml b/back-end-projects/Explorer/src/main/resources/mapper/BadNodeMapper.xml index 5a0184b6..804a2d6a 100644 --- a/back-end-projects/Explorer/src/main/resources/mapper/BadNodeMapper.xml +++ b/back-end-projects/Explorer/src/main/resources/mapper/BadNodeMapper.xml @@ -2,8 +2,8 @@ - + SELECT public_key,name FROM tbl_bad_node WHERE cycle = #{cycle}