修复 代码生成信息 反显问题

This commit is contained in:
吕金泽 2022-06-08 22:06:49 +08:00
parent 476760a9b5
commit 00dad13df3
5 changed files with 24 additions and 17 deletions

View File

@ -5,7 +5,7 @@
"groupId" : "f2538e0f370a4cabab0ae920f5e77ae7",
"name" : "执行生成",
"createTime" : null,
"updateTime" : 1653992145291,
"updateTime" : 1654682481038,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@ -324,12 +324,12 @@ columns.forEach(it => {
}
}
})
datasource = datasource || ''
var commonField = db[datasource].select("""
SELECT
column_name
FROM
information_schema.COLUMNS
information_schema.COLUMNS
WHERE
table_name = #{tableName} AND column_name IN ( 'is_del', 'create_by', 'create_date', 'update_by', 'update_date' ) AND table_schema = DATABASE()
""")
@ -406,4 +406,4 @@ componentInfo.setPath("/list")
componentInfo.setScript(componentScript)
MagicResourceService.saveFile(componentInfo)
return 1
return 1

View File

@ -5,7 +5,7 @@
"groupId" : "f2538e0f370a4cabab0ae920f5e77ae7",
"name" : "查出所有表",
"createTime" : null,
"updateTime" : 1653990626738,
"updateTime" : 1654682333737,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@ -130,6 +130,6 @@
}
}
================================
return db[datasource].select("""
return db[datasource || ''].select("""
select table_name, table_comment from information_schema.tables where table_schema = database()
""").map(it => { label: it.tableName + `(${it.tableComment})`, value: it.tableName })

View File

@ -5,7 +5,7 @@
"groupId" : "f2538e0f370a4cabab0ae920f5e77ae7",
"name" : "根据表名查出所有列",
"createTime" : null,
"updateTime" : 1653991292310,
"updateTime" : 1654682348773,
"lock" : null,
"createBy" : null,
"updateBy" : null,
@ -191,7 +191,7 @@
}
================================
return {
columns: db[datasource].select("""
columns: db[datasource || ''].select("""
SELECT
column_name,
column_comment,

View File

@ -1,6 +1,6 @@
<template>
<el-form ref="dataForm" :model="genInfo" :rules="genInfoRules" label-position="right" label-width="120px">
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tabs v-model="activeName">
<el-tab-pane label="表信息" name="basic">
<el-row :gutter="24">
<el-col :span="8">
@ -151,11 +151,6 @@ import {reactive, ref, watch, getCurrentInstance, onMounted, nextTick} from 'vue
})
}
watch(() => genInfo.value.datasource, () => {
datasourceChange()
genInfo.value.tableName = ''
})
function formInitClearValidate(){
genInfo.value.tableComment = ''
genInfo.value.info.moduleName = '';
@ -170,6 +165,13 @@ import {reactive, ref, watch, getCurrentInstance, onMounted, nextTick} from 'vue
},1)
}
function watchDatasource(){
watch(() => genInfo.value.datasource, () => {
datasourceChange()
genInfo.value.tableName = ''
})
}
function watchTableName(){
datasourceChange()
watch(() => genInfo.value.tableName, (value) => {
@ -199,6 +201,11 @@ import {reactive, ref, watch, getCurrentInstance, onMounted, nextTick} from 'vue
})
}
function watchInfo(){
watchTableName()
watchDatasource()
}
const activeName = ref('basic')
const formData = reactive({
groupName: ''
@ -399,10 +406,10 @@ import {reactive, ref, watch, getCurrentInstance, onMounted, nextTick} from 'vue
formData.info = JSON.parse(formData.info)
formData.columns = JSON.parse(formData.columns)
genInfo.value = formData
watchTableName()
watchInfo()
})
}
defineExpose({ save, getDetail, watchTableName })
defineExpose({ save, getDetail, watchInfo })
</script>

View File

@ -20,7 +20,7 @@
permission: 'code:gen:save',
click: () => {
formDialog.value.show()
nextTick(() => magicForm.value.watchTableName())
nextTick(() => magicForm.value.watchInfo())
}
}],
table: {