Browse Source

update

main
wangshaoping 12 months ago
parent
commit
cac8f8677a
  1. 4
      gradle.properties
  2. 4
      io.sc.engine.mv.frontend/package.json
  3. 77
      io.sc.platform.core.frontend/src/platform/components/index.ts
  4. 59
      io.sc.platform.core.frontend/src/platform/components/progress/WProgress.vue
  5. 1
      io.sc.platform.core.frontend/src/platform/i18n/messages.json
  6. 1
      io.sc.platform.core.frontend/src/platform/i18n/messages_tw_CN.json
  7. 1
      io.sc.platform.core.frontend/src/platform/i18n/messages_zh_CN.json
  8. 24
      io.sc.platform.core.frontend/src/platform/index.ts
  9. 1
      io.sc.platform.core.frontend/src/views/FormElements.vue
  10. 21
      io.sc.platform.core/src/main/java/io/sc/platform/core/support/ProgressInfo.java
  11. 4
      io.sc.platform.csv/src/main/java/io/sc/platform/csv/exporter/CsvExporter.java
  12. 4
      io.sc.platform.developer.frontend/package.json
  13. 7
      io.sc.platform.developer.frontend/src/i18n/messages.json
  14. 7
      io.sc.platform.developer.frontend/src/i18n/messages_tw_CN.json
  15. 8
      io.sc.platform.developer.frontend/src/i18n/messages_zh_CN.json
  16. 136
      io.sc.platform.developer.frontend/src/views/backend/ExportLiquibase.vue
  17. 70
      io.sc.platform.developer.frontend/src/views/backend/WProgress.vue
  18. 75
      io.sc.platform.developer.frontend/src/views/backend/WProgressBtn.vue
  19. 4
      io.sc.platform.gradle/templates/pgp/setup/gradle.properties
  20. 70
      io.sc.platform.jdbc.liquibase/src/main/java/io/sc/platform/jdbc/liquibase/exporter/LiquibaseDataCsvExporter.java
  21. 18
      io.sc.platform.jdbc.liquibase/src/main/java/io/sc/platform/jdbc/liquibase/exporter/LiquibaseDataExporter.java
  22. 17
      io.sc.platform.jdbc.liquibase/src/main/java/io/sc/platform/jdbc/liquibase/exporter/LiquibaseSchemaExporter.java
  23. 3
      io.sc.platform.jdbc.liquibase/src/main/java/io/sc/platform/jdbc/liquibase/task/CsvImportTaskChange.java
  24. 43
      io.sc.platform.jdbc/src/main/java/io/sc/platform/jdbc/controller/JdbcExportWebController.java
  25. 17
      io.sc.platform.jdbc/src/main/java/io/sc/platform/jdbc/controller/JdbcMetaDataLoaderWebController.java
  26. 39
      io.sc.platform.jdbc/src/main/java/io/sc/platform/jdbc/controller/support/ExporterThread.java
  27. 4
      io.sc.platform.jdbc/src/main/java/io/sc/platform/jdbc/exporter/DataExporter.java
  28. 5
      io.sc.platform.jdbc/src/main/java/io/sc/platform/jdbc/exporter/exception/ExporterNotRunningException.java
  29. 5
      io.sc.platform.jdbc/src/main/java/io/sc/platform/jdbc/exporter/exception/ExporterRunningException.java
  30. 19
      io.sc.platform.jdbc/src/main/java/io/sc/platform/jdbc/exporter/support/DataExportConfigure.java
  31. 6
      io.sc.platform.jdbc/src/main/java/io/sc/platform/jdbc/exporter/support/ExportMode.java
  32. 17
      io.sc.platform.jdbc/src/main/java/io/sc/platform/jdbc/exporter/support/SchemaExportConfigure.java
  33. 10
      io.sc.platform.jdbc/src/main/java/io/sc/platform/jdbc/service/JdbcExportService.java
  34. 2
      io.sc.platform.jdbc/src/main/java/io/sc/platform/jdbc/service/JdbcMetaDataLoaderService.java
  35. 43
      io.sc.platform.jdbc/src/main/java/io/sc/platform/jdbc/service/impl/JdbcExportServiceImpl.java
  36. 2
      io.sc.platform.jdbc/src/main/java/io/sc/platform/jdbc/service/impl/JdbcMetaDataLoaderServiceImpl.java
  37. 4
      io.sc.platform.lcdp.frontend/package.json
  38. 4
      io.sc.platform.mvc.frontend/package.json
  39. 4
      io.sc.platform.security.frontend/package.json
  40. 4
      io.sc.platform.system.frontend/package.json
  41. 2
      io.sc.platform.system.frontend/src/views/dictionary/Dictionary.vue

4
gradle.properties

@ -36,9 +36,9 @@ application_version=1.0.0
# platform
###########################################################
platform_group=io.sc
platform_version=8.1.24
platform_version=8.1.25
platform_plugin_version=8.1.13
platform_core_frontend_version=8.1.133
platform_core_frontend_version=8.1.136
###########################################################
# dependencies version

