Commit ff9d0ebf authored by 单奇雲's avatar 单奇雲

修改topo key编码

parent a26ffd3b
...@@ -66,7 +66,7 @@ public class TopographyController { ...@@ -66,7 +66,7 @@ public class TopographyController {
JSONArray nodes = topographyParam.getJSONArray("nodeData"); JSONArray nodes = topographyParam.getJSONArray("nodeData");
List<TopographyNode> nodeData = JSON.parseArray(JSON.toJSONString(nodes), TopographyNode.class); List<TopographyNode> nodeData = JSON.parseArray(JSON.toJSONString(nodes), TopographyNode.class);
HashMap<String, String> convertKeyMap = new HashMap<>(); HashMap<String, String> convertKeyMap = new HashMap<>();
int curSize = nodeData.stream().filter(e -> Integer.parseInt(e.getKey()) > 0).collect(Collectors.toList()).size(); int curSize = nodeService.queryMaxKeyByAppId(appId);
for(TopographyNode e:nodeData){ for(TopographyNode e:nodeData){
if(Integer.valueOf(e.getKey()) < 0) { if(Integer.valueOf(e.getKey()) < 0) {
curSize = curSize + 1 ; curSize = curSize + 1 ;
......
...@@ -19,5 +19,8 @@ public interface ITopographyNodeDao extends BaseDao<TopographyNode, Long> { ...@@ -19,5 +19,8 @@ public interface ITopographyNodeDao extends BaseDao<TopographyNode, Long> {
TopographyNode findById(String id); TopographyNode findById(String id);
TopographyNode findByKeyAndAppId(String nodekey, String appId); TopographyNode findByKeyAndAppId(String nodekey, String appId);
@Query(value = "select max(`key`) from f_topography_node where app_id = (?1)",nativeQuery = true)
Integer queryMaxKeyByAppId(String appId);
} }
...@@ -78,5 +78,10 @@ public class ITopographyNodeServiceImpl implements ITopographyNodeService{ ...@@ -78,5 +78,10 @@ public class ITopographyNodeServiceImpl implements ITopographyNodeService{
return nodeDao.findByKeyAndAppId(nodekey,appId); return nodeDao.findByKeyAndAppId(nodekey,appId);
} }
@Override
public int queryMaxKeyByAppId(String appId) {
return nodeDao.queryMaxKeyByAppId(appId);
}
} }
...@@ -20,4 +20,6 @@ public interface ITopographyNodeService { ...@@ -20,4 +20,6 @@ public interface ITopographyNodeService {
public TopographyNode queryByKeyAndAppId(String nodekey, String appId); public TopographyNode queryByKeyAndAppId(String nodekey, String appId);
public int queryMaxKeyByAppId(String appId);
} }
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