93 lines
3.2 KiB
Go
93 lines
3.2 KiB
Go
package system
|
||
|
||
import (
|
||
"context"
|
||
"go/ast"
|
||
"io"
|
||
)
|
||
|
||
// SysApi API实体
|
||
type SysApi struct {
|
||
ID uint `json:"ID" gorm:"primarykey"`
|
||
Path string `json:"path" gorm:"comment:api路径"`
|
||
Description string `json:"description" gorm:"comment:api中文描述"`
|
||
ApiGroup string `json:"apiGroup" gorm:"comment:api组"`
|
||
Method string `json:"method" gorm:"default:POST;comment:方法"`
|
||
}
|
||
|
||
func (SysApi) TableName() string {
|
||
return "sys_apis"
|
||
}
|
||
|
||
// Meta 菜单元信息
|
||
type Meta struct {
|
||
Title string `json:"title" gorm:"comment:菜单名"`
|
||
Icon string `json:"icon" gorm:"comment:菜单图标"`
|
||
DefaultMenu bool `json:"defaultMenu" gorm:"comment:是否是基础路由(开发中)"`
|
||
CloseTab bool `json:"closeTab" gorm:"comment:自动关闭tab"`
|
||
KeepAlive bool `json:"keepAlive" gorm:"comment:是否缓存"`
|
||
}
|
||
|
||
// SysBaseMenu 菜单实体
|
||
type SysBaseMenu struct {
|
||
ID uint `json:"ID" gorm:"primarykey"`
|
||
ParentId uint `json:"parentId" gorm:"comment:父菜单ID"`
|
||
Path string `json:"path" gorm:"comment:路由path"`
|
||
Name string `json:"name" gorm:"comment:路由name"`
|
||
Hidden bool `json:"hidden" gorm:"comment:是否在列表隐藏"`
|
||
Component string `json:"component" gorm:"comment:对应前端文件路径"`
|
||
Sort int `json:"sort" gorm:"comment:排序标记"`
|
||
Meta Meta `json:"meta" gorm:"embedded;comment:附加属性"`
|
||
MenuBtn []SysBaseMenuBtn `json:"menuBtn" gorm:"-"`
|
||
Parameters []SysBaseMenuParameter `json:"parameters" gorm:"-"`
|
||
}
|
||
|
||
func (SysBaseMenu) TableName() string {
|
||
return "sys_base_menus"
|
||
}
|
||
|
||
// SysBaseMenuBtn 菜单按钮
|
||
type SysBaseMenuBtn struct {
|
||
ID uint `json:"ID" gorm:"primarykey"`
|
||
SysBaseMenuID uint `json:"sysBaseMenuID" gorm:"comment:菜单ID"`
|
||
Name string `json:"name" gorm:"comment:按钮关键key"`
|
||
Desc string `json:"desc" gorm:"comment:按钮备注"`
|
||
}
|
||
|
||
func (SysBaseMenuBtn) TableName() string {
|
||
return "sys_base_menu_btns"
|
||
}
|
||
|
||
// SysBaseMenuParameter 菜单参数
|
||
type SysBaseMenuParameter struct {
|
||
ID uint `json:"ID" gorm:"primarykey"`
|
||
SysBaseMenuID uint `json:"sysBaseMenuID" gorm:"comment:菜单ID"`
|
||
Type string `json:"type" gorm:"comment:地址栏携带参数为params还是query"`
|
||
Key string `json:"key" gorm:"comment:地址栏携带参数的key"`
|
||
Value string `json:"value" gorm:"comment:地址栏携带参数的值"`
|
||
}
|
||
|
||
func (SysBaseMenuParameter) TableName() string {
|
||
return "sys_base_menu_parameters"
|
||
}
|
||
|
||
// Ast AST接口定义
|
||
type Ast interface {
|
||
Parse(filename string, writer io.Writer) (file *ast.File, err error)
|
||
Rollback(file *ast.File) error
|
||
Injection(file *ast.File) error
|
||
Format(filename string, writer io.Writer, file *ast.File) error
|
||
}
|
||
|
||
// AutoCodeHistoryRepo 扩展接口(添加Create方法)
|
||
type AutoCodeHistoryRepoExt interface {
|
||
AutoCodeHistoryRepo
|
||
Create(ctx context.Context, history *SysAutoCodeHistory) error
|
||
}
|
||
|
||
// AutoCodePackageRepoExt 扩展接口
|
||
// 注意:Templates方法已在AutoCodePackageRepo中定义,此处不再重复
|
||
type AutoCodePackageRepoExt interface {
|
||
AutoCodePackageRepo
|
||
}
|