From bb9bfebec545fc7f9a6b49cd173f5b5b97fbed60 Mon Sep 17 00:00:00 2001 From: SanLi <2689170096@qq.com> Date: Wed, 26 Aug 2020 16:02:45 +0800 Subject: [PATCH] =?UTF-8?q?:recycle:=20=E9=87=8D=E6=9E=84=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/smallbun/screw/core/metadata/model/ColumnModel.java | 4 ++++ .../java/cn/smallbun/screw/core/process/DataModelProcess.java | 3 +++ .../main/resources/template/freemarker/documentation_html.ftl | 2 +- .../main/resources/template/freemarker/documentation_md.ftl | 4 ++-- .../main/resources/template/freemarker/documentation_word.ftl | 2 +- .../main/resources/template/velocity/documentation_html.vm | 2 +- .../src/main/resources/template/velocity/documentation_md.vm | 4 ++-- .../main/resources/template/velocity/documentation_word.vm | 2 +- 8 files changed, 15 insertions(+), 8 deletions(-) diff --git a/screw-core/src/main/java/cn/smallbun/screw/core/metadata/model/ColumnModel.java b/screw-core/src/main/java/cn/smallbun/screw/core/metadata/model/ColumnModel.java index 5695075..4458e5f 100644 --- a/screw-core/src/main/java/cn/smallbun/screw/core/metadata/model/ColumnModel.java +++ b/screw-core/src/main/java/cn/smallbun/screw/core/metadata/model/ColumnModel.java @@ -69,6 +69,10 @@ public class ColumnModel implements Serializable { * 列长度 */ private String columnLength; + /** + * 列大小 + */ + private String columnSize; /** * 小数位 */ diff --git a/screw-core/src/main/java/cn/smallbun/screw/core/process/DataModelProcess.java b/screw-core/src/main/java/cn/smallbun/screw/core/process/DataModelProcess.java index a7206d2..315149a 100644 --- a/screw-core/src/main/java/cn/smallbun/screw/core/process/DataModelProcess.java +++ b/screw-core/src/main/java/cn/smallbun/screw/core/process/DataModelProcess.java @@ -155,6 +155,9 @@ public class DataModelProcess extends AbstractProcess { columnModel.setTypeName(column.getTypeName()); //长度 columnModel.setColumnLength(column.getColumnLength()); + columnModel.setColumnLength(column.getColumnLength()); + //size + columnModel.setColumnSize(column.getColumnSize()); //小数位 columnModel.setDecimalDigits( StringUtils.defaultString(column.getDecimalDigits(), ZERO_DECIMAL_DIGITS)); diff --git a/screw-core/src/main/resources/template/freemarker/documentation_html.ftl b/screw-core/src/main/resources/template/freemarker/documentation_html.ftl index b009b9e..e2bc088 100644 --- a/screw-core/src/main/resources/template/freemarker/documentation_html.ftl +++ b/screw-core/src/main/resources/template/freemarker/documentation_html.ftl @@ -17,4 +17,4 @@ along with this program. If not, see . --> -${title!'数据库设计文档'}

${title!'数据库设计文档'}

数据库名:${database!''}
<#if (version)??>文档版本:${version!''}
<#if (description)??>文档描述:${description!''}
<#list tables><#items as t>
序号表名说明
${t?index+1}${t.tableName}${t.remarks!''}
<#list tables><#items as t>
返回目录表名:${t.tableName}
说明:${t.remarks!''}
数据列:
<#list t.columns><#items as c>
序号名称数据类型长度小数位允许空值主键默认值说明
${c?index+1}${c.columnName!''}${c.columnType!''}${c.columnLength!''}${c.decimalDigits!'0'}${c.nullable!''}${c.primaryKey!''}${c.columnDef!''}${c.remarks!''}
\ No newline at end of file +${title!'数据库设计文档'}

${title!'数据库设计文档'}

数据库名:${database!''}
<#if (version)??>文档版本:${version!''}
<#if (description)??>文档描述:${description!''}
<#list tables><#items as t>
序号表名说明
${t?index+1}${t.tableName}${t.remarks!''}
<#list tables><#items as t>
返回目录表名:${t.tableName}
说明:${t.remarks!''}
数据列:
<#list t.columns><#items as c>
序号名称数据类型列大小小数位允许空值主键默认值说明
${c?index+1}${c.columnName!''}${c.columnType!''}${c.columnSize!''}${c.decimalDigits!'0'}${c.nullable!''}${c.primaryKey!''}${c.columnDef!''}${c.remarks!''}
\ No newline at end of file diff --git a/screw-core/src/main/resources/template/freemarker/documentation_md.ftl b/screw-core/src/main/resources/template/freemarker/documentation_md.ftl index 7a494f8..0fe49ed 100644 --- a/screw-core/src/main/resources/template/freemarker/documentation_md.ftl +++ b/screw-core/src/main/resources/template/freemarker/documentation_md.ftl @@ -47,10 +47,10 @@ **数据列:** <#list t.columns> -| 序号 | 名称 | 数据类型 | 长度 | 小数位 | 允许空值 | 主键 | 默认值 | 说明 | +| 序号 | 名称 | 数据类型 | 列大小 | 小数位 | 允许空值 | 主键 | 默认值 | 说明 | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | <#items as c> -| ${c?index+1} | ${c.columnName!''} | ${c.columnType!''} | ${c.columnLength!''} | ${c.decimalDigits!'0'} | ${c.nullable!''} | ${c.primaryKey!''} | ${c.columnDef!''} | ${c.remarks!''} | +| ${c?index+1} | ${c.columnName!''} | ${c.columnType!''} | ${c.columnSize!''} | ${c.decimalDigits!'0'} | ${c.nullable!''} | ${c.primaryKey!''} | ${c.columnDef!''} | ${c.remarks!''} | \ No newline at end of file diff --git a/screw-core/src/main/resources/template/freemarker/documentation_word.ftl b/screw-core/src/main/resources/template/freemarker/documentation_word.ftl index d4d1cc3..4669e7a 100644 --- a/screw-core/src/main/resources/template/freemarker/documentation_word.ftl +++ b/screw-core/src/main/resources/template/freemarker/documentation_word.ftl @@ -17,4 +17,4 @@ along with this program. If not, see . --> -${title!'数据库表结构文档'}数据库名:${database!''}<#if version?trim?length gt 2>文档版本:${version!''}<#if description?trim?length gt 2>文档描述:${description!''}<#--表--><#list tables><#items as t><#if (t.remarks??)&&(t.remarks?length gt 1)>${t.tableName!''} (${t.remarks})<#else>${t.tableName!''}<#--页面设置-->编号名称数据类型长度小数位允许空值主键默认值说明<#--列--><#list t.columns><#items as c>${c?index+1}${c.columnName!''}${c.columnType!''}${c.columnLength!''}${c.decimalDigits!'0'}${c.nullable!''}${c.primaryKey!''}${c.columnDef!''}${c.remarks!''}${title!'数据库表结构文档'}screwscrew20117100Microsoft Office Word011falsefalse116falsefalse16.00002052-11.1.0.9740 \ No newline at end of file +${title!'数据库表结构文档'}数据库名:${database!''}<#if version?trim?length gt 2>文档版本:${version!''}<#if description?trim?length gt 2>文档描述:${description!''}<#--表--><#list tables><#items as t><#if (t.remarks??)&&(t.remarks?length gt 1)>${t.tableName!''} (${t.remarks})<#else>${t.tableName!''}<#--页面设置-->编号名称数据类型列大小小数位允许空值主键默认值说明<#--列--><#list t.columns><#items as c>${c?index+1}${c.columnName!''}${c.columnType!''}${c.columnSize!''}${c.decimalDigits!'0'}${c.nullable!''}${c.primaryKey!''}${c.columnDef!''}${c.remarks!''}${title!'数据库表结构文档'}screwscrew20117100Microsoft Office Word011falsefalse116falsefalse16.00002052-11.1.0.9740 \ No newline at end of file diff --git a/screw-core/src/main/resources/template/velocity/documentation_html.vm b/screw-core/src/main/resources/template/velocity/documentation_html.vm index 77e901d..d1f4b7d 100644 --- a/screw-core/src/main/resources/template/velocity/documentation_html.vm +++ b/screw-core/src/main/resources/template/velocity/documentation_html.vm @@ -15,4 +15,4 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . *# -#if(${_data.title})${_data.title}#else 数据库设计文档#end

#if(${_data.title})${_data.title}#else 数据库设计文档#end

数据库名:$!{_data.database}
#*文档版本*# #if(${_data.version})文档版本:$!{_data.version}
#end #*文档描述*# #if(${_data.description})文档描述:$!{_data.description}
#end
#foreach($t in $_data.tables)#end
序号表名说明
$!{velocityCount}$!{t.tableName}$!{t.remarks}
#foreach($t in $_data.tables)
返回目录表名:$!{t.tableName}
说明:$!{t.remarks}
数据列:
#foreach($c in $t.columns)#end
序号名称数据类型长度小数位允许空值主键默认值说明
$!{velocityCount}$!{c.columnName}$!{c.columnType}$!{c.columnLength}#if(${c.decimalDigits})${c.decimalDigits}#else 0#end$!{c.nullable}$!{c.primaryKey}$!{c.columnDef}$!{c.remarks}
#end
\ No newline at end of file +#if(${_data.title})${_data.title}#else 数据库设计文档#end

#if(${_data.title})${_data.title}#else 数据库设计文档#end

数据库名:$!{_data.database}
#*文档版本*# #if(${_data.version})文档版本:$!{_data.version}
#end #*文档描述*# #if(${_data.description})文档描述:$!{_data.description}
#end
#foreach($t in $_data.tables)#end
序号表名说明
$!{velocityCount}$!{t.tableName}$!{t.remarks}
#foreach($t in $_data.tables)
返回目录表名:$!{t.tableName}
说明:$!{t.remarks}
数据列:
#foreach($c in $t.columns)#end
序号名称数据类型列大小小数位允许空值主键默认值说明
$!{velocityCount}$!{c.columnName}$!{c.columnType}$!{c.columnSize}#if(${c.decimalDigits})${c.decimalDigits}#else 0#end$!{c.nullable}$!{c.primaryKey}$!{c.columnDef}$!{c.remarks}
#end
\ No newline at end of file diff --git a/screw-core/src/main/resources/template/velocity/documentation_md.vm b/screw-core/src/main/resources/template/velocity/documentation_md.vm index 00c41a6..387203d 100644 --- a/screw-core/src/main/resources/template/velocity/documentation_md.vm +++ b/screw-core/src/main/resources/template/velocity/documentation_md.vm @@ -42,9 +42,9 @@ **数据列:** -| 序号 | 名称 | 数据类型 | 长度 | 小数位 | 允许空值 | 主键 | 默认值 | 说明 | +| 序号 | 名称 | 数据类型 | 列大小 | 小数位 | 允许空值 | 主键 | 默认值 | 说明 | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | #foreach($c in $t.columns) -| $!{velocityCount} | $!{c.columnName} | $!{c.columnType} | $!{c.columnLength} | #if($!{c.decimalDigits})$!{c.decimalDigits}#else 0#end | $!{c.nullable}| $!{c.primaryKey} | $!{c.columnDef} | $!{c.remarks} | +| $!{velocityCount} | $!{c.columnName} | $!{c.columnType} | $!{c.columnSize} | #if($!{c.decimalDigits})$!{c.decimalDigits}#else 0#end | $!{c.nullable}| $!{c.primaryKey} | $!{c.columnDef} | $!{c.remarks} | #end #end \ No newline at end of file diff --git a/screw-core/src/main/resources/template/velocity/documentation_word.vm b/screw-core/src/main/resources/template/velocity/documentation_word.vm index 57de4e4..3ed66b0 100644 --- a/screw-core/src/main/resources/template/velocity/documentation_word.vm +++ b/screw-core/src/main/resources/template/velocity/documentation_word.vm @@ -14,4 +14,4 @@ * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . - *##if($_data.title)!=""$!{_data.title}#else数据库表结构文档#end数据库名:$!{_data.database}#*版本*# #if(${_data.version}!= "")文档版本:$!{_data.version}#end #*描述*# #if(${_data.description}!= "")文档描述:$!{_data.description}#end #*表名*# #foreach($t in $_data.tables)#if(${t.remarks}!= "")$!{t.tableName} ($!{t.remarks})#else$!{t.tableName}#end编号名称数据类型长度小数位允许空值主键默认值说明#foreach($c in $t.columns)$!{velocityCount}$!{c.columnName}$!{c.columnType}$!{c.columnLength}#if(${c.decimalDigits})${c.decimalDigits}#else 0#end$!{c.nullable}$!{c.primaryKey}$!{c.columnDef}$!{c.remarks}#end#end#if($_data.title)!=""$!{_data.title}#else数据库表结构文档#endscrewscrew20117100Microsoft Office Word011falsefalse116falsefalse16.00002052-11.1.0.9740 \ No newline at end of file + *##if($_data.title)!=""$!{_data.title}#else数据库表结构文档#end数据库名:$!{_data.database}#*版本*# #if(${_data.version}!= "")文档版本:$!{_data.version}#end #*描述*# #if(${_data.description}!= "")文档描述:$!{_data.description}#end #*表名*# #foreach($t in $_data.tables)#if(${t.remarks}!= "")$!{t.tableName} ($!{t.remarks})#else$!{t.tableName}#end编号名称数据类型列大小小数位允许空值主键默认值说明#foreach($c in $t.columns)$!{velocityCount}$!{c.columnName}$!{c.columnType}$!{c.columnSize}#if(${c.decimalDigits})${c.decimalDigits}#else 0#end$!{c.nullable}$!{c.primaryKey}$!{c.columnDef}$!{c.remarks}#end#end#if($_data.title)!=""$!{_data.title}#else数据库表结构文档#endscrewscrew20117100Microsoft Office Word011falsefalse116falsefalse16.00002052-11.1.0.9740 \ No newline at end of file