签入脚本
This commit is contained in:
@@ -0,0 +1,121 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/util/gmeta"
|
||||
)
|
||||
|
||||
// ============================== 代码生成模块(读数据库结构) ==============================
|
||||
|
||||
// GeneratorTableItem 数据表行数据
|
||||
// 用于代码生成模块的数据表分页列表,描述数据库表的元信息
|
||||
type GeneratorTableItem struct {
|
||||
TableName string `json:"tableName"` // 表名
|
||||
TableComment string `json:"tableComment"` // 表注释
|
||||
Engine string `json:"engine"` // 存储引擎
|
||||
TableRows int64 `json:"tableRows"` // 表记录数
|
||||
DataLength int64 `json:"dataLength"` // 数据大小(字节)
|
||||
AutoIncrement int64 `json:"autoIncrement"` // 自增当前值
|
||||
TableCollation string `json:"tableCollation"` // 表排序规则
|
||||
CreateTime string `json:"createTime"` // 创建时间
|
||||
}
|
||||
|
||||
// GeneratorPageReq 数据表分页请求
|
||||
// 支持按表名、表注释模糊查询数据库表
|
||||
type GeneratorPageReq struct {
|
||||
gmeta.Meta `method:"get" path:"/api/generator/page" summary:"查询数据表" permission:"sys:generator:page" log:"代码生成-查询数据表" logType:"query"`
|
||||
PageReq // 分页基础参数
|
||||
TableName string `json:"tableName" dc:"表名模糊"` // 表名模糊匹配
|
||||
TableComment string `json:"tableComment" dc:"表注释模糊"` // 表注释模糊匹配
|
||||
}
|
||||
|
||||
// GeneratorPageRes 数据表分页结果
|
||||
type GeneratorPageRes = PageData[GeneratorTableItem]
|
||||
|
||||
// GeneratorPreviewReq 预览代码请求
|
||||
// TableNames 元素格式为 "表名|表注释"
|
||||
type GeneratorPreviewReq struct {
|
||||
gmeta.Meta `method:"post" path:"/api/generator/preview" summary:"预览代码" permission:"sys:generator:generator" log:"代码生成-预览代码" logType:"generate"`
|
||||
TableNames []string `json:"tableNames" v:"required#请选择数据表" dc:"数据表列表(表名|表注释)"` // 数据表列表
|
||||
}
|
||||
|
||||
// GeneratorFileItem 生成文件
|
||||
// 描述单个待生成文件的路径与内容
|
||||
type GeneratorFileItem struct {
|
||||
Path string `json:"path"` // 文件路径
|
||||
Content string `json:"content"` // 文件内容
|
||||
}
|
||||
|
||||
// GeneratorPreviewRes 预览结果
|
||||
type GeneratorPreviewRes struct {
|
||||
List []GeneratorFileItem `json:"list"` // 生成文件列表
|
||||
}
|
||||
|
||||
// GeneratorGenerateReq 一键生成请求
|
||||
// TableNames 元素格式为 "表名|表注释"
|
||||
type GeneratorGenerateReq struct {
|
||||
gmeta.Meta `method:"post" path:"/api/generator/generate" summary:"一键生成" permission:"sys:generator:generator" log:"代码生成-一键生成" logType:"generate"`
|
||||
TableNames []string `json:"tableNames" v:"required#请选择数据表" dc:"数据表列表(表名|表注释)"` // 数据表列表
|
||||
}
|
||||
|
||||
// GeneratorMenuResult 同步创建菜单结果
|
||||
// 描述代码生成过程中同步创建菜单的执行结果
|
||||
type GeneratorMenuResult struct {
|
||||
Success bool `json:"success"` // 是否成功
|
||||
MenuId int64 `json:"menuId"` // 菜单ID
|
||||
Message string `json:"message"` // 结果消息
|
||||
}
|
||||
|
||||
// GeneratorDictResult 同步创建字典结果
|
||||
// 描述代码生成过程中同步创建字典的执行结果
|
||||
type GeneratorDictResult struct {
|
||||
Dict string `json:"dict"` // 字典编码
|
||||
Name string `json:"name,omitempty"` // 字典名称
|
||||
Items int `json:"items,omitempty"` // 字典项数量
|
||||
Status string `json:"status"` // 执行状态
|
||||
}
|
||||
|
||||
// GeneratorRouteResult 同步注册路由结果
|
||||
// 描述代码生成过程中同步注册路由的执行结果
|
||||
type GeneratorRouteResult struct {
|
||||
Success bool `json:"success"` // 是否成功
|
||||
Message string `json:"message"` // 结果消息
|
||||
}
|
||||
|
||||
// GeneratorGenerateRes 生成结果
|
||||
// 汇总代码生成的文件写入情况以及菜单、字典、路由的同步结果
|
||||
type GeneratorGenerateRes struct {
|
||||
Generated []string `json:"generated"` // 新生成的文件
|
||||
Skipped []string `json:"skipped"` // 跳过的文件
|
||||
Overwritten []string `json:"overwritten"` // 覆盖的文件
|
||||
Failed []string `json:"failed"` // 失败的文件
|
||||
Menu GeneratorMenuResult `json:"menu"` // 菜单创建结果
|
||||
Dict []GeneratorDictResult `json:"dict"` // 字典创建结果
|
||||
Route GeneratorRouteResult `json:"route"` // 路由注册结果
|
||||
}
|
||||
|
||||
// GeneratorBatchGenerateReq 批量生成请求
|
||||
// TableNames 元素格式为 "表名|表注释"
|
||||
type GeneratorBatchGenerateReq struct {
|
||||
gmeta.Meta `method:"post" path:"/api/generator/batchGenerate" summary:"批量生成" permission:"sys:generator:batchGenerator" log:"代码生成-批量生成" logType:"generate"`
|
||||
TableNames []string `json:"tableNames" v:"required#请选择数据表" dc:"数据表列表(表名|表注释)"` // 数据表列表
|
||||
}
|
||||
|
||||
// GeneratorBatchItem 单表生成结果
|
||||
// 描述批量生成中单张表的执行情况
|
||||
type GeneratorBatchItem struct {
|
||||
Table string `json:"table"` // 表名
|
||||
Success bool `json:"success"` // 是否成功
|
||||
Generated int `json:"generated"` // 新生成文件数
|
||||
Skipped int `json:"skipped"` // 跳过文件数
|
||||
Overwritten int `json:"overwritten"` // 覆盖文件数
|
||||
Failed int `json:"failed"` // 失败文件数
|
||||
Message string `json:"message"` // 结果消息
|
||||
Menu GeneratorMenuResult `json:"menu"` // 菜单创建结果
|
||||
Dict []GeneratorDictResult `json:"dict"` // 字典创建结果
|
||||
Route GeneratorRouteResult `json:"route"` // 路由注册结果
|
||||
}
|
||||
|
||||
// GeneratorBatchGenerateRes 批量生成结果
|
||||
type GeneratorBatchGenerateRes struct {
|
||||
List []GeneratorBatchItem `json:"list"` // 各表生成结果列表
|
||||
}
|
||||
Reference in New Issue
Block a user