system

package
v0.0.0-...-e15351e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 9 Imported by: 11

Documentation

Overview

自动生成模板SysDictionary

自动生成模板SysDictionaryDetail

自动生成模板SysExportTemplate

自动生成模板SysOperationRecord

Index

Constants

This section is empty.

Variables

View Source
var ErrAutoMove error = errors.New("创建代码成功并移动文件成功")

Functions

This section is empty.

Types

type AutoCodeStruct

type AutoCodeStruct struct {
	StructName          string                 `json:"structName"`          // Struct名称
	TableName           string                 `json:"tableName"`           // 表名
	PackageName         string                 `json:"packageName"`         // 文件名称
	HumpPackageName     string                 `json:"humpPackageName"`     // go文件名称
	Abbreviation        string                 `json:"abbreviation"`        // Struct简称
	Description         string                 `json:"description"`         // Struct中文名称
	AutoCreateApiToSql  bool                   `json:"autoCreateApiToSql"`  // 是否自动创建api
	AutoCreateMenuToSql bool                   `json:"autoCreateMenuToSql"` // 是否自动创建menu
	AutoCreateResource  bool                   `json:"autoCreateResource"`  // 是否自动创建资源标识
	AutoMoveFile        bool                   `json:"autoMoveFile"`        // 是否自动移动文件
	BusinessDB          string                 `json:"businessDB"`          // 业务数据库
	GvaModel            bool                   `json:"gvaModel"`            // 是否使用gva默认Model
	Fields              []*Field               `json:"fields"`
	PrimaryField        *Field                 `json:"primaryField"`
	HasTimer            bool                   `json:"-"`
	HasSearchTimer      bool                   `json:"-"`
	DictTypes           []string               `json:"-"`
	Package             string                 `json:"package"`
	PackageT            string                 `json:"-"`
	NeedSort            bool                   `json:"-"`
	HasPic              bool                   `json:"-"`
	HasRichText         bool                   `json:"-"`
	HasFile             bool                   `json:"-"`
	NeedJSON            bool                   `json:"-"`
	FrontFields         []*Field               `json:"-"`
	HasDataSource       bool                   `json:"-"`
	DataSourceMap       map[string]*DataSource `json:"-"`
}

AutoCodeStruct 初始版本自动化代码工具

func (*AutoCodeStruct) KeyWord

func (a *AutoCodeStruct) KeyWord()

