Skip to content

Commit 4fc0ae4

Browse files
authored
Merge branch 'flipped-aurora:main' into main
2 parents 7e7334c + 3e55234 commit 4fc0ae4

File tree

4 files changed

+26
-10
lines changed

4 files changed

+26
-10
lines changed

server/model/system/sys_auto_code.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ type AutoCodeStruct struct {
1717
Description string `json:"description"` // Struct中文名称
1818
AutoCreateApiToSql bool `json:"autoCreateApiToSql"` // 是否自动创建api
1919
AutoCreateMenuToSql bool `json:"autoCreateMenuToSql"` // 是否自动创建menu
20+
AutoMigrate bool `json:"autoMigrate"` // 是否自动迁移表结构
2021
AutoCreateResource bool `json:"autoCreateResource"` // 是否自动创建资源标识
2122
BusinessDB string `json:"businessDB"` // 业务数据库
2223
GvaModel bool `json:"gvaModel"` // 是否使用gva默认Model

server/service/system/sys_auto_code.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,13 @@ func (autoCodeService *AutoCodeService) CreateTemp(autoCode system.AutoCodeStruc
275275
}
276276

277277
{
278-
// 在gorm.go 注入 自动迁移
279-
path := filepath.Join(global.GVA_CONFIG.AutoCode.Root,
280-
global.GVA_CONFIG.AutoCode.Server, global.GVA_CONFIG.AutoCode.SInitialize, "gorm.go")
281-
varDB := utils.MaheHump(autoCode.BusinessDB)
282-
ast2.AddRegisterTablesAst(path, "RegisterTables", autoCode.Package, varDB, autoCode.BusinessDB, autoCode.StructName)
278+
if autoCode.AutoMigrate {
279+
// 在gorm.go 注入 自动迁移
280+
path := filepath.Join(global.GVA_CONFIG.AutoCode.Root,
281+
global.GVA_CONFIG.AutoCode.Server, global.GVA_CONFIG.AutoCode.SInitialize, "gorm.go")
282+
varDB := utils.MaheHump(autoCode.BusinessDB)
283+
ast2.AddRegisterTablesAst(path, "RegisterTables", autoCode.Package, varDB, autoCode.BusinessDB, autoCode.StructName)
284+
}
283285
}
284286

285287
{

web/src/view/layout/header/index.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
!-->
55

66
<template>
7-
<div class="fixed top-0 left-0 right-0 z-10 h-16 bg-white text-slate-700 dark:text-slate-300 dark:bg-slate-900 shadow dark:shadow-gray-700 flex items-center px-2">
7+
<div class="flex justify-between fixed top-0 left-0 right-0 z-10 h-16 bg-white text-slate-700 dark:text-slate-300 dark:bg-slate-900 shadow dark:shadow-gray-700 flex items-center px-2">
88
<div
9-
class="flex items-center cursor-pointer"
9+
class="flex items-center cursor-pointer flex-1"
1010
@click="router.push({ path: '/' })"
1111
>
1212
<img
@@ -22,7 +22,7 @@
2222
{{ $GIN_VUE_ADMIN.appName }}
2323
</div>
2424

25-
<gva-aside v-if="config.side_mode === 'head' && !isMobile" />
25+
<gva-aside v-if="config.side_mode === 'head' && !isMobile" class="flex-1"/>
2626

2727
<el-breadcrumb v-show="!isMobile" v-else class="ml-4">
2828
<el-breadcrumb-item
@@ -36,7 +36,7 @@
3636
</el-breadcrumb>
3737
</div>
3838

39-
<div class="ml-auto flex items-center">
39+
<div class="ml-2 flex items-center">
4040
<tools />
4141
<el-dropdown>
4242
<div

web/src/view/systemTools/autoCode/index.vue

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,18 @@
293293
</template>
294294
<el-checkbox v-model="form.autoCreateMenuToSql" />
295295
</el-form-item>
296-
296+
<el-form-item>
297+
<template #label>
298+
<el-tooltip
299+
content="注:自动同步数据库表结构,如果不需要可以选择关闭。"
300+
placement="bottom"
301+
effect="light"
302+
>
303+
<div> 同步表结构 <el-icon><QuestionFilled /></el-icon></div>
304+
</el-tooltip>
305+
</template>
306+
<el-checkbox v-model="form.autoMigrate" />
307+
</el-form-item>
297308
</div>
298309
</el-form>
299310
</div>
@@ -782,6 +793,7 @@ const form = ref({
782793
businessDB: '',
783794
autoCreateApiToSql: true,
784795
autoCreateMenuToSql: true,
796+
autoMigrate: true,
785797
gvaModel: true,
786798
autoCreateResource: false,
787799
fields: []
@@ -1117,6 +1129,7 @@ const clearCatch = async () => {
11171129
businessDB: '',
11181130
autoCreateApiToSql: true,
11191131
autoCreateMenuToSql: true,
1132+
autoMigrate: true,
11201133
gvaModel: true,
11211134
autoCreateResource: false,
11221135
fields: []

0 commit comments

Comments
 (0)