| | |
| | | public File exportTable(File dir, JSONArray tableInfoArr, Set<String> promptNameSet, Set<String> dictNameSet) { |
| | | DataTableEntity tableDte = getBaseDao().listTable(CoreConst.PRODUCT_SYS_DATAMODEL_TABLE, BaseUtil.buildQuestionMarkFilter("table_name", tableInfoArr.size(), true), tableInfoArr.stream().toArray(), |
| | | new Object[]{}, null, Integer.MAX_VALUE, 1, true); |
| | | return writeString(tableDte, "table_" + getDateTime(), dir); |
| | | return writeString(tableDte, "structure_" + getDateTime(), dir); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | File file = writeString(dte, "data_" + tableName + "_" + getDateTime(), dir); |
| | | fileList.add(file); |
| | | } |
| | | if(fileList.isEmpty()){ |
| | | return null; |
| | | } |
| | | |
| | | //压缩文件 |
| | |
| | | Set<String> attachmentField = new HashSet<>(); |
| | | for (int i = 0; i < fieldDte.getRows(); i++) { |
| | | String fieldType = fieldDte.getString(i, "field_type"); |
| | | if (FieldType.FILE.equals(FieldType.getByDictValue(fieldType))) { |
| | | if (FieldType.FILE.equals(FieldType.getByDictValue(fieldType,false))) { |
| | | attachmentField.add(fieldDte.getString(i, "field_name")); |
| | | } |
| | | } |
| | |
| | | import cn.hutool.core.util.ZipUtil; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.google.common.collect.Lists; |
| | | import com.google.common.collect.Sets; |
| | | import com.product.admin.service.PublicService; |
| | | import com.product.common.utils.StringUtils; |
| | |
| | | */ |
| | | private DataTableEntity readTableStructure(File file) throws Exception { |
| | | DataTableEntity dte = readFileData(file, "product_sys_datamodel_table"); |
| | | List<String> tableNames = Lists.newArrayList("product_sys_datamodel_table", "product_sys_datamodel_field", "product_sys_datamodel_index"); |
| | | dte.getData().sort((a, b) -> { |
| | | // 表名 product_sys_datamodel_table 、product_sys_datamodel_field、product_sys_datamodel_index 排在前 |
| | | |
| | | return tableNames.contains(a.getString("table_name")) ? -1 : 1; |
| | | }); |
| | | DataTableEntity old = getBaseDao().listTable("product_sys_datamodel_table", BaseUtil.buildQuestionMarkFilter("uuid", dte.getUuids().length, true), dte.getUuids(), null, null, Integer.MAX_VALUE, 1, true); |
| | | for (int i = 0; i < dte.getRows(); i++) { |
| | | FieldSetEntity fse = dte.getFieldSetEntity(i); |
| | |
| | | if (CollectionUtil.isEmpty(fieldSetEntity)) { |
| | | //不存在 |
| | | FieldSetEntity clones = oldFse1.clones(); |
| | | //查询该字段是否有索引 |
| | | clones.setValue(CoreConst.SYSTEM_DATA_OPERATE_TYPE, CoreConst.SYSTEM_DATA_OPERATE_DEL); |
| | | sub.addFieldSetEntity(clones); |
| | | } |
| | |
| | | } |
| | | File fileDir = ZipUtil.unzip(file); |
| | | int result = 0; |
| | | if (fileDir == null || !fileDir.isDirectory()) { |
| | | return 0; |
| | | } |
| | | for (File file1 : fileDir.listFiles()) { |
| | | if (!file1.isFile()) { |
| | | continue; |