4
io.sc.engine.mv.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.engine.mv.frontend",
"version": "8.1.24",
"version": "8.1.25",
"description": "",
"private": false,
"keywords": [
@ -80,7 +80,7 @@
"luckyexcel": "1.0.1",
"mockjs": "1.1.0",
"pinia": "2.1.7",
"platform-core": "8.1.133",
"platform-core": "8.1.136",
"quasar": "2.14.2",
"tailwindcss": "3.4.0",
"vue": "3.4.3",

77
io.sc.platform.core.frontend/src/platform/components/index.ts

@ -1,22 +1,18 @@
import type { App } from 'vue';
import WPlatformPage from './app/WPlatformPage.vue';
import WHScreenDiv from './layout/WHScreenDiv.vue';
import WVExpandDiv from './layout/WVExpandDiv.vue';
import WIconEmpty from './icon/WIconEmpty.vue';
import WTreeGrid from './tree/WTreeGrid.vue';
import WDialog from './dialog/WDialog.vue';
import WDrawer from './drawer/WDrawer.vue';
import WForm from './form/WForm.vue';
import WCodeMirror from './form/elements/WCodeMirror.vue';
import WColorInput from './form/elements/WColorInput.vue';
import WColorInputPalette from './form/elements/WColorInputPalette.vue';
import WCron from './form/elements/WCron.vue';
import WIcon from './form/elements/WIcon.vue';
import WPosition from './form/elements/WPosition.vue';
import WText from './form/elements/WText.vue';
import WNumber from './form/elements/WNumber.vue';
import WTextarea from './form/elements/WTextarea.vue';
@ -27,76 +23,99 @@ import WTextBtn from './form/elements/WTextBtn.vue';
import WPassword from './form/elements/WPassword.vue';
import WOptionGroup from './form/elements/WOptionGroup.vue';
import WGrid from './grid/WGrid.vue';
import WIconEmpty from './icon/WIconEmpty.vue';
import WHScreenDiv from './layout/WHScreenDiv.vue';
import WVExpandDiv from './layout/WVExpandDiv.vue';
import WInfoPanel from './panel/WInfoPanel.vue';
import WGrid from './grid/WGrid.vue';
import WToolbar from './toolbar/WToolbar.vue';
import WProgress from './progress/WProgress.vue';
import WEnableTag from './tag/WEnableTag.vue';
import WSuccessFailedTag from './tag/WSuccessFailedTag.vue';
import WToolbar from './toolbar/WToolbar.vue';
import WTreeGrid from './tree/WTreeGrid.vue';
export default {
install: (app: App) => {
app.component('WPlatformPage', WPlatformPage);
app.component('WIconEmpty', WIconEmpty);
app.component('WHScreenDiv', WHScreenDiv);
app.component('WVExpandDiv', WVExpandDiv);
app.component('WDialog', WDialog);
app.component('WDrawer', WDrawer);
app.component('WForm', WForm);
app.component('WCodeMirror', WCodeMirror);
app.component('WColorInput', WColorInput);
app.component('WColorInputPalette', WColorInputPalette);
app.component('WCron', WCron);
app.component('WIcon', WIcon);
app.component('WPosition', WPosition);
app.component('WCodeMirror', WCodeMirror);
app.component('WSelect', WSelect);
app.component('WTreeGrid', WTreeGrid);
app.component('WDialog', WDialog);
app.component('WDrawer', WDrawer);
app.component('WForm', WForm);
app.component('WText', WText);
app.component('WNumber', WNumber);
app.component('WTextarea', WTextarea);
app.component('WSelect', WSelect);
app.component('WDate', WDate);
app.component('WCheckbox', WCheckbox);
app.component('WTextBtn', WTextBtn);
app.component('WPassword', WPassword);
app.component('WOptionGroup', WOptionGroup);
app.component('WGrid', WGrid);
app.component('WIconEmpty', WIconEmpty);
app.component('WHScreenDiv', WHScreenDiv);
app.component('WVExpandDiv', WVExpandDiv);
app.component('WInfoPanel', WInfoPanel);
app.component('WGrid', WGrid);
app.component('WToolbar', WToolbar);
app.component('WProgress', WProgress);
app.component('WEnableTag', WEnableTag);
app.component('WSuccessFailedTag', WSuccessFailedTag);
app.component('WToolbar', WToolbar);
app.component('WTreeGrid', WTreeGrid);
},
};
export {
WPlatformPage,
WIconEmpty,
WHScreenDiv,
WDialog,
WDrawer,
WForm,
WCodeMirror,
WColorInput,
WColorInputPalette,
WCron,
WIcon,
WPosition,
WCodeMirror,
WSelect,
WTreeGrid,
WDialog,
WDrawer,
WForm,
WText,
WNumber,
WTextarea,
WSelect,
WDate,
WCheckbox,
WTextBtn,
WPassword,
WOptionGroup,
WGrid,
WToolbar,
WIconEmpty,
WHScreenDiv,
WVExpandDiv,
WInfoPanel,
WProgress,
WEnableTag,
WSuccessFailedTag,
WToolbar,
WTreeGrid,
};
export { PlatformIconEnum } from './utils';

59
io.sc.platform.core.frontend/src/platform/components/progress/WProgress.vue

@ -0,0 +1,59 @@
<template>
<div v-if="showRef">
<div class="pl-1 truncate">{{ $t('progress.tip') }} {{ messageRef }}</div>
<q-linear-progress size="20px" :value="percentageRef" color="primary" rounded v-bind="attrs"> </q-linear-progress>
</div>
</template>
<script setup lang="ts">
import { ref, useAttrs, onMounted } from 'vue';
import { axios, Environment } from '@/platform';
const props = defineProps({
dataUrl: { type: String, default: '' },
interval: { type: Number, default: 1000 },
});
const attrs = useAttrs();
const showRef = ref(false);
const percentageRef = ref(0.2);
const messageRef = ref('');
let executeProgressInterval;
const refreshProgress = () => {
axios
.get(Environment.apiContextPath(props.dataUrl))
.then((response) => {
const progressInfo = response.data;
percentageRef.value = progressInfo.currentWeight / progressInfo.totalWeight;
messageRef.value = progressInfo.messageKey;
if (percentageRef.value >= 1) {
clearInterval(executeProgressInterval);
showRef.value = false;
}
})
.catch(() => {
clearInterval(executeProgressInterval);
showRef.value = false;
});
};
const start = () => {
showRef.value = true;
executeProgressInterval = setInterval(refreshProgress, props.interval);
};
onMounted(() => {
axios
.get(Environment.apiContextPath(props.dataUrl))
.then((response) => {
start();
})
.catch(() => {
showRef.value = false;
});
});
defineExpose({
start,
});
</script>

1
io.sc.platform.core.frontend/src/platform/i18n/messages.json

@ -47,6 +47,7 @@
"theme": "Theme",
"upToTop": "Up to Top",
"passwordAndConfirmPasswordMustEqual": "Confrim Password and Password must equals",
"progress.tip": "Running: ",
"cron.second.per": "Per Second",
"cron.second.period.1": "From",

1
io.sc.platform.core.frontend/src/platform/i18n/messages_tw_CN.json

@ -47,6 +47,7 @@
"theme": "主題",
"upToTop": "回到頂部",
"passwordAndConfirmPasswordMustEqual": "確認密碼和密碼必須一致",
"progress.tip": "正在執行: ",
"cron.second.per": "每秒",
"cron.second.period.1": "從",

1
io.sc.platform.core.frontend/src/platform/i18n/messages_zh_CN.json

@ -47,6 +47,7 @@
"theme": "主题",
"upToTop": "回到顶部",
"passwordAndConfirmPasswordMustEqual": "确认密码和密码必须一致",
"progress.tip": "正在执行: ",
"cron.second.per": "每秒",
"cron.second.period.1": "从",

24
io.sc.platform.core.frontend/src/platform/index.ts

@ -111,18 +111,34 @@ export { Options } from './components-ext';
*/
export {
WPlatformPage,
WIconEmpty,
WHScreenDiv,
WDialog,
WDrawer,
WForm,
WCodeMirror,
WColorInput,
WColorInputPalette,
WCron,
WIcon,
WPosition,
WCodeMirror,
WText,
WNumber,
WTextarea,
WSelect,
WDate,
WCheckbox,
WTextBtn,
WPassword,
WOptionGroup,
WGrid,
WTreeGrid,
WIconEmpty,
WHScreenDiv,
WVExpandDiv,
WInfoPanel,
WProgress,
WEnableTag,
WSuccessFailedTag,
WToolbar,
WTreeGrid,
} from './components';
export { PlatformIconEnum } from './components';

1
io.sc.platform.core.frontend/src/views/FormElements.vue

@ -39,6 +39,7 @@
<w-code-mirror v-model="valueRef" label="please input SQL:" lang="sql" outlined dense></w-code-mirror>
<q-input v-model="valueRef" label="please input number 2:" outlined dense clearable></q-input>
<w-icon v-model="iconValueRef" label="please select icon:" lang="sql" outlined dense></w-icon>
<w-progress data-url="/api/jdbc/export/traceExecuteProgress"></w-progress>
</q-tab-panel>
</q-tab-panels>
</template>

21
io.sc.platform.core/src/main/java/io/sc/platform/core/support/ProgressInfo.java

@ -7,6 +7,7 @@ import java.util.concurrent.atomic.AtomicInteger;
* 进度信息
*/
public class ProgressInfo {
private boolean running;
//开始时间
private Date startDatetime;
//完成时间
@ -21,9 +22,16 @@ public class ProgressInfo {
private String errorMessage;
private String errorStackTrace;
public static ProgressInfo notRunning(){
ProgressInfo progressInfo =new ProgressInfo();
progressInfo.setRunning(false);
return progressInfo;
}
public ProgressInfo(){}
public ProgressInfo(int totalWeight,int currentWeight){
System.out.println(">>>>>>>>>>>>>>>>>");
this.totalWeight =new AtomicInteger(totalWeight);
this.currentWeight =new AtomicInteger(currentWeight);
}
@ -59,6 +67,16 @@ public class ProgressInfo {
this.currentWeight =this.totalWeight;
}
public boolean getRunning() {
return running;
}
public void setRunning(boolean running) {
this.running = running;
}
public Date getStartDatetime() {
return startDatetime;
}
@ -118,7 +136,8 @@ public class ProgressInfo {
@Override
public String toString() {
return "ProgressInfo{" +
"startDatetime=" + startDatetime +
"isRunning=" + running +
", startDatetime=" + startDatetime +
", completedDatetime=" + completedDatetime +
", totalWeight=" + totalWeight +
", currentWeight=" + currentWeight +

4
io.sc.platform.csv/src/main/java/io/sc/platform/csv/exporter/CsvExporter.java

@ -1,13 +1,15 @@
package io.sc.platform.csv.exporter;
import io.sc.platform.core.support.ProgressInfo;
import io.sc.platform.jdbc.exporter.DataExporter;
import io.sc.platform.jdbc.exporter.support.DataExportConfigure;
import javax.sql.DataSource;
import java.util.Locale;
public class CsvExporter implements DataExporter {
@Override
public void export(DataSource dataSource, DataExportConfigure configure) {
public void export(DataSource dataSource, DataExportConfigure configure, ProgressInfo progressInfo, Locale locale) {
}
}

4
io.sc.platform.developer.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.platform.developer.frontend",
"version": "8.1.24",
"version": "8.1.25",
"description": "",
"private": false,
"keywords": [
@ -80,7 +80,7 @@
"luckyexcel": "1.0.1",
"mockjs": "1.1.0",
"pinia": "2.1.7",
"platform-core": "8.1.133",
"platform-core": "8.1.136",
"quasar": "2.14.2",
"tailwindcss": "3.4.0",
"vue": "3.4.3",

7
io.sc.platform.developer.frontend/src/i18n/messages.json

@ -30,6 +30,11 @@
"menu.developer.backend.export.liquibase" : "Data Export(liquibase)",
"menu.developer.frontend" : "Front End Tools",
"menu.developer.frontend.icons" : "Icons"
"menu.developer.frontend.icons" : "Icons",
"developer.backend.export.liquibase.datasource" : "Datasource",
"developer.backend.export.liquibase.schema" : "Schema",
"developer.backend.export.liquibase.tables" : "Tables",
"developer.backend.export.liquibase.export.tip" : "Are you sure to export?"
}

7
io.sc.platform.developer.frontend/src/i18n/messages_tw_CN.json

@ -30,6 +30,11 @@
"menu.developer.backend.export.liquibase" : "數據導出(liquibase)",
"menu.developer.frontend" : "前端工具",
"menu.developer.frontend.icons" : "圖標庫"
"menu.developer.frontend.icons" : "圖標庫",
"developer.backend.export.liquibase.datasource" : "數據源",
"developer.backend.export.liquibase.schema" : "方案",
"developer.backend.export.liquibase.tables" : "表",
"developer.backend.export.liquibase.export.tip" : "您確定要導出嗎?"
}

8
io.sc.platform.developer.frontend/src/i18n/messages_zh_CN.json

@ -30,5 +30,11 @@
"menu.developer.backend.export.liquibase" : "数据导出(liquibase)",
"menu.developer.frontend" : "前端工具",
"menu.developer.frontend.icons" : "图标库"
"menu.developer.frontend.icons" : "图标库",
"developer.backend.export.liquibase.datasource" : "数据源",
"developer.backend.export.liquibase.schema" : "方案",
"developer.backend.export.liquibase.tables" : "表",
"developer.backend.export.liquibase.export.tip" : "您确定要导出吗?"
}

136
io.sc.platform.developer.frontend/src/views/backend/ExportLiquibase.vue

@ -4,61 +4,78 @@
ref="formRef"
:fields="[
{
name: 'datasourceName',
label: 'datasourceName',
name: 'datasource',
label: $t('developer.backend.export.liquibase.datasource'),
type: 'select',
clearable: true,
options: datasourceOptionsRef,
'onUpdate:modelValue': (value) => {
datasourceNameChanged(value);
datasourceChanged(value);
},
},
{
name: 'schemaName',
label: 'schemaName',
name: 'schema',
label: $t('developer.backend.export.liquibase.schema'),
type: 'select',
options: schemaNameOptionsRef,
options: schemaOptionsRef,
'onUpdate:modelValue': (value) => {
schemaNameChanged(formRef.getFieldValue('datasourceName'), value);
schemaChanged(formRef.getFieldValue('datasource'), value);
},
required: true,
},
{ name: 'tableName', label: 'tableName', type: 'select', multiple: true, options: tableNameOptionsRef },
{ name: 'fetchSize', label: 'fetchSize', type: 'number', defaultValue: 1000 },
{ name: 'sql', label: 'sql', type: 'code-mirror', colSpan: 4, rows: 5, lang: 'sql' },
]"
>
</w-form>
<w-grid
ref="gridRef"
:title="$t('queryResult')"
:config-button="false"
selection="multiple"
:checkbox-selection="false"
:data-url="Environment.apiContextPath('/api/system/datasource')"
:query-form-fields="[]"
:toolbar-configure="{ noIcon: false }"
:toolbar-actions="[
'query',
'refresh',
{
name: 'export',
label: $t('export'),
icon: '',
click: () => {},
name: 'tables',
label: $t('developer.backend.export.liquibase.tables'),
type: 'select',
multiple: true,
options: tablesOptionsRef,
'onUpdate:modelValue': (value) => {
if (value) {
if (value.length > 1) {
formRef.setFieldValue('sql', 'select * from ${table}');
} else {
formRef.setFieldValue('sql', 'select * from ' + value);
}
}
},
required: true,
},
{ name: 'fetchSize', label: 'Fetch Size', type: 'number', defaultValue: 1000 },
{
name: 'sql',
label: 'SQL',
type: 'code-mirror',
colSpan: 4,
rows: 5,
lang: 'sql',
},
]"
:columns="[]"
>
</w-grid>
</w-form>
<div class="row justify-center q-gutter-md py-2">
<WProgressBtn
ref="progressBtnRef"
icon="bi-database-down"
:label="$t('export')"
data-url="/api/jdbc/export/traceExecuteProgress"
@click="exportData"
></WProgressBtn>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, onUpdated } from 'vue';
import { axios, Environment, EnumTools, Formater, Options, DialogManager, NotifyManager } from 'platform-core';
import { ref, reactive, toRaw, onMounted, onUpdated } from 'vue';
import { useI18n } from 'vue-i18n';
import { axios, Environment, EnumTools, Formater, Options, DialogManager, NotifyManager, Tools } from 'platform-core';
import WProgressBtn from './WProgressBtn.vue';
const { t } = useI18n();
const formRef = ref();
const progressBtnRef = ref();
const datasourceOptionsRef = ref([]);
const schemaNameOptionsRef = ref([]);
const tableNameOptionsRef = ref([]);
const schemaOptionsRef = ref([]);
const tablesOptionsRef = ref([]);
const loadDatasource = () => {
axios.get(Environment.apiContextPath('/api/system/datasource?pageable=false&sortBy=name')).then((response) => {
@ -72,31 +89,64 @@ const loadDatasource = () => {
});
};
const datasourceNameChanged = (datasourceName: string) => {
axios.get(Environment.apiContextPath('/api/jdbc/metadata/getSchemaNames/' + datasourceName)).then((response) => {
const datasourceChanged = (datasource: string) => {
datasource = datasource || '';
axios.get(Environment.apiContextPath('/api/jdbc/metadata/getSchemas?datasource=' + datasource)).then((response) => {
const data = response?.data;
if (data && data.length > 0) {
schemaNameOptionsRef.value.splice(0, schemaNameOptionsRef.value.length);
schemaOptionsRef.value.splice(0, schemaOptionsRef.value.length);
tablesOptionsRef.value.splice(0, tablesOptionsRef.value.length);
for (let item of data) {
schemaNameOptionsRef.value.push({ label: item.name, value: item.name });
schemaOptionsRef.value.push({ label: item.name, value: item.name });
}
}
});
};
const schemaNameChanged = (datasourceName: string, schemaName: string) => {
axios.get(Environment.apiContextPath('/api/jdbc/metadata/getTables/' + datasourceName + '/' + schemaName)).then((response) => {
const schemaChanged = (datasource: string, schema: string) => {
datasource = datasource || '';
schema = schema || '';
axios.get(Environment.apiContextPath('/api/jdbc/metadata/getTables?datasource=' + datasource + '&schema=' + schema)).then((response) => {
const data = response?.data;
if (data && data.length > 0) {
tableNameOptionsRef.value.splice(0, tableNameOptionsRef.value.length);
tablesOptionsRef.value.splice(0, tablesOptionsRef.value.length);
for (let item of data) {
tableNameOptionsRef.value.push(item.name);
tablesOptionsRef.value.push({ label: item.name, value: item.name });
}
}
});
};
const exportData = (e) => {
console.log(e);
formRef.value.validate().then((value) => {
if (value) {
DialogManager.confirm(t('developer.backend.export.liquibase.export.tip'), () => {
const data = formRef.value.getData();
const config = {
datasource: data.datasource,
schema: data.schema,
tables: [],
};
const length = data.tables.length;
const sql = length === 1 ? formRef.value.getFieldValue('sql') : '';
for (let i = 0; i < length; i++) {
config.tables[i] = { name: data.tables[i], sql: sql ? sql : 'select * from ' + data.tables[i] };
}
config.datasource = axios.post(Environment.apiContextPath('/api/jdbc/export/export'), config).then((response) => {
progressBtnRef.value.start();
});
});
}
});
};
onMounted(() => {
loadDatasource();
datasourceChanged('');
});
onUpdated(() => {
loadDatasource();
});
</script>

70
io.sc.platform.developer.frontend/src/views/backend/WProgress.vue

@ -0,0 +1,70 @@
<template>
<div v-if="showRef">
<div class="pl-1 truncate">{{ $t('progress.tip') }} {{ messageRef }}</div>
<q-linear-progress size="20px" :value="percentageRef" color="primary" rounded v-bind="attrs"> </q-linear-progress>
</div>
</template>
<script setup lang="ts">
import { ref, useAttrs, onMounted } from 'vue';
import { axios, Environment } from 'platform-core';
const props = defineProps({
dataUrl: { type: String, default: '' },
interval: { type: Number, default: 1000 },
});
const attrs = useAttrs();
const showRef = ref(false);
const percentageRef = ref(0);
const messageRef = ref('');
let executeProgressInterval;
const refreshProgress = () => {
axios
.get(Environment.apiContextPath(props.dataUrl))
.then((response) => {
if (response?.data?.running) {
const progressInfo = response.data;
percentageRef.value = progressInfo.currentWeight / progressInfo.totalWeight;
messageRef.value = progressInfo.messageKey;
if (percentageRef.value >= 1) {
stop();
}
} else {
stop();
}
})
.catch(() => {
stop();
});
};
const start = () => {
showRef.value = true;
percentageRef.value = 0;
executeProgressInterval = setInterval(refreshProgress, props.interval);
};
const stop = () => {
clearInterval(executeProgressInterval);
showRef.value = false;
};
onMounted(() => {
axios
.get(Environment.apiContextPath(props.dataUrl))
.then((response) => {
if (response?.data?.running) {
start();
}
})
.catch(() => {
stop();
});
});
defineExpose({
start,
stop,
});
</script>

75
io.sc.platform.developer.frontend/src/views/backend/WProgressBtn.vue

@ -0,0 +1,75 @@
<template>
<q-btn icon="bi-database-down" :label="$t('export')" outline no-caps v-bind="attrs" :loading="showRef" :percentage="percentageRef">
<!-- <template #loading>
<div class="justify-between">
<q-icon :name="attrs.icon"></q-icon>
<span>正在执行...</span>
<q-btn v-if="showRef" icon="bi-info" title="show detail" dense rounded flat @click.stop.prevent="() => {}"></q-btn>
</div>
</template> -->
</q-btn>
</template>
<script setup lang="ts">
import { ref, useAttrs, onMounted } from 'vue';
import { axios, Environment } from 'platform-core';
const props = defineProps({
dataUrl: { type: String, default: '' },
interval: { type: Number, default: 1000 },
});
const attrs = useAttrs();
const showRef = ref(false);
const percentageRef = ref(0);
const messageRef = ref('');
let executeProgressInterval;
const refreshProgress = () => {
axios
.get(Environment.apiContextPath(props.dataUrl))
.then((response) => {
if (response?.data?.running) {
const progressInfo = response.data;
percentageRef.value = (progressInfo.currentWeight / progressInfo.totalWeight) * 100;
messageRef.value = progressInfo.messageKey;
if (percentageRef.value >= 100) {
stop();
}
} else {
stop();
}
})
.catch(() => {
stop();
});
};
const start = () => {
showRef.value = true;
percentageRef.value = 0;
executeProgressInterval = setInterval(refreshProgress, props.interval);
};
const stop = () => {
clearInterval(executeProgressInterval);
showRef.value = false;
};
onMounted(() => {
axios
.get(Environment.apiContextPath(props.dataUrl))
.then((response) => {
if (response?.data?.running) {
start();
}
})
.catch(() => {
stop();
});
});
defineExpose({
start,
stop,
});
</script>

4
io.sc.platform.gradle/templates/pgp/setup/gradle.properties

@ -36,9 +36,9 @@ application_version=1.0.0
# platform
###########################################################
platform_group=io.sc
platform_version=8.1.24
platform_version=8.1.25
platform_plugin_version=8.1.13
platform_core_frontend_version=8.1.119
platform_core_frontend_version=8.1.136
###########################################################
# dependencies version

70
io.sc.platform.jdbc.liquibase/src/main/java/io/sc/platform/jdbc/liquibase/exporter/LiquibaseDataCsvExporter.java

@ -1,5 +1,7 @@
package io.sc.platform.jdbc.liquibase.exporter;
import io.sc.platform.core.DirectoryManager;
import io.sc.platform.core.support.ProgressInfo;
import io.sc.platform.core.util.WriterUtil;
import io.sc.platform.jdbc.exporter.DataExporter;
import io.sc.platform.jdbc.exporter.support.DataExportConfigure;
@ -24,82 +26,68 @@ import java.sql.*;
import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
import java.util.Locale;
public class LiquibaseDataCsvExporter implements DataExporter {
private static final Logger log = LoggerFactory.getLogger(LiquibaseDataCsvExporter.class);
private static final String OUTPUT_PATH = DirectoryManager.getInstance().getByName("dir.work.web.export");
@Override
public void export(DataSource dataSource, DataExportConfigure configure) {
try {
switch (configure.getExportMode()) {
case SINGLE_FILE:
exportMultiFile(dataSource, configure);
break;
case MULTI_FILE:
exportMultiFile(dataSource, configure);
break;
}
}catch (Exception e){
throw new RuntimeException(e);
}
}
private void exportSingleFile(DataSource dataSource, DataExportConfigure configure) {
}
private void exportMultiFile(DataSource dataSource, DataExportConfigure configure) throws IOException, MetaDataAccessException {
public void export(DataSource dataSource, DataExportConfigure configure, ProgressInfo progressInfo, Locale locale) throws Exception{
progressInfo.setTotalWeight(configure.getTables().length);
String[] tableNames =ExportTable.getTableNames(configure.getTables());
List<Table> tables =MetaDataLoader.newInstance().getTables(dataSource,configure.getSchema(),tableNames);
for(Table table : tables){
BufferedWriter writer = WriterUtil.bufferedWriter(configure.getOutputPath() + File.separator + "data." + configure.getSchema() + "." + table.getName() + ".csv");
ICSVWriter csvWriter = new CSVWriterBuilder(writer)
.withSeparator(',')
.withQuoteChar(ICSVWriter.NO_QUOTE_CHARACTER)
.build();
writeTable(dataSource,table,csvWriter);
progressInfo.setMessageKey(table.getName());
new File(OUTPUT_PATH + "/" + configure.getSchema()).mkdirs();
BufferedWriter writer = WriterUtil.bufferedWriter(OUTPUT_PATH + "/" + configure.getSchema() + "/" + table.getName() + ".csv");
ICSVWriter csvWriter = new CSVWriterBuilder(writer).build();
writeTable(dataSource,table,csvWriter,configure,progressInfo,locale);
csvWriter.flush();
csvWriter.close();
progressInfo.addWeight(1);
Thread.sleep(5000);
}
}
private void writeTable(DataSource dataSource,Table table,ICSVWriter writer) {
private void writeTable(DataSource dataSource,Table table,ICSVWriter writer,DataExportConfigure configure,ProgressInfo progressInfo, Locale locale) {
//写入字段定义信息===============================================================================
List<Column> columns =table.getColumns();
if(columns==null || columns.size()==0){
throw new RuntimeException("No column found");
}
String[] names =new String[columns.size()];
String[] types =new String[columns.size()];
String[] javaTypes =new String[columns.size()];
String[] sqlTypes =new String[columns.size()];
String[] remarks =new String[columns.size()];
for(int i=0;i<columns.size();i++){
Column column =columns.get(i);
names[i] =column.getName();
types[i] =column.getJavaType().getName();
javaTypes[i] =column.getJavaType().getName();
sqlTypes[i] =column.getSqlType();
remarks[i] =column.getRemarks();
}
writer.writeNext(names);
//writer.writeNext(types);
//writer.writeNext(remarks);
writer.writeNext(remarks);
writer.writeNext(sqlTypes);
writer.writeNext(javaTypes);
//写入记录集信息==================================================================================
writeResultSet(dataSource,table,writer);
writeResultSet(dataSource,table,writer,configure,progressInfo,locale);
}
private void writeResultSet(DataSource dataSource,Table table,ICSVWriter writer) {
private void writeResultSet(DataSource dataSource,Table table,ICSVWriter writer,DataExportConfigure configure,ProgressInfo progressInfo, Locale locale) {
try(
Connection connection = DataSourceUtils.getConnection(dataSource);
Statement statement =connection.createStatement(ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_ONLY);
){
statement.setFetchSize(1000);
statement.setFetchSize(configure.getFetchSize());
try(ResultSet rs =statement.executeQuery("select * from " + table.getName());){
if(table.isSelfReference()){
log.info("export table [" + table.getName() + "] with parent-and-children relationship: " + table.getSelfReferenceForeignKeyColumnName() + " --> " + table.getSelfReferencePrimaryKeyColumnName());
exportResultSetWithSelfReference(rs,table,writer);
exportResultSetWithSelfReference(rs,table,writer,configure,progressInfo,locale);
}else{
log.info("export table [" + table.getName() + "]");
exportResultSet(rs,table,writer);
exportResultSet(rs,table,writer,configure,progressInfo,locale);
}
}catch (Exception e){
throw new RuntimeException(e);
@ -109,7 +97,7 @@ public class LiquibaseDataCsvExporter implements DataExporter {
}
}
private void exportResultSetWithSelfReference(ResultSet rs,Table table,ICSVWriter writer) throws SQLException, IOException {
private void exportResultSetWithSelfReference(ResultSet rs,Table table,ICSVWriter writer,DataExportConfigure configure,ProgressInfo progressInfo, Locale locale) throws SQLException, IOException {
String pkFieldName =table.getSelfReferencePrimaryKeyColumnName();
String fkFieldName =table.getSelfReferenceForeignKeyColumnName();
List<Column> columns =table.getColumns();
@ -154,7 +142,7 @@ public class LiquibaseDataCsvExporter implements DataExporter {
}
}
}else{
fieldValue =Base64.getEncoder().encodeToString(rs.getString(fieldName).getBytes());
fieldValue =rs.getString(fieldName);
}
record.addField(fieldName, fieldValue);
}
@ -165,7 +153,7 @@ public class LiquibaseDataCsvExporter implements DataExporter {
return null;
}
private void exportResultSet(ResultSet rs,Table table,ICSVWriter writer) throws SQLException, IOException {
private void exportResultSet(ResultSet rs,Table table,ICSVWriter writer,DataExportConfigure configure,ProgressInfo progressInfo, Locale locale) throws SQLException, IOException {
long count =1;
List<Column> columns =table.getColumns();
while(rs.next()){

18
io.sc.platform.jdbc.liquibase/src/main/java/io/sc/platform/jdbc/liquibase/exporter/LiquibaseDataExporter.java

@ -1,6 +1,8 @@
package io.sc.platform.jdbc.liquibase.exporter;
import io.sc.platform.core.DirectoryManager;
import io.sc.platform.core.Environment;
import io.sc.platform.core.support.ProgressInfo;
import io.sc.platform.core.util.StringUtil;
import io.sc.platform.core.util.WriterUtil;
import io.sc.platform.jdbc.exporter.DataExporter;
@ -26,28 +28,24 @@ import java.io.UnsupportedEncodingException;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
public class LiquibaseDataExporter implements DataExporter {
private static final Logger log = LoggerFactory.getLogger(LiquibaseDataExporter.class);
private static final String OUTPUT_PATH = DirectoryManager.getInstance().getByName("");
@Override
public void export(DataSource dataSource, DataExportConfigure configure) {
public void export(DataSource dataSource, DataExportConfigure configure, ProgressInfo progressInfo, Locale locale) {
try {
switch (configure.getExportMode()) {
case SINGLE_FILE:
exportSingleFile(dataSource, configure);
break;
case MULTI_FILE:
exportMultiFile(dataSource, configure);
break;
}
// exportMultiFile(dataSource, configure);
}catch (Exception e){
throw new RuntimeException(e);
}
}
private void exportSingleFile(DataSource dataSource, DataExportConfigure configure) throws XMLStreamException, FileNotFoundException, UnsupportedEncodingException, MetaDataAccessException {
XMLStreamWriter writer = WriterUtil.xmlStreamWriter(configure.getOutputPath() + File.separator + "data." + configure.getSchema() + ".xml");
XMLStreamWriter writer = WriterUtil.xmlStreamWriter(OUTPUT_PATH + File.separator + "data." + configure.getSchema() + ".xml");
writeHeader(writer);
String[] tableNames =ExportTable.getTableNames(configure.getTables());
List<Table> tables =MetaDataLoader.newInstance().getTables(dataSource,configure.getSchema(),tableNames);
@ -63,7 +61,7 @@ public class LiquibaseDataExporter implements DataExporter {
String[] tableNames =ExportTable.getTableNames(configure.getTables());
List<Table> tables =MetaDataLoader.newInstance().getTables(dataSource,configure.getSchema(),tableNames);
for(Table table : tables){
XMLStreamWriter writer = WriterUtil.xmlStreamWriter(configure.getOutputPath() + File.separator + "data." + configure.getSchema() + "." + table.getName() + ".xml");
XMLStreamWriter writer = WriterUtil.xmlStreamWriter(OUTPUT_PATH + File.separator + "data." + configure.getSchema() + "." + table.getName() + ".xml");
writeHeader(writer);
writeTable(dataSource,table,writer);
writeTail(writer);

17
io.sc.platform.jdbc.liquibase/src/main/java/io/sc/platform/jdbc/liquibase/exporter/LiquibaseSchemaExporter.java

@ -1,5 +1,6 @@
package io.sc.platform.jdbc.liquibase.exporter;
import io.sc.platform.core.DirectoryManager;
import io.sc.platform.core.Environment;
import io.sc.platform.core.util.WriterUtil;
import io.sc.platform.jdbc.exporter.SchemaExporter;
@ -19,26 +20,20 @@ import java.io.UnsupportedEncodingException;
import java.util.List;
public class LiquibaseSchemaExporter implements SchemaExporter {
private static final String OUTPUT_PATH = DirectoryManager.getInstance().getByName("");
@Override
public void export(DataSource dataSource, SchemaExportConfigure configure) {
try {
switch (configure.getExportMode()) {
case SINGLE_FILE:
exportSingleFile(dataSource, configure);
break;
case MULTI_FILE:
exportMultiFile(dataSource, configure);
break;
default:
break;
}
//exportMultiFile(dataSource, configure);
}catch (Exception e){
throw new RuntimeException(e);
}
}
private void exportSingleFile(DataSource dataSource, SchemaExportConfigure configure) throws XMLStreamException, FileNotFoundException, UnsupportedEncodingException, MetaDataAccessException {
XMLStreamWriter writer = WriterUtil.xmlStreamWriter(configure.getOutputPath() + File.separator + "schema." + configure.getSchema() + ".xml");
XMLStreamWriter writer = WriterUtil.xmlStreamWriter(OUTPUT_PATH + File.separator + "schema." + configure.getSchema() + ".xml");
writeHeader(writer,configure.getSchema());
List<Table> tables =MetaDataLoader.newInstance().getTables(dataSource,configure.getSchema(),configure.getTables());
for(Table table : tables){
@ -52,7 +47,7 @@ public class LiquibaseSchemaExporter implements SchemaExporter {
private void exportMultiFile(DataSource dataSource, SchemaExportConfigure configure) throws MetaDataAccessException, XMLStreamException, FileNotFoundException, UnsupportedEncodingException {
List<Table> tables =MetaDataLoader.newInstance().getTables(dataSource,configure.getSchema(),configure.getTables());
for(Table table : tables){
XMLStreamWriter writer = WriterUtil.xmlStreamWriter(configure.getOutputPath() + File.separator + "schema." + configure.getSchema() + "." + table.getName() + ".xml");
XMLStreamWriter writer = WriterUtil.xmlStreamWriter(OUTPUT_PATH + File.separator + "schema." + configure.getSchema() + "." + table.getName() + ".xml");
writeHeader(writer,configure.getSchema() + "." + table.getName());
writeTable(table,writer);
writeTail(writer);

3
io.sc.platform.jdbc.liquibase/src/main/java/io/sc/platform/jdbc/liquibase/task/CsvTaskChange.java → io.sc.platform.jdbc.liquibase/src/main/java/io/sc/platform/jdbc/liquibase/task/CsvImportTaskChange.java

@ -5,10 +5,9 @@ import liquibase.database.Database;
import liquibase.exception.CustomChangeException;
import liquibase.exception.SetupException;
import liquibase.exception.ValidationErrors;
import liquibase.repackaged.com.opencsv.CSVReaderBuilder;
import liquibase.resource.ResourceAccessor;
public class CsvTaskChange implements CustomTaskChange {
public class CsvImportTaskChange implements CustomTaskChange {
private String dataFileLocation;
private String cfgFileLocation;

43
io.sc.platform.jdbc/src/main/java/io/sc/platform/jdbc/controller/JdbcExportWebController.java

@ -0,0 +1,43 @@
package io.sc.platform.jdbc.controller;
import io.sc.platform.core.support.ProgressInfo;
import io.sc.platform.jdbc.controller.support.ExporterThread;
import io.sc.platform.jdbc.exporter.exception.ExporterNotRunningException;
import io.sc.platform.jdbc.exporter.exception.ExporterRunningException;
import io.sc.platform.jdbc.exporter.support.DataExportConfigure;
import io.sc.platform.jdbc.service.JdbcExportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.Locale;
@RestController
@RequestMapping("/api/jdbc/export")
public class JdbcExportWebController {
@Autowired private JdbcExportService jdbcExportService;
private ExporterThread thread =null;
@PostMapping("export")
public void export(@RequestBody DataExportConfigure configure, Locale locale) throws Exception {
//检查有当前用户启动的执行线程是否正在运行
if(thread!=null && thread.isAlive()){
throw new ExporterRunningException();
}
//启动新线程
thread =new ExporterThread(jdbcExportService,configure,locale);
thread.start();
}
@GetMapping("traceExecuteProgress")
public ProgressInfo traceExecuteProgress(Locale locale) throws Exception{
if(thread!=null && thread.isAlive()){
if(thread.getException()!=null){
throw thread.getException();
}
return thread.getProgressInfo();
}else{
return ProgressInfo.notRunning();
}
}
}

17
io.sc.platform.jdbc/src/main/java/io/sc/platform/jdbc/controller/JdbcMetaDataLoaderWebController.java

@ -5,10 +5,7 @@ import io.sc.platform.jdbc.meta.support.Table;
import io.sc.platform.jdbc.meta.support.TableSummary;
import io.sc.platform.jdbc.service.JdbcMetaDataLoaderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -17,13 +14,13 @@ import java.util.List;
public class JdbcMetaDataLoaderWebController {
@Autowired private JdbcMetaDataLoaderService jdbcMetaDataLoaderService;
@GetMapping("getSchemaNames/{datasourceName}")
public List<Schema> getSchemaNames(@PathVariable(name="datasourceName")String datasourceName) throws Exception {
return jdbcMetaDataLoaderService.getSchemaNames(datasourceName);
@GetMapping("getSchemas")
public List<Schema> getSchemaNames(@RequestParam(name="datasource",required = false)String datasource) throws Exception {
return jdbcMetaDataLoaderService.getSchemas(datasource);
}
@GetMapping("getTables/{datasourceName}/{schemaName}")
public List<Table> getTables(@PathVariable(name="datasourceName")String datasourceName, @PathVariable(name="schemaName")String schemaName) throws Exception {
return jdbcMetaDataLoaderService.getTables(datasourceName,schemaName);
@GetMapping("getTables")
public List<Table> getTables(@RequestParam(name="datasource",required = false)String datasource, @RequestParam(name="schema")String schema) throws Exception {
return jdbcMetaDataLoaderService.getTables(datasource,schema);
}
}

39
io.sc.platform.jdbc/src/main/java/io/sc/platform/jdbc/controller/support/ExporterThread.java

@ -0,0 +1,39 @@
package io.sc.platform.jdbc.controller.support;
import io.sc.platform.core.support.ProgressInfo;
import io.sc.platform.jdbc.exporter.support.DataExportConfigure;
import io.sc.platform.jdbc.service.JdbcExportService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Locale;
public class ExporterThread extends Thread {
private Logger log = LoggerFactory.getLogger(ExporterThread.class);
private JdbcExportService jdbcExportService;
private DataExportConfigure exportConfigure;
private Locale locale;
private volatile ProgressInfo progressInfo =new ProgressInfo(100,0);
private Exception exception;
public ExporterThread(JdbcExportService jdbcExportService,DataExportConfigure exportConfigure, Locale locale){
this.jdbcExportService =jdbcExportService;
this.exportConfigure =exportConfigure;
this.locale =locale;
}
@Override
public void run() {
try {
jdbcExportService.export(exportConfigure,progressInfo,locale);
} catch (Exception e) {
this.exception =e;
log.error("",e);
}
}
public ProgressInfo getProgressInfo(){
return progressInfo;
}
public Exception getException() {
return exception;
}
}

4
io.sc.platform.jdbc/src/main/java/io/sc/platform/jdbc/exporter/DataExporter.java

@ -1,13 +1,15 @@
package io.sc.platform.jdbc.exporter;
import io.sc.platform.core.support.ProgressInfo;
import io.sc.platform.jdbc.exporter.support.DataExportConfigure;
import javax.sql.DataSource;
import java.util.Iterator;
import java.util.Locale;
import java.util.ServiceLoader;
public interface DataExporter {
public void export(DataSource dataSource, DataExportConfigure configure);
public void export(DataSource dataSource, DataExportConfigure configure, ProgressInfo progressInfo, Locale locale) throws Exception;
public static DataExporter newInstance(){
ServiceLoader<DataExporter> serviceLoader =ServiceLoader.load(DataExporter.class);

5
io.sc.platform.jdbc/src/main/java/io/sc/platform/jdbc/exporter/exception/ExporterNotRunningException.java

@ -0,0 +1,5 @@
package io.sc.platform.jdbc.exporter.exception;
public class ExporterNotRunningException extends RuntimeException {
}

5
io.sc.platform.jdbc/src/main/java/io/sc/platform/jdbc/exporter/exception/ExporterRunningException.java

@ -0,0 +1,5 @@
package io.sc.platform.jdbc.exporter.exception;
public class ExporterRunningException extends RuntimeException {
}

19
io.sc.platform.jdbc/src/main/java/io/sc/platform/jdbc/exporter/support/DataExportConfigure.java

@ -4,8 +4,7 @@ public class DataExportConfigure {
private String datasource;
private String schema;
private ExportTable[] tables;
private String outputPath;
private ExportMode exportMode =ExportMode.SINGLE_FILE;
private int fetchSize =1000;
public String getDatasource() {
return datasource;
@ -31,19 +30,11 @@ public class DataExportConfigure {
this.tables = tables;
}
public String getOutputPath() {
return outputPath;
public int getFetchSize() {
return fetchSize;
}
public void setOutputPath(String outputPath) {
this.outputPath = outputPath;
}
public ExportMode getExportMode() {
return exportMode;
}
public void setExportMode(ExportMode exportMode) {
this.exportMode = exportMode;
public void setFetchSize(int fetchSize) {
this.fetchSize = fetchSize;
}
}

6
io.sc.platform.jdbc/src/main/java/io/sc/platform/jdbc/exporter/support/ExportMode.java

@ -1,6 +0,0 @@
package io.sc.platform.jdbc.exporter.support;
public enum ExportMode {
SINGLE_FILE, // 单文件
MULTI_FILE; // 多文件(每个表一个文件)
}

17
io.sc.platform.jdbc/src/main/java/io/sc/platform/jdbc/exporter/support/SchemaExportConfigure.java

@ -4,8 +4,6 @@ public class SchemaExportConfigure {
private String datasource;
private String schema;
private String[] tables;
private String outputPath;
private ExportMode exportMode =ExportMode.SINGLE_FILE;
public String getDatasource() {
return datasource;
@ -31,19 +29,4 @@ public class SchemaExportConfigure {
this.tables = tables;
}
public String getOutputPath() {
return outputPath;
}
public void setOutputPath(String outputPath) {
this.outputPath = outputPath;
}
public ExportMode getExportMode() {
return exportMode;
}
public void setExportMode(ExportMode exportMode) {
this.exportMode = exportMode;
}
}

10
io.sc.platform.jdbc/src/main/java/io/sc/platform/jdbc/service/JdbcExportService.java

@ -0,0 +1,10 @@
package io.sc.platform.jdbc.service;
import io.sc.platform.core.support.ProgressInfo;
import io.sc.platform.jdbc.exporter.support.DataExportConfigure;
import java.util.Locale;
public interface JdbcExportService {
public void export(DataExportConfigure configure, ProgressInfo progressInfo, Locale locale) throws Exception;
}

2
io.sc.platform.jdbc/src/main/java/io/sc/platform/jdbc/service/JdbcMetaDataLoaderService.java

@ -7,6 +7,6 @@ import io.sc.platform.jdbc.meta.support.TableSummary;
import java.util.List;
public interface JdbcMetaDataLoaderService {
public List<Schema> getSchemaNames(String datasourceName) throws Exception;
public List<Schema> getSchemas(String datasourceName) throws Exception;
public List<Table> getTables(String datasourceName, String schemaName) throws Exception;
}

43
io.sc.platform.jdbc/src/main/java/io/sc/platform/jdbc/service/impl/JdbcExportServiceImpl.java

@ -0,0 +1,43 @@
package io.sc.platform.jdbc.service.impl;
import io.sc.platform.core.support.ProgressInfo;
import io.sc.platform.jdbc.exporter.DataExporter;
import io.sc.platform.jdbc.exporter.support.DataExportConfigure;
import io.sc.platform.jdbc.service.DatasourceService;
import io.sc.platform.jdbc.service.JdbcExportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.sql.DataSource;
import java.util.Date;
import java.util.Locale;
@Service
public class JdbcExportServiceImpl implements JdbcExportService {
@Autowired private DatasourceService datasourceService;
@Override
public void export(DataExportConfigure configure, ProgressInfo progressInfo, Locale locale) throws Exception {
if(configure==null){
return;
}
progressInfo.setRunning(true);
DataSource dataSource =null;
if(StringUtils.hasText(configure.getDatasource())){
dataSource =datasourceService.getDatasource(configure.getDatasource());
}else{
dataSource =datasourceService.getDefaultDatasource();
}
progressInfo.setStartDatetime(new Date());
progressInfo.setTotalWeight(100);
DataExporter dataExporter =DataExporter.newInstance();
dataExporter.export(dataSource,configure,progressInfo,locale);
//执行完毕
progressInfo.setCompletedDatetime(new Date());
progressInfo.setCurrentWeight(progressInfo.getTotalWeight());
}
}

2
io.sc.platform.jdbc/src/main/java/io/sc/platform/jdbc/service/impl/JdbcMetaDataLoaderServiceImpl.java

@ -20,7 +20,7 @@ public class JdbcMetaDataLoaderServiceImpl implements JdbcMetaDataLoaderService
@Autowired MetaDataLoader metaDataLoader;
@Override
public List<Schema> getSchemaNames(String datasourceName) throws Exception {
public List<Schema> getSchemas(String datasourceName) throws Exception {
DataSource dataSource =null;
if(StringUtils.hasText(datasourceName)) {
dataSource =datasourceService.getDatasource(datasourceName);

4
io.sc.platform.lcdp.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.platform.lcdp.frontend",
"version": "8.1.24",
"version": "8.1.25",
"description": "",
"private": false,
"keywords": [
@ -93,7 +93,7 @@
"luckyexcel": "1.0.1",
"mockjs": "1.1.0",
"pinia": "2.1.7",
"platform-core": "8.1.133",
"platform-core": "8.1.136",
"quasar": "2.14.2",
"tailwindcss": "3.4.0",
"vue": "3.4.3",

4
io.sc.platform.mvc.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.platform.mvc.frontend",
"version": "8.1.24",
"version": "8.1.25",
"description": "",
"private": false,
"keywords": [
@ -80,7 +80,7 @@
"luckyexcel": "1.0.1",
"mockjs": "1.1.0",
"pinia": "2.1.7",
"platform-core": "8.1.133",
"platform-core": "8.1.136",
"quasar": "2.14.2",
"tailwindcss": "3.4.0",
"vue": "3.4.3",

4
io.sc.platform.security.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.platform.security.frontend",
"version": "8.1.24",
"version": "8.1.25",
"description": "",
"private": false,
"keywords": [
@ -99,6 +99,6 @@
"vue-dompurify-html": "5.0.1",
"vue-i18n": "9.8.0",
"vue-router": "4.2.5",
"platform-core": "8.1.133"
"platform-core": "8.1.136"
}
}

4
io.sc.platform.system.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.platform.system.frontend",
"version": "8.1.24",
"version": "8.1.25",
"description": "",
"private": false,
"keywords": [
@ -80,7 +80,7 @@
"luckyexcel": "1.0.1",
"mockjs": "1.1.0",
"pinia": "2.1.7",
"platform-core": "8.1.133",
"platform-core": "8.1.136",
"quasar": "2.14.2",
"tailwindcss": "3.4.0",
"vue": "3.4.3",

2
io.sc.platform.system.frontend/src/views/dictionary/Dictionary.vue

@ -12,7 +12,7 @@
:columns="[
{ width: 200, name: 'code', label: $t('code') },
{ width: 200, name: 'value', label: $t('value') },
{ width: '100%', name: 'value', label: $t('displayValue'), sortable: false, format: (value) => $t(value) },
{ width: '100%', name: 'value', label: $t('displayValue'), sortable: false, format: (value, row) => $t(row.code + '.' + row.value) },
{ width: 100, name: 'order', label: $t('order'), align: 'right' },
{ width: 100, name: 'lastModifier', label: $t('lastModifier') },
{ width: 150, name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.dateOnly() },

Loading…
Cancel
Save