From 413640f5934b1c61b5b8c382c4386de9fd716cf1 Mon Sep 17 00:00:00 2001 From: "zhijiantianya@gmail.com" Date: Wed, 15 Nov 2023 21:05:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90=E5=99=A8?= =?UTF-8?q?=EF=BC=9A=E7=AE=80=E5=8C=96=20vo=20=E5=92=8C=20convert=20?= =?UTF-8?q?=E7=9A=84=E7=94=9F=E6=88=90=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/codegen/sql/h2.vm | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/sql/h2.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/sql/h2.vm index 9f133b957..b22389b0b 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/sql/h2.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/sql/h2.vm @@ -1,36 +1,36 @@ -- 将该建表 SQL 语句,添加到 yudao-module-${table.moduleName}-biz 模块的 test/resources/sql/create_tables.sql 文件里 CREATE TABLE IF NOT EXISTS "${table.tableName.toLowerCase()}" ( #foreach ($column in $columns) - #if (${column.javaType} == 'Long') - #set ($dataType='bigint') - #elseif (${column.javaType} == 'Integer') - #set ($dataType='int') - #elseif (${column.javaType} == 'Boolean') - #set ($dataType='bit') - #elseif (${column.javaType} == 'Date') - #set ($dataType='datetime') - #else - #set ($dataType='varchar') - #end +#if (${column.javaType} == 'Long') + #set ($dataType='bigint') +#elseif (${column.javaType} == 'Integer') + #set ($dataType='int') +#elseif (${column.javaType} == 'Boolean') + #set ($dataType='bit') +#elseif (${column.javaType} == 'Date') + #set ($dataType='datetime') +#else + #set ($dataType='varchar') +#end #if (${column.primaryKey})##处理主键 "${column.javaField}"#if (${column.javaType} == 'String') ${dataType} NOT NULL#else ${dataType} NOT NULL GENERATED BY DEFAULT AS IDENTITY#end, #else - #if (${column.columnName} == 'create_time') - "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - #elseif (${column.columnName} == 'update_time') - "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - #elseif (${column.columnName} == 'creator' || ${column.columnName} == 'updater') - "${column.columnName}" ${dataType} DEFAULT '', - #elseif (${column.columnName} == 'deleted') - "deleted" bit NOT NULL DEFAULT FALSE, - #elseif (${column.columnName} == 'tenantId') - "tenant_id" bigint NOT NULL DEFAULT 0, - #else - "${column.columnName.toLowerCase()}" ${dataType}#if (${column.nullable} == false) NOT NULL#end, - #end + #if (${column.columnName} == 'create_time') + "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + #elseif (${column.columnName} == 'update_time') + "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + #elseif (${column.columnName} == 'creator' || ${column.columnName} == 'updater') + "${column.columnName}" ${dataType} DEFAULT '', + #elseif (${column.columnName} == 'deleted') + "deleted" bit NOT NULL DEFAULT FALSE, + #elseif (${column.columnName} == 'tenantId') + "tenant_id" bigint NOT NULL DEFAULT 0, + #else + "${column.columnName.toLowerCase()}" ${dataType}#if (${column.nullable} == false) NOT NULL#end, + #end #end #end -PRIMARY KEY ("${primaryColumn.columnName.toLowerCase()}") + PRIMARY KEY ("${primaryColumn.columnName.toLowerCase()}") ) COMMENT '${table.tableComment}'; -- 将该删表 SQL 语句,添加到 yudao-module-${table.moduleName}-biz 模块的 test/resources/sql/clean.sql 文件里