Selaa lähdekoodia

Merge branch 'lvy' of http://219.151.181.73:3000/zhuwei/bladex into test-merge-02

lvy 3 kuukautta sitten
vanhempi
commit
54e3e3aeea

+ 40 - 4
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -2582,7 +2582,16 @@ private void addCopyTabData(WbsTreeContract needCopyNode, WbsTreeContract toCopy
                             String tableName = needTab.getInitTableName();
                             String col = nodeTabColsMap.get(tableName);
                             String colVal = nodeTabColsMap.get(tableName);
-                            colVal = colVal.replaceAll("id,p_key_id,", "'" + SnowFlakeUtil.getId() + "' as id,'" + toCopyNodeTab.getPKeyId() + "' as p_key_id,");
+                            String[] split = colVal.split(",");
+                            for (int i = 0; i < split.length; i++) {
+                                String key = split[i];
+                                if (key.equals("id")) {
+                                    split[i] = "'" + SnowFlakeUtil.getId() + "' as id";
+                                } else if (key.equals("p_key_id")) {
+                                    split[i] = "'" + toCopyNodeTab.getPKeyId() + "' as p_key_id";
+                                }
+                            }
+                            colVal = String.join(",", split);
                             //delete SQL (先删除旧数据,再新增)
                             String delSql = "delete from " + tableName + " where p_key_id = " + toCopyNodeTab.getPKeyId() + " ; ";
                             //insert into SQL
@@ -2631,7 +2640,16 @@ private void addCopyTabData(WbsTreeContract needCopyNode, WbsTreeContract toCopy
                                 String tableName = objTab.getInitTableName();
                                 String col = nodeTabColsMap.get(tableName);
                                 String colVal = nodeTabColsMap.get(tableName);
-                                colVal = colVal.replaceAll("id,p_key_id,", "'" + SnowFlakeUtil.getId() + "' as id,'" + objTab.getPKeyId() + "' as p_key_id,");
+                                String[] split = colVal.split(",");
+                                for (int i = 0; i < split.length; i++) {
+                                    String key = split[i];
+                                    if (key.equals("id")) {
+                                        split[i] = "'" + SnowFlakeUtil.getId() + "' as id";
+                                    } else if (key.equals("p_key_id")) {
+                                        split[i] = "'" + objTab.getPKeyId() + "' as p_key_id";
+                                    }
+                                }
+                                colVal = String.join(",", split);
                                 //delete SQL (先删除旧数据,再新增)
                                 String delSql = "delete from " + tableName + " where p_key_id = " + objTab.getPKeyId() + " ; ";
                                 //insert into SQL
@@ -2747,7 +2765,16 @@ private void addCopyNodesAndTabsBuildData(List<WbsTreeContract> addNodeList, Lis
                         String tableName = obj.getInitTableName();
                         String col = nodeTabColsMap.get(tableName);
                         String colVal = nodeTabColsMap.get(tableName);
-                        colVal = colVal.replaceAll("id,p_key_id,", "'" + SnowFlakeUtil.getId() + "' as id,'" + obj.getPKeyId() + "' as p_key_id,");
+                        String[] split = colVal.split(",");
+                        for (int i = 0; i < split.length; i++) {
+                            String key = split[i];
+                            if (key.equals("id")) {
+                                split[i] = "'" + SnowFlakeUtil.getId() + "' as id";
+                            } else if (key.equals("p_key_id")) {
+                                split[i] = "'" + obj.getPKeyId() + "' as p_key_id";
+                            }
+                        }
+                        colVal = String.join(",", split);
                         //delete SQL (先删除旧数据,再新增)
                         String delSql = "delete from " + tableName + " where p_key_id = " + obj.getPKeyId() + " ; ";
                         //insert into SQL
@@ -2880,7 +2907,16 @@ private void addCopyNodesAndTabsBuildData(List<WbsTreeContract> addNodeList, Lis
                                     StringBuilder copyDataSql = new StringBuilder();
                                     String col = queryProcessDataVO.getAncestors();
                                     String colVal = queryProcessDataVO.getAncestors();
-                                    colVal = colVal.replaceAll("id,p_key_id,", "'" + SnowFlakeUtil.getId() + "' as id,'" + objTab.getPKeyId() + "' as p_key_id,");
+                                    String[] split = colVal.split(",");
+                                    for (int i = 0; i < split.length; i++) {
+                                        String key = split[i];
+                                        if (key.equals("id")) {
+                                            split[i] = "'" + SnowFlakeUtil.getId() + "' as id";
+                                        } else if (key.equals("p_key_id")) {
+                                            split[i] = "'" + objTab.getPKeyId() + "' as p_key_id";
+                                        }
+                                    }
+                                    colVal = String.join(",", split);
                                     //delete SQL (先删除旧数据,再新增)
                                     String delSql = "delete from " + tableName + " where p_key_id = " + objTab.getPKeyId() + " ; ";
                                     //insert into SQL