后端重构
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"database/sql/driver"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
)
|
||||
|
||||
// JSONMap JSON映射类型
|
||||
type JSONMap map[string]interface{}
|
||||
|
||||
// Value 实现driver.Valuer接口
|
||||
func (m JSONMap) Value() (driver.Value, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return json.Marshal(m)
|
||||
}
|
||||
|
||||
// Scan 实现sql.Scanner接口
|
||||
func (m *JSONMap) Scan(value interface{}) error {
|
||||
if value == nil {
|
||||
*m = make(map[string]interface{})
|
||||
return nil
|
||||
}
|
||||
var err error
|
||||
switch v := value.(type) {
|
||||
case []byte:
|
||||
err = json.Unmarshal(v, m)
|
||||
case string:
|
||||
err = json.Unmarshal([]byte(v), m)
|
||||
default:
|
||||
err = errors.New("basetypes.JSONMap.Scan: invalid value type")
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// TreeNode 树节点接口
|
||||
type TreeNode[T any] interface {
|
||||
GetChildren() []T
|
||||
SetChildren(children T)
|
||||
GetID() int
|
||||
GetParentID() int
|
||||
}
|
||||
|
||||
// ClearDB 清理数据库配置
|
||||
type ClearDB struct {
|
||||
TableName string
|
||||
CompareField string
|
||||
Interval string
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package common
|
||||
|
||||
import "gorm.io/gorm"
|
||||
|
||||
// PageInfo 分页通用输入参数结构
|
||||
type PageInfo struct {
|
||||
Page int `json:"page" form:"page"` // 页码
|
||||
PageSize int `json:"pageSize" form:"pageSize"` // 每页大小
|
||||
Keyword string `json:"keyword" form:"keyword"` // 关键字
|
||||
}
|
||||
|
||||
// Paginate 分页函数
|
||||
func (r *PageInfo) Paginate() func(db *gorm.DB) *gorm.DB {
|
||||
return func(db *gorm.DB) *gorm.DB {
|
||||
if r.Page <= 0 {
|
||||
r.Page = 1
|
||||
}
|
||||
switch {
|
||||
case r.PageSize > 100:
|
||||
r.PageSize = 100
|
||||
case r.PageSize <= 0:
|
||||
r.PageSize = 10
|
||||
}
|
||||
offset := (r.Page - 1) * r.PageSize
|
||||
return db.Offset(offset).Limit(r.PageSize)
|
||||
}
|
||||
}
|
||||
|
||||
// GetById 根据ID查找结构
|
||||
type GetById struct {
|
||||
ID int `json:"id" form:"id"` // 主键ID
|
||||
}
|
||||
|
||||
// Uint 转换为uint
|
||||
func (r *GetById) Uint() uint {
|
||||
return uint(r.ID)
|
||||
}
|
||||
|
||||
// IdsReq 批量ID请求
|
||||
type IdsReq struct {
|
||||
Ids []int `json:"ids" form:"ids"`
|
||||
}
|
||||
|
||||
// GetAuthorityId 根据角色ID获取结构
|
||||
type GetAuthorityId struct {
|
||||
AuthorityId uint `json:"authorityId" form:"authorityId"` // 角色ID
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package example
|
||||
|
||||
import "time"
|
||||
|
||||
// AttachmentCategoryInfo 附件分类信息
|
||||
type AttachmentCategoryInfo struct {
|
||||
ID uint `json:"ID"`
|
||||
Name string `json:"name"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
Children []AttachmentCategoryInfo `json:"children,omitempty"`
|
||||
}
|
||||
|
||||
// CreateAttachmentCategoryRequest 创建附件分类请求
|
||||
type CreateAttachmentCategoryRequest struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
ParentID *uint `json:"parentId"`
|
||||
}
|
||||
|
||||
// UpdateAttachmentCategoryRequest 更新附件分类请求
|
||||
type UpdateAttachmentCategoryRequest struct {
|
||||
ID uint `json:"ID" binding:"required"`
|
||||
Name string `json:"name"`
|
||||
ParentID *uint `json:"parentId"`
|
||||
}
|
||||
|
||||
// GetAttachmentCategoryListRequest 获取附件分类列表请求
|
||||
type GetAttachmentCategoryListRequest struct {
|
||||
Page int `json:"page" form:"page"`
|
||||
PageSize int `json:"pageSize" form:"pageSize"`
|
||||
ClassId int `json:"classId" form:"classId"`
|
||||
}
|
||||
|
||||
// GetAttachmentCategoryListReply 获取附件分类列表响应
|
||||
type GetAttachmentCategoryListReply struct {
|
||||
List []AttachmentCategoryInfo `json:"list"`
|
||||
Total int64 `json:"total"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"pageSize"`
|
||||
}
|
||||
|
||||
// AttachmentCategoryResponse 附件分类响应
|
||||
type AttachmentCategoryResponse struct {
|
||||
Category AttachmentCategoryInfo `json:"category"`
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package example
|
||||
|
||||
import "time"
|
||||
|
||||
// FileInfo 文件信息
|
||||
type FileInfo struct {
|
||||
ID uint `json:"ID"`
|
||||
FileName string `json:"fileName"`
|
||||
FileMd5 string `json:"fileMd5"`
|
||||
FilePath string `json:"filePath"`
|
||||
ChunkTotal int `json:"chunkTotal"`
|
||||
IsFinish bool `json:"isFinish"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
}
|
||||
|
||||
// FileChunkInfo 文件分片信息
|
||||
type FileChunkInfo struct {
|
||||
ID uint `json:"ID"`
|
||||
ExaFileID uint `json:"exaFileId"`
|
||||
FileChunkNumber int `json:"fileChunkNumber"`
|
||||
FileChunkPath string `json:"fileChunkPath"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
}
|
||||
|
||||
// BreakpointContinueRequest 断点续传请求
|
||||
type BreakpointContinueRequest struct {
|
||||
FileName string `json:"fileName" form:"fileName" binding:"required"`
|
||||
FileMd5 string `json:"fileMd5" form:"fileMd5" binding:"required"`
|
||||
ChunkNumber int `json:"chunkNumber" form:"chunkNumber"`
|
||||
ChunkTotal int `json:"chunkTotal" form:"chunkTotal"`
|
||||
}
|
||||
|
||||
// FindFileRequest 查找文件请求
|
||||
type FindFileRequest struct {
|
||||
FileMd5 string `json:"fileMd5" form:"fileMd5" binding:"required"`
|
||||
}
|
||||
|
||||
// FilePathResponse 文件路径响应
|
||||
type FilePathResponse struct {
|
||||
FilePath string `json:"filePath"`
|
||||
}
|
||||
|
||||
// FileInfoResponse 文件信息响应
|
||||
type FileInfoResponse struct {
|
||||
File FileInfo `json:"file"`
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package example
|
||||
|
||||
import "time"
|
||||
|
||||
// CustomerInfo 客户信息
|
||||
type CustomerInfo struct {
|
||||
ID uint `json:"ID"`
|
||||
CustomerName string `json:"customerName"`
|
||||
CustomerPhoneData string `json:"customerPhoneData"`
|
||||
SysUserID uint `json:"sysUserId"`
|
||||
SysUserAuthorityID uint `json:"sysUserAuthorityId"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
}
|
||||
|
||||
// CreateCustomerRequest 创建客户请求
|
||||
type CreateCustomerRequest struct {
|
||||
CustomerName string `json:"customerName" binding:"required"`
|
||||
CustomerPhoneData string `json:"customerPhoneData"`
|
||||
SysUserID uint `json:"sysUserId"`
|
||||
SysUserAuthorityID uint `json:"sysUserAuthorityId"`
|
||||
}
|
||||
|
||||
// UpdateCustomerRequest 更新客户请求
|
||||
type UpdateCustomerRequest struct {
|
||||
ID uint `json:"ID" binding:"required"`
|
||||
CustomerName string `json:"customerName"`
|
||||
CustomerPhoneData string `json:"customerPhoneData"`
|
||||
SysUserID uint `json:"sysUserId"`
|
||||
SysUserAuthorityID uint `json:"sysUserAuthorityId"`
|
||||
}
|
||||
|
||||
// GetCustomerListRequest 获取客户列表请求
|
||||
type GetCustomerListRequest struct {
|
||||
Page int `json:"page" form:"page"`
|
||||
PageSize int `json:"pageSize" form:"pageSize"`
|
||||
CustomerName string `json:"customerName" form:"customerName"`
|
||||
}
|
||||
|
||||
// GetCustomerListReply 获取客户列表响应
|
||||
type GetCustomerListReply struct {
|
||||
List []CustomerInfo `json:"list"`
|
||||
Total int64 `json:"total"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"pageSize"`
|
||||
}
|
||||
|
||||
// CustomerResponse 客户响应
|
||||
type CustomerResponse struct {
|
||||
Customer CustomerInfo `json:"customer"`
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package example
|
||||
|
||||
import "time"
|
||||
|
||||
// FileUploadInfo 文件上传信息
|
||||
type FileUploadInfo struct {
|
||||
ID uint `json:"ID"`
|
||||
Name string `json:"name"`
|
||||
Url string `json:"url"`
|
||||
Tag string `json:"tag"`
|
||||
Key string `json:"key"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
}
|
||||
|
||||
// UploadFileRequest 上传文件请求
|
||||
type UploadFileRequest struct {
|
||||
Tag string `json:"tag" form:"tag"`
|
||||
}
|
||||
|
||||
// GetFileListRequest 获取文件列表请求
|
||||
type GetFileListRequest struct {
|
||||
Page int `json:"page" form:"page"`
|
||||
PageSize int `json:"pageSize" form:"pageSize"`
|
||||
}
|
||||
|
||||
// GetFileListReply 获取文件列表响应
|
||||
type GetFileListReply struct {
|
||||
List []FileUploadInfo `json:"list"`
|
||||
Total int64 `json:"total"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"pageSize"`
|
||||
}
|
||||
|
||||
// FileResponse 文件响应
|
||||
type FileResponse struct {
|
||||
File FileUploadInfo `json:"file"`
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package system
|
||||
|
||||
// CreateAuthorityRequest 创建角色请求
|
||||
type CreateAuthorityRequest struct {
|
||||
AuthorityId uint `json:"authorityId" binding:"required"`
|
||||
AuthorityName string `json:"authorityName" binding:"required"`
|
||||
ParentId *uint `json:"parentId"`
|
||||
DefaultRouter string `json:"defaultRouter"`
|
||||
}
|
||||
|
||||
// UpdateAuthorityRequest 更新角色请求
|
||||
type UpdateAuthorityRequest struct {
|
||||
AuthorityId uint `json:"authorityId" binding:"required"`
|
||||
AuthorityName string `json:"authorityName"`
|
||||
ParentId *uint `json:"parentId"`
|
||||
DefaultRouter string `json:"defaultRouter"`
|
||||
}
|
||||
|
||||
// DeleteAuthorityRequest 删除角色请求
|
||||
type DeleteAuthorityRequest struct {
|
||||
AuthorityId uint `json:"authorityId" binding:"required"`
|
||||
}
|
||||
|
||||
// CopyAuthorityRequest 复制角色请求
|
||||
type CopyAuthorityRequest struct {
|
||||
OldAuthorityId uint `json:"oldAuthorityId" binding:"required"`
|
||||
Authority AuthorityInfo `json:"authority" binding:"required"`
|
||||
}
|
||||
|
||||
// SetDataAuthorityRequest 设置数据权限请求
|
||||
type SetDataAuthorityRequest struct {
|
||||
AuthorityId uint `json:"authorityId" binding:"required"`
|
||||
DataAuthorityId []AuthorityInfo `json:"dataAuthorityId"`
|
||||
}
|
||||
|
||||
// GetAuthorityListRequest 获取角色列表请求
|
||||
type GetAuthorityListRequest struct {
|
||||
Page int `json:"page" form:"page"`
|
||||
PageSize int `json:"pageSize" form:"pageSize"`
|
||||
}
|
||||
|
||||
// GetAuthorityListReply 获取角色列表响应
|
||||
type GetAuthorityListReply struct {
|
||||
List []AuthorityInfo `json:"list"`
|
||||
Total int64 `json:"total"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"pageSize"`
|
||||
}
|
||||
|
||||
// AuthorityResponse 角色响应
|
||||
type AuthorityResponse struct {
|
||||
Authority AuthorityInfo `json:"authority"`
|
||||
}
|
||||
|
||||
// AuthorityCopyResponse 复制角色响应
|
||||
type AuthorityCopyResponse struct {
|
||||
Authority AuthorityInfo `json:"authority"`
|
||||
OldAuthorityId uint `json:"oldAuthorityId"`
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package system
|
||||
|
||||
// AuthorityBtnRequest 角色按钮请求
|
||||
type AuthorityBtnRequest struct {
|
||||
MenuID uint `json:"menuID"`
|
||||
AuthorityId uint `json:"authorityId"`
|
||||
Selected []uint `json:"selected"`
|
||||
}
|
||||
|
||||
// AuthorityBtnResponse 角色按钮响应
|
||||
type AuthorityBtnResponse struct {
|
||||
Selected []uint `json:"selected"`
|
||||
}
|
||||
@@ -0,0 +1,291 @@
|
||||
package system
|
||||
|
||||
// DataSource 数据源
|
||||
type DataSource struct {
|
||||
DBName string `json:"dbName"`
|
||||
Table string `json:"table"`
|
||||
Label string `json:"label"`
|
||||
Value string `json:"value"`
|
||||
Association int `json:"association"` // 关联关系 1 一对一 2 一对多
|
||||
HasDeletedAt bool `json:"hasDeletedAt"`
|
||||
}
|
||||
|
||||
// AutoCodeField 自动代码字段
|
||||
type AutoCodeField struct {
|
||||
FieldName string `json:"fieldName"` // Field名
|
||||
FieldDesc string `json:"fieldDesc"` // 中文名
|
||||
FieldType string `json:"fieldType"` // Field数据类型
|
||||
FieldJson string `json:"fieldJson"` // FieldJson
|
||||
DataTypeLong string `json:"dataTypeLong"` // 数据库字段长度
|
||||
Comment string `json:"comment"` // 数据库字段描述
|
||||
ColumnName string `json:"columnName"` // 数据库字段
|
||||
FieldSearchType string `json:"fieldSearchType"` // 搜索条件
|
||||
FieldSearchHide bool `json:"fieldSearchHide"` // 是否隐藏查询条件
|
||||
DictType string `json:"dictType"` // 字典
|
||||
Form bool `json:"form"` // 是否前端新建/编辑
|
||||
Table bool `json:"table"` // 是否前端表格列
|
||||
Desc bool `json:"desc"` // 是否前端详情
|
||||
Excel bool `json:"excel"` // 是否导入/导出
|
||||
Require bool `json:"require"` // 是否必填
|
||||
DefaultValue string `json:"defaultValue"` // 默认值
|
||||
ErrorText string `json:"errorText"` // 校验失败文字
|
||||
Clearable bool `json:"clearable"` // 是否可清空
|
||||
Sort bool `json:"sort"` // 是否增加排序
|
||||
PrimaryKey bool `json:"primaryKey"` // 是否主键
|
||||
DataSource *DataSource `json:"dataSource"` // 数据源
|
||||
CheckDataSource bool `json:"checkDataSource"` // 是否检查数据源
|
||||
FieldIndexType string `json:"fieldIndexType"` // 索引类型
|
||||
}
|
||||
|
||||
// AutoCodeRequest 自动代码生成请求
|
||||
type AutoCodeRequest struct {
|
||||
Package string `json:"package"`
|
||||
PackageT string `json:"-"`
|
||||
TableName string `json:"tableName"` // 表名
|
||||
BusinessDB string `json:"businessDB"` // 业务数据库
|
||||
StructName string `json:"structName"` // Struct名称
|
||||
PackageName string `json:"packageName"` // 文件名称
|
||||
Description string `json:"description"` // Struct中文名称
|
||||
Abbreviation string `json:"abbreviation"` // Struct简称
|
||||
HumpPackageName string `json:"humpPackageName"` // go文件名称
|
||||
GvaModel bool `json:"gvaModel"` // 是否使用默认Model(保留字段名以兼容前端)
|
||||
AutoMigrate bool `json:"autoMigrate"` // 是否自动迁移表结构
|
||||
AutoCreateResource bool `json:"autoCreateResource"` // 是否自动创建资源标识
|
||||
AutoCreateApiToSql bool `json:"autoCreateApiToSql"` // 是否自动创建api
|
||||
AutoCreateMenuToSql bool `json:"autoCreateMenuToSql"` // 是否自动创建menu
|
||||
AutoCreateBtnAuth bool `json:"autoCreateBtnAuth"` // 是否自动创建按钮权限
|
||||
OnlyTemplate bool `json:"onlyTemplate"` // 是否只生成模板
|
||||
IsTree bool `json:"isTree"` // 是否树形结构
|
||||
TreeJson string `json:"treeJson"` // 展示的树json字段
|
||||
IsAdd bool `json:"isAdd"` // 是否新增
|
||||
Fields []*AutoCodeField `json:"fields"`
|
||||
GenerateWeb bool `json:"generateWeb"` // 是否生成web
|
||||
GenerateServer bool `json:"generateServer"` // 是否生成server
|
||||
Module string `json:"-"`
|
||||
DictTypes []string `json:"-"`
|
||||
PrimaryField *AutoCodeField `json:"primaryField"`
|
||||
DataSourceMap map[string]*DataSource `json:"-"`
|
||||
HasPic bool `json:"-"`
|
||||
HasFile bool `json:"-"`
|
||||
HasTimer bool `json:"-"`
|
||||
NeedSort bool `json:"-"`
|
||||
NeedJSON bool `json:"-"`
|
||||
HasRichText bool `json:"-"`
|
||||
HasDataSource bool `json:"-"`
|
||||
HasSearchTimer bool `json:"-"`
|
||||
HasArray bool `json:"-"`
|
||||
HasExcel bool `json:"-"`
|
||||
CustomMethods []*CustomMethod `json:"customMethods"` // 自定义查询方法
|
||||
HasCustomMethods bool `json:"-"` // 是否有自定义查询方法
|
||||
}
|
||||
|
||||
// CustomMethod 自定义查询方法
|
||||
// 用于在 GORM Gen 生成的代码中添加自定义查询方法
|
||||
type CustomMethod struct {
|
||||
Name string `json:"name"` // 方法名称 (如: FindByName, GetActiveUsers)
|
||||
Description string `json:"description"` // 方法描述
|
||||
ReturnType string `json:"returnType"` // 返回类型: single(单个), list(列表), count(计数), exists(存在检查)
|
||||
Params []*CustomMethodParam `json:"params"` // 方法参数
|
||||
Conditions []*CustomCondition `json:"conditions"` // 查询条件
|
||||
OrderBy string `json:"orderBy"` // 排序字段 (如: created_at DESC)
|
||||
Limit int `json:"limit"` // 限制数量 (0表示不限制)
|
||||
}
|
||||
|
||||
// CustomMethodParam 自定义方法参数
|
||||
type CustomMethodParam struct {
|
||||
Name string `json:"name"` // 参数名称
|
||||
Type string `json:"type"` // 参数类型 (string, int, uint, bool, time.Time等)
|
||||
FieldName string `json:"fieldName"` // 对应的字段名 (用于生成查询条件)
|
||||
}
|
||||
|
||||
// CustomCondition 自定义查询条件
|
||||
type CustomCondition struct {
|
||||
FieldName string `json:"fieldName"` // 字段名
|
||||
Operator string `json:"operator"` // 操作符: eq, neq, gt, gte, lt, lte, like, in, between, isNull, isNotNull
|
||||
ParamName string `json:"paramName"` // 参数名 (对应 CustomMethodParam.Name)
|
||||
}
|
||||
|
||||
// AutoFuncRequest 自动函数生成请求
|
||||
type AutoFuncRequest struct {
|
||||
Package string `json:"package"`
|
||||
FuncName string `json:"funcName"` // 方法名称
|
||||
Router string `json:"router"` // 路由名称
|
||||
FuncDesc string `json:"funcDesc"` // 方法介绍
|
||||
BusinessDB string `json:"businessDB"` // 业务库
|
||||
StructName string `json:"structName"` // Struct名称
|
||||
PackageName string `json:"packageName"` // 文件名称
|
||||
Description string `json:"description"` // Struct中文名称
|
||||
Abbreviation string `json:"abbreviation"` // Struct简称
|
||||
HumpPackageName string `json:"humpPackageName"` // go文件名称
|
||||
Method string `json:"method"` // 方法
|
||||
IsPlugin bool `json:"isPlugin"` // 是否插件
|
||||
IsAuth bool `json:"isAuth"` // 是否鉴权
|
||||
IsPreview bool `json:"isPreview"` // 是否预览
|
||||
IsAi bool `json:"isAi"` // 是否AI
|
||||
ApiFunc string `json:"apiFunc"` // API方法
|
||||
ServerFunc string `json:"serverFunc"` // 服务方法
|
||||
JsFunc string `json:"jsFunc"` // JS方法
|
||||
}
|
||||
|
||||
// InitMenuRequest 初始化菜单请求
|
||||
type InitMenuRequest struct {
|
||||
PlugName string `json:"plugName"`
|
||||
ParentMenu string `json:"parentMenu"`
|
||||
Menus []uint `json:"menus"`
|
||||
}
|
||||
|
||||
// InitApiRequest 初始化API请求
|
||||
type InitApiRequest struct {
|
||||
PlugName string `json:"plugName"`
|
||||
APIs []uint `json:"apis"`
|
||||
}
|
||||
|
||||
// LLMAutoCodeRequest LLM自动代码生成请求
|
||||
type LLMAutoCodeRequest struct {
|
||||
Prompt string `json:"prompt" form:"prompt"` // 提示语
|
||||
Mode string `json:"mode" form:"mode"` // 模式
|
||||
}
|
||||
|
||||
// AutoMcpToolRequest MCP工具生成请求
|
||||
type AutoMcpToolRequest struct {
|
||||
Name string `json:"name"` // 工具名称
|
||||
Description string `json:"description"` // 工具描述
|
||||
InputSchema string `json:"inputSchema"` // 输入模式
|
||||
}
|
||||
|
||||
// SysAutoCodePackageCreateRequest 创建代码包请求
|
||||
type SysAutoCodePackageCreateRequest struct {
|
||||
Desc string `json:"desc"`
|
||||
Label string `json:"label"`
|
||||
Template string `json:"template"`
|
||||
PackageName string `json:"packageName"`
|
||||
}
|
||||
|
||||
// SysAutoHistoryCreateRequest 创建历史记录请求
|
||||
type SysAutoHistoryCreateRequest struct {
|
||||
Table string `json:"tableName"`
|
||||
Package string `json:"package"`
|
||||
Request string `json:"request"`
|
||||
StructName string `json:"structName"`
|
||||
BusinessDB string `json:"businessDb"`
|
||||
Description string `json:"description"`
|
||||
Templates map[string]string `json:"templates"`
|
||||
Injections map[string]string `json:"injections"`
|
||||
ApiIDs []uint `json:"apiIDs"`
|
||||
MenuID uint `json:"menuId"`
|
||||
ExportTemplateID uint `json:"exportTemplateID"`
|
||||
}
|
||||
|
||||
// SysAutoHistoryRollBackRequest 回滚请求
|
||||
type SysAutoHistoryRollBackRequest struct {
|
||||
ID uint `json:"id"`
|
||||
DeleteApi bool `json:"deleteApi"`
|
||||
DeleteMenu bool `json:"deleteMenu"`
|
||||
DeleteTable bool `json:"deleteTable"`
|
||||
}
|
||||
|
||||
// GetByIdRequest 根据ID获取请求
|
||||
type GetByIdRequest struct {
|
||||
ID uint `json:"ID" form:"ID"`
|
||||
}
|
||||
|
||||
// PageInfoRequest 分页请求
|
||||
type PageInfoRequest struct {
|
||||
Page int `json:"page" form:"page"`
|
||||
PageSize int `json:"pageSize" form:"pageSize"`
|
||||
}
|
||||
|
||||
// AutoMcpToolDetailRequest MCP工具详情请求
|
||||
type AutoMcpToolDetailRequest struct {
|
||||
Name string `json:"name" form:"name" binding:"required"`
|
||||
Description string `json:"description" form:"description" binding:"required"`
|
||||
Params []AutoMcpToolParam `json:"params" form:"params"`
|
||||
Response []AutoMcpToolResp `json:"response" form:"response"`
|
||||
}
|
||||
|
||||
// AutoMcpToolParam MCP工具参数
|
||||
type AutoMcpToolParam struct {
|
||||
Name string `json:"name" form:"name" binding:"required"`
|
||||
Description string `json:"description" form:"description" binding:"required"`
|
||||
Type string `json:"type" form:"type" binding:"required"` // string, number, boolean, object, array
|
||||
Required bool `json:"required" form:"required"`
|
||||
Default string `json:"default" form:"default"`
|
||||
}
|
||||
|
||||
// AutoMcpToolResp MCP工具响应
|
||||
type AutoMcpToolResp struct {
|
||||
Type string `json:"type" form:"type" binding:"required"` // text, image
|
||||
}
|
||||
|
||||
// DbResponse 数据库响应
|
||||
type DbResponse struct {
|
||||
Database string `json:"database" gorm:"column:database"`
|
||||
}
|
||||
|
||||
// TableResponse 表响应
|
||||
type TableResponse struct {
|
||||
TableName string `json:"tableName" gorm:"column:table_name"`
|
||||
}
|
||||
|
||||
// ColumnResponse 列响应
|
||||
type ColumnResponse struct {
|
||||
DataType string `json:"dataType" gorm:"column:data_type"`
|
||||
ColumnName string `json:"columnName" gorm:"column:column_name"`
|
||||
DataTypeLong string `json:"dataTypeLong" gorm:"column:data_type_long"`
|
||||
ColumnComment string `json:"columnComment" gorm:"column:column_comment"`
|
||||
PrimaryKey bool `json:"primaryKey" gorm:"column:primary_key"`
|
||||
}
|
||||
|
||||
// AutoCodeHistoryInfo 自动代码历史信息
|
||||
type AutoCodeHistoryInfo struct {
|
||||
ID uint `json:"ID"`
|
||||
Table string `json:"tableName"`
|
||||
Package string `json:"package"`
|
||||
Request string `json:"request"`
|
||||
StructName string `json:"structName"`
|
||||
BusinessDB string `json:"businessDB"`
|
||||
Description string `json:"description"`
|
||||
Templates map[string]string `json:"templates"`
|
||||
Injections map[string]string `json:"injections"`
|
||||
ApiIDs []uint `json:"apiIDs"`
|
||||
MenuID uint `json:"menuID"`
|
||||
ExportTemplateID uint `json:"exportTemplateID"`
|
||||
}
|
||||
|
||||
// AutoCodePackageInfo 自动代码包信息
|
||||
type AutoCodePackageInfo struct {
|
||||
ID uint `json:"ID"`
|
||||
Desc string `json:"desc"`
|
||||
Label string `json:"label"`
|
||||
Template string `json:"template"`
|
||||
PackageName string `json:"packageName"`
|
||||
Module string `json:"module"`
|
||||
}
|
||||
|
||||
// GetAutoCodeHistoryListRequest 获取自动代码历史列表请求
|
||||
type GetAutoCodeHistoryListRequest struct {
|
||||
Page int `json:"page" form:"page"`
|
||||
PageSize int `json:"pageSize" form:"pageSize"`
|
||||
}
|
||||
|
||||
// GetAutoCodeHistoryListReply 获取自动代码历史列表响应
|
||||
type GetAutoCodeHistoryListReply struct {
|
||||
List []AutoCodeHistoryInfo `json:"list"`
|
||||
Total int64 `json:"total"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"pageSize"`
|
||||
}
|
||||
|
||||
// GetAutoCodePackageListRequest 获取自动代码包列表请求
|
||||
type GetAutoCodePackageListRequest struct {
|
||||
Page int `json:"page" form:"page"`
|
||||
PageSize int `json:"pageSize" form:"pageSize"`
|
||||
}
|
||||
|
||||
// GetAutoCodePackageListReply 获取自动代码包列表响应
|
||||
type GetAutoCodePackageListReply struct {
|
||||
List []AutoCodePackageInfo `json:"list"`
|
||||
Total int64 `json:"total"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"pageSize"`
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package system
|
||||
|
||||
// CasbinInfo Casbin信息结构
|
||||
type CasbinInfo struct {
|
||||
Path string `json:"path"` // 路径
|
||||
Method string `json:"method"` // 方法
|
||||
}
|
||||
|
||||
// UpdateCasbinRequest 更新Casbin请求
|
||||
type UpdateCasbinRequest struct {
|
||||
AuthorityId uint `json:"authorityId"` // 权限id
|
||||
CasbinInfos []CasbinInfo `json:"casbinInfos"`
|
||||
}
|
||||
|
||||
// GetPolicyPathByAuthorityIdRequest 根据权限ID获取策略路径请求
|
||||
type GetPolicyPathByAuthorityIdRequest struct {
|
||||
AuthorityId uint `json:"authorityId" form:"authorityId"`
|
||||
}
|
||||
|
||||
// PolicyPathResponse 策略路径响应
|
||||
type PolicyPathResponse struct {
|
||||
Paths []CasbinInfo `json:"paths"`
|
||||
}
|
||||
|
||||
// DefaultCasbin 默认Casbin规则
|
||||
func DefaultCasbin() []CasbinInfo {
|
||||
return []CasbinInfo{
|
||||
{Path: "/menu/getMenu", Method: "POST"},
|
||||
{Path: "/jwt/jsonInBlacklist", Method: "POST"},
|
||||
{Path: "/base/login", Method: "POST"},
|
||||
{Path: "/user/changePassword", Method: "POST"},
|
||||
{Path: "/user/setUserAuthority", Method: "POST"},
|
||||
{Path: "/user/getUserInfo", Method: "GET"},
|
||||
{Path: "/user/setSelfInfo", Method: "PUT"},
|
||||
{Path: "/fileUploadAndDownload/upload", Method: "POST"},
|
||||
{Path: "/sysDictionary/findSysDictionary", Method: "GET"},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package system
|
||||
|
||||
// DictionaryInfo 字典信息
|
||||
type DictionaryInfo struct {
|
||||
ID uint `json:"ID"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
Status *bool `json:"status"`
|
||||
Desc string `json:"desc"`
|
||||
Details []DictionaryDetailInfo `json:"sysDictionaryDetails,omitempty"`
|
||||
}
|
||||
|
||||
// DictionaryDetailInfo 字典详情信息
|
||||
type DictionaryDetailInfo struct {
|
||||
ID uint `json:"ID"`
|
||||
Label string `json:"label"`
|
||||
Value string `json:"value"`
|
||||
Extend string `json:"extend"`
|
||||
Status *bool `json:"status"`
|
||||
Sort int `json:"sort"`
|
||||
SysDictionaryID int `json:"sysDictionaryID"`
|
||||
ParentID *uint `json:"parentID,omitempty"`
|
||||
Children []DictionaryDetailInfo `json:"children,omitempty"`
|
||||
}
|
||||
|
||||
// CreateDictionaryRequest 创建字典请求
|
||||
type CreateDictionaryRequest struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
Type string `json:"type" binding:"required"`
|
||||
Status *bool `json:"status"`
|
||||
Desc string `json:"desc"`
|
||||
}
|
||||
|
||||
// UpdateDictionaryRequest 更新字典请求
|
||||
type UpdateDictionaryRequest struct {
|
||||
ID uint `json:"ID" binding:"required"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
Status *bool `json:"status"`
|
||||
Desc string `json:"desc"`
|
||||
}
|
||||
|
||||
// GetDictionaryListRequest 获取字典列表请求
|
||||
type GetDictionaryListRequest struct {
|
||||
Page int `json:"page" form:"page"`
|
||||
PageSize int `json:"pageSize" form:"pageSize"`
|
||||
Name string `json:"name" form:"name"`
|
||||
}
|
||||
|
||||
// GetDictionaryListReply 获取字典列表响应
|
||||
type GetDictionaryListReply struct {
|
||||
List []DictionaryInfo `json:"list"`
|
||||
Total int64 `json:"total"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"pageSize"`
|
||||
}
|
||||
|
||||
// FindDictionaryRequest 查找字典请求
|
||||
type FindDictionaryRequest struct {
|
||||
ID uint `json:"ID" form:"ID"`
|
||||
Type string `json:"type" form:"type"`
|
||||
}
|
||||
|
||||
// ImportDictionaryRequest 导入字典请求
|
||||
type ImportDictionaryRequest struct {
|
||||
Json string `json:"json" binding:"required"`
|
||||
}
|
||||
|
||||
// CreateDictionaryDetailRequest 创建字典详情请求
|
||||
type CreateDictionaryDetailRequest struct {
|
||||
Label string `json:"label" binding:"required"`
|
||||
Value string `json:"value" binding:"required"`
|
||||
Extend string `json:"extend"`
|
||||
Status *bool `json:"status"`
|
||||
Sort int `json:"sort"`
|
||||
SysDictionaryID int `json:"sysDictionaryID" binding:"required"`
|
||||
ParentID *uint `json:"parentID"`
|
||||
}
|
||||
|
||||
// UpdateDictionaryDetailRequest 更新字典详情请求
|
||||
type UpdateDictionaryDetailRequest struct {
|
||||
ID uint `json:"ID" binding:"required"`
|
||||
Label string `json:"label" binding:"required"`
|
||||
Value string `json:"value" binding:"required"`
|
||||
Extend string `json:"extend"`
|
||||
Status *bool `json:"status"`
|
||||
Sort int `json:"sort"`
|
||||
SysDictionaryID int `json:"sysDictionaryID" binding:"required"`
|
||||
ParentID *uint `json:"parentID"`
|
||||
}
|
||||
|
||||
// GetDictionaryDetailListRequest 获取字典详情列表请求
|
||||
type GetDictionaryDetailListRequest struct {
|
||||
Page int `json:"page" form:"page"`
|
||||
PageSize int `json:"pageSize" form:"pageSize"`
|
||||
SysDictionaryID int `json:"sysDictionaryID" form:"sysDictionaryID"`
|
||||
ParentID *uint `json:"parentID" form:"parentID"`
|
||||
Level *int `json:"level" form:"level"`
|
||||
}
|
||||
|
||||
// GetDictionaryDetailListReply 获取字典详情列表响应
|
||||
type GetDictionaryDetailListReply struct {
|
||||
List []DictionaryDetailInfo `json:"list"`
|
||||
Total int64 `json:"total"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"pageSize"`
|
||||
}
|
||||
|
||||
// GetDictionaryDetailsByParentRequest 根据父级ID获取字典详情请求
|
||||
type GetDictionaryDetailsByParentRequest struct {
|
||||
SysDictionaryID int `json:"sysDictionaryID" form:"sysDictionaryID" binding:"required"`
|
||||
ParentID *uint `json:"parentID" form:"parentID"`
|
||||
IncludeChildren bool `json:"includeChildren" form:"includeChildren"`
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package system
|
||||
|
||||
import "time"
|
||||
|
||||
// ErrorInfo 错误信息
|
||||
type ErrorInfo struct {
|
||||
ID uint `json:"ID"`
|
||||
Form string `json:"form"`
|
||||
Info string `json:"info"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
}
|
||||
|
||||
// CreateErrorRequest 创建错误请求
|
||||
type CreateErrorRequest struct {
|
||||
Form string `json:"form"`
|
||||
Info string `json:"info"`
|
||||
}
|
||||
|
||||
// GetErrorListRequest 获取错误列表请求
|
||||
type GetErrorListRequest struct {
|
||||
Page int `json:"page" form:"page"`
|
||||
PageSize int `json:"pageSize" form:"pageSize"`
|
||||
Form *string `json:"form" form:"form"`
|
||||
Info *string `json:"info" form:"info"`
|
||||
CreatedAtRange []time.Time `json:"createdAtRange" form:"createdAtRange[]"`
|
||||
}
|
||||
|
||||
// GetErrorListReply 获取错误列表响应
|
||||
type GetErrorListReply struct {
|
||||
List []ErrorInfo `json:"list"`
|
||||
Total int64 `json:"total"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"pageSize"`
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package system
|
||||
|
||||
import "time"
|
||||
|
||||
// ExportTemplateInfo 导出模板信息
|
||||
type ExportTemplateInfo struct {
|
||||
ID uint `json:"ID"`
|
||||
Name string `json:"name"`
|
||||
TableName string `json:"tableName"`
|
||||
TemplateID string `json:"templateID"`
|
||||
TemplateInfo string `json:"templateInfo"`
|
||||
Limit int `json:"limit"`
|
||||
Order string `json:"order"`
|
||||
Conditions []ExportTemplateCondition `json:"conditions,omitempty"`
|
||||
JoinTemplate []ExportTemplateJoin `json:"joinTemplate,omitempty"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
}
|
||||
|
||||
// ExportTemplateCondition 导出模板条件
|
||||
type ExportTemplateCondition struct {
|
||||
ID uint `json:"ID"`
|
||||
Column string `json:"column"`
|
||||
Operator string `json:"operator"`
|
||||
From string `json:"from"`
|
||||
}
|
||||
|
||||
// ExportTemplateJoin 导出模板关联
|
||||
type ExportTemplateJoin struct {
|
||||
ID uint `json:"ID"`
|
||||
TableName string `json:"tableName"`
|
||||
JoinType string `json:"joinType"`
|
||||
On string `json:"on"`
|
||||
}
|
||||
|
||||
// CreateExportTemplateRequest 创建导出模板请求
|
||||
type CreateExportTemplateRequest struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
TableName string `json:"tableName" binding:"required"`
|
||||
TemplateID string `json:"templateID"`
|
||||
TemplateInfo string `json:"templateInfo"`
|
||||
Limit int `json:"limit"`
|
||||
Order string `json:"order"`
|
||||
Conditions []ExportTemplateCondition `json:"conditions,omitempty"`
|
||||
JoinTemplate []ExportTemplateJoin `json:"joinTemplate,omitempty"`
|
||||
}
|
||||
|
||||
// UpdateExportTemplateRequest 更新导出模板请求
|
||||
type UpdateExportTemplateRequest struct {
|
||||
ID uint `json:"ID" binding:"required"`
|
||||
Name string `json:"name"`
|
||||
TableName string `json:"tableName"`
|
||||
TemplateID string `json:"templateID"`
|
||||
TemplateInfo string `json:"templateInfo"`
|
||||
Limit int `json:"limit"`
|
||||
Order string `json:"order"`
|
||||
Conditions []ExportTemplateCondition `json:"conditions,omitempty"`
|
||||
JoinTemplate []ExportTemplateJoin `json:"joinTemplate,omitempty"`
|
||||
}
|
||||
|
||||
// GetExportTemplateListRequest 获取导出模板列表请求
|
||||
type GetExportTemplateListRequest struct {
|
||||
Page int `json:"page" form:"page"`
|
||||
PageSize int `json:"pageSize" form:"pageSize"`
|
||||
Name string `json:"name" form:"name"`
|
||||
TableName string `json:"tableName" form:"tableName"`
|
||||
StartCreatedAt *time.Time `json:"startCreatedAt" form:"startCreatedAt"`
|
||||
EndCreatedAt *time.Time `json:"endCreatedAt" form:"endCreatedAt"`
|
||||
}
|
||||
|
||||
// GetExportTemplateListReply 获取导出模板列表响应
|
||||
type GetExportTemplateListReply struct {
|
||||
List []ExportTemplateInfo `json:"list"`
|
||||
Total int64 `json:"total"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"pageSize"`
|
||||
}
|
||||
|
||||
// ExportExcelRequest 导出Excel请求
|
||||
type ExportExcelRequest struct {
|
||||
TemplateID string `json:"templateID" form:"templateID" binding:"required"`
|
||||
Values map[string]interface{} `json:"values" form:"values"`
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
// InitDBRequest 初始化数据库请求
|
||||
type InitDBRequest struct {
|
||||
AdminPassword string `json:"adminPassword" binding:"required"`
|
||||
DBType string `json:"dbType"`
|
||||
Host string `json:"host"`
|
||||
Port string `json:"port"`
|
||||
UserName string `json:"userName"`
|
||||
Password string `json:"password"`
|
||||
DBName string `json:"dbName" binding:"required"`
|
||||
DBPath string `json:"dbPath"`
|
||||
Template string `json:"template"`
|
||||
}
|
||||
|
||||
// MysqlEmptyDsn MySQL空数据库建库链接
|
||||
func (i *InitDBRequest) MysqlEmptyDsn() string {
|
||||
if i.Host == "" {
|
||||
i.Host = "127.0.0.1"
|
||||
}
|
||||
if i.Port == "" {
|
||||
i.Port = "3306"
|
||||
}
|
||||
return fmt.Sprintf("%s:%s@tcp(%s:%s)/", i.UserName, i.Password, i.Host, i.Port)
|
||||
}
|
||||
|
||||
// PgsqlEmptyDsn PostgreSQL空数据库建库链接
|
||||
func (i *InitDBRequest) PgsqlEmptyDsn() string {
|
||||
if i.Host == "" {
|
||||
i.Host = "127.0.0.1"
|
||||
}
|
||||
if i.Port == "" {
|
||||
i.Port = "5432"
|
||||
}
|
||||
return "host=" + i.Host + " user=" + i.UserName + " password=" + i.Password + " port=" + i.Port + " dbname=" + "postgres" + " " + "sslmode=disable TimeZone=Asia/Shanghai"
|
||||
}
|
||||
|
||||
// SqliteEmptyDsn SQLite空数据库建库链接
|
||||
func (i *InitDBRequest) SqliteEmptyDsn() string {
|
||||
separator := string(os.PathSeparator)
|
||||
return i.DBPath + separator + i.DBName + ".db"
|
||||
}
|
||||
|
||||
// MssqlEmptyDsn MSSQL空数据库建库链接
|
||||
func (i *InitDBRequest) MssqlEmptyDsn() string {
|
||||
return "sqlserver://" + i.UserName + ":" + i.Password + "@" + i.Host + ":" + i.Port + "?database=" + i.DBName + "&encrypt=disable"
|
||||
}
|
||||
|
||||
// CheckDBResponse 检查数据库响应
|
||||
type CheckDBResponse struct {
|
||||
NeedInit bool `json:"needInit"`
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
jwt "github.com/golang-jwt/jwt/v5"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// CustomClaims JWT自定义声明结构
|
||||
type CustomClaims struct {
|
||||
BaseClaims
|
||||
BufferTime int64
|
||||
jwt.RegisteredClaims
|
||||
}
|
||||
|
||||
// BaseClaims 基础声明
|
||||
type BaseClaims struct {
|
||||
UUID uuid.UUID
|
||||
ID uint
|
||||
Username string
|
||||
NickName string
|
||||
AuthorityId uint
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package system
|
||||
|
||||
// MenuInfo 菜单信息
|
||||
type MenuInfo struct {
|
||||
ID uint `json:"ID"`
|
||||
ParentId uint `json:"parentId"`
|
||||
Path string `json:"path"`
|
||||
Name string `json:"name"`
|
||||
Component string `json:"component"`
|
||||
Sort int `json:"sort"`
|
||||
Hidden bool `json:"hidden"`
|
||||
Meta MenuMeta `json:"meta"`
|
||||
Children []MenuInfo `json:"children,omitempty"`
|
||||
}
|
||||
|
||||
// MenuMeta 菜单元信息
|
||||
type MenuMeta struct {
|
||||
Title string `json:"title"`
|
||||
Icon string `json:"icon"`
|
||||
KeepAlive bool `json:"keepAlive"`
|
||||
DefaultMenu bool `json:"defaultMenu"`
|
||||
CloseTab bool `json:"closeTab"`
|
||||
}
|
||||
|
||||
// BaseMenuInfo 基础菜单信息
|
||||
type BaseMenuInfo struct {
|
||||
ID uint `json:"ID"`
|
||||
ParentId uint `json:"parentId"`
|
||||
Path string `json:"path"`
|
||||
Name string `json:"name"`
|
||||
Component string `json:"component"`
|
||||
Sort int `json:"sort"`
|
||||
Hidden bool `json:"hidden"`
|
||||
Meta MenuMeta `json:"meta"`
|
||||
MenuBtn []MenuBtnInfo `json:"menuBtn,omitempty"`
|
||||
Parameters []MenuParamInfo `json:"parameters,omitempty"`
|
||||
Children []BaseMenuInfo `json:"children,omitempty"`
|
||||
}
|
||||
|
||||
// MenuBtnInfo 菜单按钮信息
|
||||
type MenuBtnInfo struct {
|
||||
ID uint `json:"ID"`
|
||||
Name string `json:"name"`
|
||||
Desc string `json:"desc"`
|
||||
}
|
||||
|
||||
// MenuParamInfo 菜单参数信息
|
||||
type MenuParamInfo struct {
|
||||
ID uint `json:"ID"`
|
||||
Type string `json:"type"`
|
||||
Key string `json:"key"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
// AddMenuAuthorityRequest 添加菜单权限请求
|
||||
type AddMenuAuthorityRequest struct {
|
||||
Menus []BaseMenuInfo `json:"menus"`
|
||||
AuthorityId uint `json:"authorityId"`
|
||||
}
|
||||
|
||||
// CreateMenuRequest 创建菜单请求
|
||||
type CreateMenuRequest struct {
|
||||
ParentId uint `json:"parentId"`
|
||||
Path string `json:"path" binding:"required"`
|
||||
Name string `json:"name" binding:"required"`
|
||||
Component string `json:"component"`
|
||||
Sort int `json:"sort"`
|
||||
Hidden bool `json:"hidden"`
|
||||
Meta MenuMeta `json:"meta"`
|
||||
MenuBtn []MenuBtnInfo `json:"menuBtn,omitempty"`
|
||||
Parameters []MenuParamInfo `json:"parameters,omitempty"`
|
||||
}
|
||||
|
||||
// UpdateMenuRequest 更新菜单请求
|
||||
type UpdateMenuRequest struct {
|
||||
ID uint `json:"ID" binding:"required"`
|
||||
ParentId uint `json:"parentId"`
|
||||
Path string `json:"path"`
|
||||
Name string `json:"name"`
|
||||
Component string `json:"component"`
|
||||
Sort int `json:"sort"`
|
||||
Hidden bool `json:"hidden"`
|
||||
Meta MenuMeta `json:"meta"`
|
||||
MenuBtn []MenuBtnInfo `json:"menuBtn,omitempty"`
|
||||
Parameters []MenuParamInfo `json:"parameters,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package system
|
||||
|
||||
// MenusResponse 菜单列表响应
|
||||
type MenusResponse struct {
|
||||
Menus []MenuInfo `json:"menus"`
|
||||
}
|
||||
|
||||
// BaseMenusResponse 基础菜单列表响应
|
||||
type BaseMenusResponse struct {
|
||||
Menus []BaseMenuInfo `json:"menus"`
|
||||
}
|
||||
|
||||
// BaseMenuResponse 基础菜单响应
|
||||
type BaseMenuResponse struct {
|
||||
Menu BaseMenuInfo `json:"menu"`
|
||||
}
|
||||
|
||||
// GetMenuTreeReply 获取菜单树响应
|
||||
type GetMenuTreeReply struct {
|
||||
Menus []MenuInfo `json:"menus"`
|
||||
}
|
||||
|
||||
// GetBaseMenuTreeReply 获取基础菜单树响应
|
||||
type GetBaseMenuTreeReply struct {
|
||||
Menus []BaseMenuInfo `json:"menus"`
|
||||
}
|
||||
|
||||
// GetMenuByIdReply 根据ID获取菜单响应
|
||||
type GetMenuByIdReply struct {
|
||||
Menu BaseMenuInfo `json:"menu"`
|
||||
}
|
||||
|
||||
// GetMenuAuthorityReply 获取菜单权限响应
|
||||
type GetMenuAuthorityReply struct {
|
||||
Menus []BaseMenuInfo `json:"menus"`
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package system
|
||||
|
||||
import "time"
|
||||
|
||||
// OperationRecordInfo 操作记录信息
|
||||
type OperationRecordInfo struct {
|
||||
ID uint `json:"ID"`
|
||||
Ip string `json:"ip"`
|
||||
Method string `json:"method"`
|
||||
Path string `json:"path"`
|
||||
Status int `json:"status"`
|
||||
Latency int64 `json:"latency"`
|
||||
Agent string `json:"agent"`
|
||||
ErrorMessage string `json:"error_message"`
|
||||
Body string `json:"body"`
|
||||
Resp string `json:"resp"`
|
||||
UserID uint `json:"user_id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
User UserInfo `json:"user,omitempty"`
|
||||
}
|
||||
|
||||
// CreateOperationRecordRequest 创建操作记录请求
|
||||
type CreateOperationRecordRequest struct {
|
||||
Ip string `json:"ip"`
|
||||
Method string `json:"method"`
|
||||
Path string `json:"path"`
|
||||
Status int `json:"status"`
|
||||
Latency int64 `json:"latency"`
|
||||
Agent string `json:"agent"`
|
||||
ErrorMessage string `json:"error_message"`
|
||||
Body string `json:"body"`
|
||||
Resp string `json:"resp"`
|
||||
UserID uint `json:"user_id"`
|
||||
}
|
||||
|
||||
// GetOperationRecordListRequest 获取操作记录列表请求
|
||||
type GetOperationRecordListRequest struct {
|
||||
Page int `json:"page" form:"page"`
|
||||
PageSize int `json:"pageSize" form:"pageSize"`
|
||||
Method string `json:"method" form:"method"`
|
||||
Path string `json:"path" form:"path"`
|
||||
Status int `json:"status" form:"status"`
|
||||
UserID uint `json:"user_id" form:"user_id"`
|
||||
}
|
||||
|
||||
// GetOperationRecordListReply 获取操作记录列表响应
|
||||
type GetOperationRecordListReply struct {
|
||||
List []OperationRecordInfo `json:"list"`
|
||||
Total int64 `json:"total"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"pageSize"`
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package system
|
||||
|
||||
import "time"
|
||||
|
||||
// ParamsInfo 参数信息
|
||||
type ParamsInfo struct {
|
||||
ID uint `json:"ID"`
|
||||
Name string `json:"name"`
|
||||
Key string `json:"key"`
|
||||
Value string `json:"value"`
|
||||
Desc string `json:"desc"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
}
|
||||
|
||||
// CreateParamsRequest 创建参数请求
|
||||
type CreateParamsRequest struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
Key string `json:"key" binding:"required"`
|
||||
Value string `json:"value"`
|
||||
Desc string `json:"desc"`
|
||||
}
|
||||
|
||||
// UpdateParamsRequest 更新参数请求
|
||||
type UpdateParamsRequest struct {
|
||||
ID uint `json:"ID" binding:"required"`
|
||||
Name string `json:"name"`
|
||||
Key string `json:"key"`
|
||||
Value string `json:"value"`
|
||||
Desc string `json:"desc"`
|
||||
}
|
||||
|
||||
// GetParamsListRequest 获取参数列表请求
|
||||
type GetParamsListRequest struct {
|
||||
Page int `json:"page" form:"page"`
|
||||
PageSize int `json:"pageSize" form:"pageSize"`
|
||||
Name string `json:"name" form:"name"`
|
||||
Key string `json:"key" form:"key"`
|
||||
StartCreatedAt *time.Time `json:"startCreatedAt" form:"startCreatedAt"`
|
||||
EndCreatedAt *time.Time `json:"endCreatedAt" form:"endCreatedAt"`
|
||||
}
|
||||
|
||||
// GetParamsListReply 获取参数列表响应
|
||||
type GetParamsListReply struct {
|
||||
List []ParamsInfo `json:"list"`
|
||||
Total int64 `json:"total"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"pageSize"`
|
||||
}
|
||||
|
||||
// GetParamsByKeyRequest 根据Key获取参数请求
|
||||
type GetParamsByKeyRequest struct {
|
||||
Key string `json:"key" form:"key" binding:"required"`
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package system
|
||||
|
||||
// ServerInfo 服务器信息
|
||||
type ServerInfo struct {
|
||||
CPU CPUInfo `json:"cpu"`
|
||||
RAM RAMInfo `json:"ram"`
|
||||
Disk DiskInfo `json:"disk"`
|
||||
OS OSInfo `json:"os"`
|
||||
}
|
||||
|
||||
// CPUInfo CPU信息
|
||||
type CPUInfo struct {
|
||||
Cpus []float64 `json:"cpus"`
|
||||
Cores int `json:"cores"`
|
||||
}
|
||||
|
||||
// RAMInfo 内存信息
|
||||
type RAMInfo struct {
|
||||
UsedMB int `json:"usedMb"`
|
||||
TotalMB int `json:"totalMb"`
|
||||
UsedPercent int `json:"usedPercent"`
|
||||
}
|
||||
|
||||
// DiskInfo 磁盘信息
|
||||
type DiskInfo struct {
|
||||
UsedMB int `json:"usedMb"`
|
||||
UsedGB int `json:"usedGb"`
|
||||
TotalMB int `json:"totalMb"`
|
||||
TotalGB int `json:"totalGb"`
|
||||
UsedPercent int `json:"usedPercent"`
|
||||
}
|
||||
|
||||
// OSInfo 操作系统信息
|
||||
type OSInfo struct {
|
||||
GOOS string `json:"goos"`
|
||||
NumCPU int `json:"numCpu"`
|
||||
Compiler string `json:"compiler"`
|
||||
GoVersion string `json:"goVersion"`
|
||||
NumGoroutine int `json:"numGoroutine"`
|
||||
}
|
||||
|
||||
// GetServerInfoReply 获取服务器信息响应
|
||||
type GetServerInfoReply struct {
|
||||
Server ServerInfo `json:"server"`
|
||||
}
|
||||
|
||||
// CaptchaResponse 验证码响应
|
||||
type CaptchaResponse struct {
|
||||
CaptchaId string `json:"captchaId"`
|
||||
PicPath string `json:"picPath"`
|
||||
CaptchaLength int `json:"captchaLength"`
|
||||
OpenCaptcha bool `json:"openCaptcha"`
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package system
|
||||
|
||||
import "time"
|
||||
|
||||
// VersionInfo 版本信息
|
||||
type VersionInfo struct {
|
||||
ID uint `json:"ID"`
|
||||
VersionName string `json:"versionName"`
|
||||
VersionCode string `json:"versionCode"`
|
||||
Description string `json:"description"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
}
|
||||
|
||||
// CreateVersionRequest 创建版本请求
|
||||
type CreateVersionRequest struct {
|
||||
VersionName string `json:"versionName" binding:"required"`
|
||||
VersionCode string `json:"versionCode" binding:"required"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
// UpdateVersionRequest 更新版本请求
|
||||
type UpdateVersionRequest struct {
|
||||
ID uint `json:"ID" binding:"required"`
|
||||
VersionName string `json:"versionName"`
|
||||
VersionCode string `json:"versionCode"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
// GetVersionListRequest 获取版本列表请求
|
||||
type GetVersionListRequest struct {
|
||||
Page int `json:"page" form:"page"`
|
||||
PageSize int `json:"pageSize" form:"pageSize"`
|
||||
VersionName *string `json:"versionName" form:"versionName"`
|
||||
VersionCode *string `json:"versionCode" form:"versionCode"`
|
||||
CreatedAtRange []time.Time `json:"createdAtRange" form:"createdAtRange[]"`
|
||||
}
|
||||
|
||||
// GetVersionListReply 获取版本列表响应
|
||||
type GetVersionListReply struct {
|
||||
List []VersionInfo `json:"list"`
|
||||
Total int64 `json:"total"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"pageSize"`
|
||||
}
|
||||
|
||||
// ExportVersionRequest 导出版本请求
|
||||
type ExportVersionRequest struct {
|
||||
VersionName string `json:"versionName" binding:"required"`
|
||||
VersionCode string `json:"versionCode" binding:"required"`
|
||||
Description string `json:"description"`
|
||||
MenuIds []uint `json:"menuIds"`
|
||||
ApiIds []uint `json:"apiIds"`
|
||||
DictIds []uint `json:"dictIds"`
|
||||
}
|
||||
|
||||
// ImportVersionRequest 导入版本请求
|
||||
type ImportVersionRequest struct {
|
||||
VersionInfo ExportVersionInfo `json:"version" binding:"required"`
|
||||
ExportMenu []BaseMenuInfo `json:"menus"`
|
||||
ExportApi []ApiInfo `json:"apis"`
|
||||
ExportDictionary []DictionaryInfo `json:"dictionaries"`
|
||||
}
|
||||
|
||||
// ExportVersionInfo 导出版本信息
|
||||
type ExportVersionInfo struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
Code string `json:"code" binding:"required"`
|
||||
Description string `json:"description"`
|
||||
ExportTime string `json:"exportTime"`
|
||||
}
|
||||
|
||||
// ExportVersionResponse 导出版本响应
|
||||
type ExportVersionResponse struct {
|
||||
Version ExportVersionInfo `json:"version"`
|
||||
Menus []BaseMenuInfo `json:"menus"`
|
||||
Apis []ApiInfo `json:"apis"`
|
||||
Dictionaries []DictionaryInfo `json:"dictionaries"`
|
||||
}
|
||||
Reference in New Issue
Block a user