KeyWord 是go关键字的处理加上 _ ,防止编译报错 Author [SliverHorn](https://github.com/SliverHorn)

func (*AutoCodeStruct) Pretreatment

func (a *AutoCodeStruct) Pretreatment()

func (*AutoCodeStruct) SuffixTest

func (a *AutoCodeStruct) SuffixTest()

SuffixTest 处理_test 后缀 Author [SliverHorn](https://github.com/SliverHorn)

type AutoPlugInfo

type AutoPlugInfo struct {
	Key  string `json:"key"`
	Type string `json:"type"`
	Desc string `json:"desc"`
}

func (AutoPlugInfo) Effective

func (a AutoPlugInfo) Effective() bool

type AutoPlugReq

type AutoPlugReq struct {
	PlugName    string         `json:"plugName"` // 必然大写开头
	Snake       string         `json:"snake"`    // 后端自动转为 snake
	RouterGroup string         `json:"routerGroup"`
	HasGlobal   bool           `json:"hasGlobal"`
	HasRequest  bool           `json:"hasRequest"`
	HasResponse bool           `json:"hasResponse"`
	NeedModel   bool           `json:"needModel"`
	Global      []AutoPlugInfo `json:"global,omitempty"`
	Request     []AutoPlugInfo `json:"request,omitempty"`
	Response    []AutoPlugInfo `json:"response,omitempty"`
}

func (*AutoPlugReq) CheckList

func (a *AutoPlugReq) CheckList()

type Condition

type Condition struct {
	global.GVA_MODEL
	TemplateID string `json:"templateID" form:"templateID" gorm:"column:template_id;comment:模板标识"`
	From       string `json:"from" form:"from" gorm:"column:from;comment:条件取的key"`
	Column     string `json:"column" form:"column" gorm:"column:column;comment:作为查询条件的字段"`
	Operator   string `json:"operator" form:"operator" gorm:"column:operator;comment:操作符"`
}

func (Condition) TableName

func (Condition) TableName() string

type DataSource

type DataSource struct {
	Table string `json:"table"`
	Label string `json:"label"`
	Value string `json:"value"`
}

type Field

type Field 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"` // 搜索条件
	DictType        string      `json:"dictType"`        // 字典
	Front           bool        `json:"front"`           // 是否前端可见
	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"` // 是否检查数据源
}

type JoinTemplate

type JoinTemplate struct {
	global.GVA_MODEL
	TemplateID string `json:"templateID" form:"templateID" gorm:"column:template_id;comment:模板标识"`
	JOINS      string `json:"joins" form:"joins" gorm:"column:joins;comment:关联"`
	Table      string `json:"table" form:"table" gorm:"column:table;comment:关联表"`
	ON         string `json:"on" form:"on" gorm:"column:on;comment:关联条件"`
}

func (JoinTemplate) TableName

func (JoinTemplate) TableName() string

type JwtBlacklist

type JwtBlacklist struct {
	global.GVA_MODEL
	Jwt string `gorm:"type:text;comment:jwt"`
}

type Meta

type Meta struct {
	ActiveName  string `json:"activeName" gorm:"comment:高亮菜单"`
	KeepAlive   bool   `json:"keepAlive" gorm:"comment:是否缓存"`           // 是否缓存
	DefaultMenu bool   `json:"defaultMenu" gorm:"comment:是否是基础路由(开发中)"` // 是否是基础路由(开发中)
	Title       string `json:"title" gorm:"comment:菜单名"`                // 菜单名
	Icon        string `json:"icon" gorm:"comment:菜单图标"`                // 菜单图标
	CloseTab    bool   `json:"closeTab" gorm:"comment:自动关闭tab"`         // 自动关闭tab
}

type SysApi

type SysApi struct {
	global.GVA_MODEL
	Path        string `json:"path" gorm:"comment:api路径"`             // api路径
	Description string `json:"description" gorm:"comment:api中文描述"`    // api中文描述
	ApiGroup    string `json:"apiGroup" gorm:"comment:api组"`          // api组
	Method      string `json:"method" gorm:"default:POST;comment:方法"` // 方法:创建POST(默认)|查看GET|更新PUT|删除DELETE
}

func (SysApi) TableName

func (SysApi) TableName() string

type SysAuthority

type SysAuthority struct {
	CreatedAt       time.Time       // 创建时间
	UpdatedAt       time.Time       // 更新时间
	DeletedAt       *time.Time      `sql:"index"`
	AuthorityId     uint            `json:"authorityId" gorm:"not null;unique;primary_key;comment:角色ID;size:90"` // 角色ID
	AuthorityName   string          `json:"authorityName" gorm:"comment:角色名"`                                    // 角色名
	ParentId        *uint           `json:"parentId" gorm:"comment:父角色ID"`                                       // 父角色ID
	DataAuthorityId []*SysAuthority `json:"dataAuthorityId" gorm:"many2many:sys_data_authority_id;"`
	Children        []SysAuthority  `json:"children" gorm:"-"`
	SysBaseMenus    []SysBaseMenu   `json:"menus" gorm:"many2many:sys_authority_menus;"`
	Users           []SysUser       `json:"-" gorm:"many2many:sys_user_authority;"`
	DefaultRouter   string          `json:"defaultRouter" gorm:"comment:默认菜单;default:dashboard"` // 默认菜单(默认dashboard)
}

func (SysAuthority) TableName

func (SysAuthority) TableName() string

type SysAuthorityBtn

type SysAuthorityBtn struct {
	AuthorityId      uint           `gorm:"comment:角色ID"`
	SysMenuID        uint           `gorm:"comment:菜单ID"`
	SysBaseMenuBtnID uint           `gorm:"comment:菜单按钮ID"`
	SysBaseMenuBtn   SysBaseMenuBtn ` gorm:"comment:按钮详情"`
}

type SysAuthorityMenu

type SysAuthorityMenu struct {
	MenuId      string `json:"menuId" gorm:"comment:菜单ID;column:sys_base_menu_id"`
	AuthorityId string `json:"-" gorm:"comment:角色ID;column:sys_authority_authority_id"`
}

func (SysAuthorityMenu) TableName

func (s SysAuthorityMenu) TableName() string

type SysAutoCode

type SysAutoCode struct {
	global.GVA_MODEL
	PackageName string `json:"packageName" gorm:"comment:包名"`
	Label       string `json:"label" gorm:"comment:展示名"`
	Desc        string `json:"desc" gorm:"comment:描述"`
}

type SysAutoCodeHistory

type SysAutoCodeHistory struct {
	global.GVA_MODEL
	Package       string `json:"package"`
	BusinessDB    string `json:"businessDB"`
	TableName     string `json:"tableName"`
	MenuID        uint   `json:"menuID"`
	RequestMeta   string `gorm:"type:text" json:"requestMeta,omitempty"`   // 前端传入的结构化信息
	AutoCodePath  string `gorm:"type:text" json:"autoCodePath,omitempty"`  // 其他meta信息 path;path
	InjectionMeta string `gorm:"type:text" json:"injectionMeta,omitempty"` // 注入的内容 RouterPath@functionName@RouterString;
	StructName    string `json:"structName"`
	StructCNName  string `json:"structCNName"`
	ApiIDs        string `json:"apiIDs,omitempty"` // api表注册内容
	Flag          int    `json:"flag"`             // 表示对应状态 0 代表创建, 1 代表回滚 ...
}

SysAutoCodeHistory 自动迁移代码记录,用于回滚,重放使用

func (*SysAutoCodeHistory) ToRequestIds

func (m *SysAutoCodeHistory) ToRequestIds() request.IdsReq

ToRequestIds ApiIDs 转换 request.IdsReq Author [SliverHorn](https://github.com/SliverHorn)

type SysBaseMenu

type SysBaseMenu struct {
	global.GVA_MODEL
	MenuLevel     uint                                       `json:"-"`
	ParentId      uint                                       `json:"parentId" gorm:"comment:父菜单ID"`     // 父菜单ID
	Path          string                                     `json:"path" gorm:"comment:路由path"`        // 路由path
	Name          string                                     `json:"name" gorm:"comment:路由name"`        // 路由name
	Hidden        bool                                       `json:"hidden" gorm:"comment:是否在列表隐藏"`     // 是否在列表隐藏
	Component     string                                     `json:"component" gorm:"comment:对应前端文件路径"` // 对应前端文件路径
	Sort          int                                        `json:"sort" gorm:"comment:排序标记"`          // 排序标记
	Meta          `json:"meta" gorm:"embedded;comment:附加属性"` // 附加属性
	SysAuthoritys []SysAuthority                             `json:"authoritys" gorm:"many2many:sys_authority_menus;"`
	Children      []SysBaseMenu                              `json:"children" gorm:"-"`
	Parameters    []SysBaseMenuParameter                     `json:"parameters"`
	MenuBtn       []SysBaseMenuBtn                           `json:"menuBtn"`
}

func (SysBaseMenu) TableName

func (SysBaseMenu) TableName() string

type SysBaseMenuBtn

type SysBaseMenuBtn struct {
	global.GVA_MODEL
	Name          string `json:"name" gorm:"comment:按钮关键key"`
	Desc          string `json:"desc" gorm:"按钮备注"`
	SysBaseMenuID uint   `json:"sysBaseMenuID" gorm:"comment:菜单ID"`
}

type SysBaseMenuParameter

type SysBaseMenuParameter struct {
	global.GVA_MODEL
	SysBaseMenuID uint
	Type          string `json:"type" gorm:"comment:地址栏携带参数为params还是query"` // 地址栏携带参数为params还是query
	Key           string `json:"key" gorm:"comment:地址栏携带参数的key"`            // 地址栏携带参数的key
	Value         string `json:"value" gorm:"comment:地址栏携带参数的值"`            // 地址栏携带参数的值
}

type SysDictionary

type SysDictionary struct {
	global.GVA_MODEL
	Name                 string                `json:"name" form:"name" gorm:"column:name;comment:字典名(中)"`   // 字典名(中)
	Type                 string                `json:"type" form:"type" gorm:"column:type;comment:字典名(英)"`   // 字典名(英)
	Status               *bool                 `json:"status" form:"status" gorm:"column:status;comment:状态"` // 状态
	Desc                 string                `json:"desc" form:"desc" gorm:"column:desc;comment:描述"`       // 描述
	SysDictionaryDetails []SysDictionaryDetail `json:"sysDictionaryDetails" form:"sysDictionaryDetails"`
}

如果含有time.Time 请自行import time包

func (SysDictionary) TableName

func (SysDictionary) TableName() string

type SysDictionaryDetail

type SysDictionaryDetail struct {
	global.GVA_MODEL
	Label           string `json:"label" form:"label" gorm:"column:label;comment:展示值"`                                  // 展示值
	Value           string `json:"value" form:"value" gorm:"column:value;comment:字典值"`                                  // 字典值
	Extend          string `json:"extend" form:"extend" gorm:"column:extend;comment:扩展值"`                               // 扩展值
	Status          *bool  `json:"status" form:"status" gorm:"column:status;comment:启用状态"`                              // 启用状态
	Sort            int    `json:"sort" form:"sort" gorm:"column:sort;comment:排序标记"`                                    // 排序标记
	SysDictionaryID int    `json:"sysDictionaryID" form:"sysDictionaryID" gorm:"column:sys_dictionary_id;comment:关联标记"` // 关联标记
}

如果含有time.Time 请自行import time包

func (SysDictionaryDetail) TableName

func (SysDictionaryDetail) TableName() string

type SysExportTemplate

type SysExportTemplate struct {
	global.GVA_MODEL
	DBName       string         `json:"dbName" form:"dbName" gorm:"column:db_name;comment:数据库名称;"`               //数据库名称
	Name         string         `json:"name" form:"name" gorm:"column:name;comment:模板名称;"`                       //模板名称
	TableName    string         `json:"tableName" form:"tableName" gorm:"column:table_name;comment:表名称;"`        //表名称
	TemplateID   string         `json:"templateID" form:"templateID" gorm:"column:template_id;comment:模板标识;"`    //模板标识
	TemplateInfo string         `json:"templateInfo" form:"templateInfo" gorm:"column:template_info;type:text;"` //模板信息
	Limit        int            `json:"limit" form:"limit" gorm:"column:limit;comment:导出限制"`
	Order        string         `json:"order" form:"order" gorm:"column:order;comment:排序"`
	Conditions   []Condition    `json:"conditions" form:"conditions" gorm:"foreignKey:TemplateID;references:TemplateID;comment:条件"`
	JoinTemplate []JoinTemplate `json:"joinTemplate" form:"joinTemplate" gorm:"foreignKey:TemplateID;references:TemplateID;comment:关联"`
}

导出模板 结构体 SysExportTemplate

type SysMenu

type SysMenu struct {
	SysBaseMenu
	MenuId      uint                   `json:"menuId" gorm:"comment:菜单ID"`
	AuthorityId uint                   `json:"-" gorm:"comment:角色ID"`
	Children    []SysMenu              `json:"children" gorm:"-"`
	Parameters  []SysBaseMenuParameter `json:"parameters" gorm:"foreignKey:SysBaseMenuID;references:MenuId"`
	Btns        map[string]uint        `json:"btns" gorm:"-"`
}

type SysOperationRecord

type SysOperationRecord struct {
	global.GVA_MODEL
	Ip           string        `json:"ip" form:"ip" gorm:"column:ip;comment:请求ip"`                                   // 请求ip
	Method       string        `json:"method" form:"method" gorm:"column:method;comment:请求方法"`                       // 请求方法
	Path         string        `json:"path" form:"path" gorm:"column:path;comment:请求路径"`                             // 请求路径
	Status       int           `json:"status" form:"status" gorm:"column:status;comment:请求状态"`                       // 请求状态
	Latency      time.Duration `json:"latency" form:"latency" gorm:"column:latency;comment:延迟" swaggertype:"string"` // 延迟
	Agent        string        `json:"agent" form:"agent" gorm:"type:text;column:agent;comment:代理"`                  // 代理
	ErrorMessage string        `json:"error_message" form:"error_message" gorm:"column:error_message;comment:错误信息"`  // 错误信息
	Body         string        `json:"body" form:"body" gorm:"type:text;column:body;comment:请求Body"`                 // 请求Body
	Resp         string        `json:"resp" form:"resp" gorm:"type:text;column:resp;comment:响应Body"`                 // 响应Body
	UserID       int           `json:"user_id" form:"user_id" gorm:"column:user_id;comment:用户id"`                    // 用户id
	User         SysUser       `json:"user"`
}

如果含有time.Time 请自行import time包

type SysUser

type SysUser struct {
	global.GVA_MODEL
	UUID        uuid.UUID      `json:"uuid" gorm:"index;comment:用户UUID"`                                                     // 用户UUID
	Username    string         `json:"userName" gorm:"index;comment:用户登录名"`                                                  // 用户登录名
	Password    string         `json:"-"  gorm:"comment:用户登录密码"`                                                             // 用户登录密码
	NickName    string         `json:"nickName" gorm:"default:系统用户;comment:用户昵称"`                                            // 用户昵称
	SideMode    string         `json:"sideMode" gorm:"default:dark;comment:用户侧边主题"`                                          // 用户侧边主题
	HeaderImg   string         `json:"headerImg" gorm:"default:https://qmplusimg.henrongyi.top/gva_header.jpg;comment:用户头像"` // 用户头像
	BaseColor   string         `json:"baseColor" gorm:"default:#fff;comment:基础颜色"`                                           // 基础颜色
	ActiveColor string         `json:"activeColor" gorm:"default:#1890ff;comment:活跃颜色"`                                      // 活跃颜色
	AuthorityId uint           `json:"authorityId" gorm:"default:888;comment:用户角色ID"`                                        // 用户角色ID
	Authority   SysAuthority   `json:"authority" gorm:"foreignKey:AuthorityId;references:AuthorityId;comment:用户角色"`
	Authorities []SysAuthority `json:"authorities" gorm:"many2many:sys_user_authority;"`
	Phone       string         `json:"phone"  gorm:"comment:用户手机号"`                     // 用户手机号
	Email       string         `json:"email"  gorm:"comment:用户邮箱"`                      // 用户邮箱
	Enable      int            `json:"enable" gorm:"default:1;comment:用户是否被冻结 1正常 2冻结"` //用户是否被冻结 1正常 2冻结
}

func (SysUser) TableName

func (SysUser) TableName() string

type SysUserAuthority

type SysUserAuthority struct {
	SysUserId               uint `gorm:"column:sys_user_id"`
	SysAuthorityAuthorityId uint `gorm:"column:sys_authority_authority_id"`
}

SysUserAuthority 是 sysUser 和 sysAuthority 的连接表

func (*SysUserAuthority) TableName

func (s *SysUserAuthority) TableName() string

type System

type System struct {
	Config config.Server `json:"config"`
}

配置文件结构体

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL