代码生成

This commit is contained in:
PandaGoAdmin
2022-01-03 19:03:39 +08:00
parent 1a1f137725
commit b6a8fe5e1b
53 changed files with 2467 additions and 459 deletions

View File

@@ -3,26 +3,34 @@ package entity
import "pandax/base/model"
type DevGenTable struct {
TableId int64 `gorm:"table_id,primary" json:"tableId"` // 编号
TableName string `gorm:"table_name" json:"tableName"` // 表名称
TableComment string `gorm:"table_comment" json:"tableComment"` // 表描述
ClassName string `gorm:"class_name" json:"className"` // 实体类名称
TplCategory string `gorm:"tpl_category" json:"tplCategory"` // 使用的模板crud单表操作 tree树表操作
PackageName string `gorm:"package_name" json:"packageName"` // 生成包路径
ModuleName string `gorm:"module_name" json:"moduleName"` // 生成模块名
BusinessName string `gorm:"business_name" json:"businessName"` // 生成业务名
FunctionName string `gorm:"function_name" json:"functionName"` // 生成功能名
FunctionAuthor string `gorm:"function_author" json:"functionAuthor"` // 生成功能作者
Options string `gorm:"options" json:"options"` // 其它生成选项
Remark string `gorm:"remark" json:"remark"` // 备注
Columns []DevGenTableColumn `gorm:"-" json:"columns"` // 字段信息
PkColumn DevGenTableColumn `gorm:"-" json:"pkColumn"` // 主键列信息
TableId int64 `gorm:"primaryKey;autoIncrement" json:"tableId"` // 编号
TableName string `gorm:"table_name" json:"tableName"` // 表名称
TableComment string `gorm:"table_comment" json:"tableComment"` // 表描述
ClassName string `gorm:"class_name" json:"className"` // 实体类名称
TplCategory string `gorm:"tpl_category" json:"tplCategory"` // 使用的模板crud单表操作 tree树表操作
PackageName string `gorm:"package_name" json:"packageName"` // 生成包路径
ModuleName string `gorm:"module_name" json:"moduleName"` // 生成模块名
BusinessName string `gorm:"business_name" json:"businessName"` // 生成业务名
FunctionName string `gorm:"function_name" json:"functionName"` // 生成功能名
FunctionAuthor string `gorm:"function_author" json:"functionAuthor"` // 生成功能作者
TreeCode string `gorm:"tree_code" json:"treeCode"`
TreeParentCode string `gorm:"tree_parent_code" json:"treeParentCode"`
TreeName string `gorm:"tree_name" json:"treeName"`
Options string `gorm:"options" json:"options"` // 其它生成选项
Remark string `gorm:"remark" json:"remark"` // 备注
PkColumn string `gorm:"pk_column;" json:"pkColumn"`
PkGoField string `gorm:"pk_go_field" json:"pkGoField"`
PkJsonField string `gorm:"pk_json_field" json:"pkJsonField"`
Columns []DevGenTableColumn `gorm:"-" json:"columns"` // 字段信息
model.BaseModel
}
type ToolsGenTableExtend struct {
DevGenTable
TreeCode string `gorm:"-" json:"treeCode"` // 树编码字段
TreeParentCode string `gorm:"-" json:"treeParentCode"` // 树父编码字段
TreeName string `gorm:"-" json:"treeName"` // 树名称字段
type DBTables struct {
TableName string `gorm:"column:TABLE_NAME" json:"tableName"`
Engine string `gorm:"column:ENGINE" json:"engine"`
TableRows string `gorm:"column:TABLE_ROWS" json:"tableRows"`
TableCollation string `gorm:"column:TABLE_COLLATION" json:"tableCollation"`
CreateTime string `gorm:"column:CREATE_TIME" json:"createTime"`
UpdateTime string `gorm:"column:UPDATE_TIME" json:"updateTime"`
TableComment string `gorm:"column:TABLE_COMMENT" json:"tableComment"`
}

View File

@@ -1,14 +1,16 @@
package entity
type DevGenTableColumn struct {
ColumnId int64 `gorm:"column_id,primary" json:"columnId"` // 编号
TableId int64 `gorm:"table_id" json:"tableId"` // 归属表编号
ColumnId int64 `gorm:"primaryKey;autoIncrement" json:"columnId"` // 编号
TableId int64 `gorm:"table_id" json:"tableId"` // 归属表编号
TableName string `gorm:"table_name" json:"tableName"`
ColumnName string `gorm:"column_name" json:"columnName"` // 列名称
ColumnComment string `gorm:"column_comment" json:"columnComment"` // 列描述
ColumnType string `gorm:"column_type" json:"columnType"` // 列类型
GoType string `gorm:"go_type" json:"goType"` // Go类型
GoField string `gorm:"go_field" json:"goField"` // Go字段名
ColumnName string `gorm:"column_name" json:"columnName"` // 列名称
ColumnComment string `gorm:"column_comment" json:"columnComment"` // 列描述
ColumnType string `gorm:"column_type" json:"columnType"` // 列类型
ColumnKey string `gorm:"column_key" json:"columnKey"`
GoType string `gorm:"go_type" json:"goType"` // Go类型
GoField string `gorm:"go_field" json:"goField"` // Go字段名
JsonField string `gorm:"json_field;" json:"jsonField"`
HtmlField string `gorm:"html_field" json:"htmlField"` // html字段名
IsPk string `gorm:"is_pk" json:"isPk"` // 是否主键1是
IsIncrement string `gorm:"is_increment" json:"isIncrement"` // 是否自增1是
@@ -27,3 +29,18 @@ type DevGenTableColumn struct {
LinkLabelId string `gorm:"link_label_id" json:"linkLabelId"` // 关联表键名
LinkLabelName string `gorm:"link_label_name" json:"linkLabelName"` // 关联表字段值
}
type DBColumns struct {
TableSchema string `gorm:"column:TABLE_SCHEMA" json:"tableSchema"`
TableName string `gorm:"column:TABLE_NAME" json:"tableName"`
ColumnName string `gorm:"column:COLUMN_NAME" json:"columnName"`
ColumnDefault string `gorm:"column:COLUMN_DEFAULT" json:"columnDefault"`
IsNullable string `gorm:"column:IS_NULLABLE" json:"isNullable"`
DataType string `gorm:"column:DATA_TYPE" json:"dataType"`
CharacterMaximumLength string `gorm:"column:CHARACTER_MAXIMUM_LENGTH" json:"characterMaximumLength"`
CharacterSetName string `gorm:"column:CHARACTER_SET_NAME" json:"characterSetName"`
ColumnType string `gorm:"column:COLUMN_TYPE" json:"columnType"`
ColumnKey string `gorm:"column:COLUMN_KEY" json:"columnKey"`
Extra string `gorm:"column:EXTRA" json:"extra"`
ColumnComment string `gorm:"column:COLUMN_COMMENT" json:"columnComment"`
}