Browse Source

fix 数据迁移 导出脚本文件 关系sql格式处理

lvxianyun 2 years ago
parent
commit
1dcea9e03f

+ 12 - 5
adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/service/Impl/ObjectRelationMigration.java

@@ -133,16 +133,23 @@ public class ObjectRelationMigration extends MigrationAbstractServiceImpl<Object
         for (MiGrationRelCode miGrationRelCode: MiGrationRelCode.values()){
             QueryCriteria queryCriteria = getQueryCriteria(miGrationRelCode.getCode());
             queryCriteria.setSize(MigrationConstant.BATCH_SQL_DATA_COUNT);
-            CommonResult<List<ObjectRelation>> admDatas = getAdmDataPage(context,queryCriteria);
-            if (admDatas.getResult().equals(DmpResult.SUCCESS) && admDatas.getCount() > queryCriteria.getSize()) {
-                long pages = admDatas.getCount() / queryCriteria.getSize() + 1;
+            CommonResult<List<ObjectRelation>> result = getAdmDataPage(context,queryCriteria);
+            if(result == null){
+                continue;
+            }
+            List<ObjectRelation> admData = result.getData();
+            if(CollUtil.isEmpty(admData)){
+                continue;
+            }
+            if (result.getCount() > MigrationConstant.BATCH_SQL_DATA_COUNT) {
+                long pages = result.getCount() / queryCriteria.getSize() + 1;
                 for(long i = 2;i < pages; i++){
                     queryCriteria.setPage(i);
-                    List<ObjectRelation> admData = getAdmData(context,queryCriteria);
+                    result = getAdmDataPage(context,queryCriteria);
+                    admData = result.getData();
                     appendValuesBefore(service,admData,futureList);
                 }
             }else{
-                List<ObjectRelation> admData = admDatas.getData();
                 appendValuesBefore(service,admData,futureList);
             }
         }