107 lines
4.0 KiB
Go
107 lines
4.0 KiB
Go
package model
|
|
|
|
import (
|
|
"sundynix-micro-go/common/model"
|
|
"time"
|
|
)
|
|
|
|
// SundynixClient 客户端表
|
|
type SundynixClient struct {
|
|
model.BaseModel
|
|
ClientID string `gorm:"size:20;column:client_id" json:"clientId"`
|
|
Name string `gorm:"size:50;column:name" json:"name"`
|
|
GrantType string `gorm:"size:50;column:grant_type" json:"grantType"`
|
|
AdditionalInfo string `gorm:"type:text;column:additional_info" json:"additionalInfo"`
|
|
ActiveTimeout int64 `gorm:"column:active_timeout" json:"activeTimeout"`
|
|
}
|
|
|
|
func (SundynixClient) TableName() string {
|
|
return "sundynix_client"
|
|
}
|
|
|
|
// SundynixRole 角色表
|
|
type SundynixRole struct {
|
|
model.BaseModel
|
|
Name string `gorm:"size:20;column:name" json:"name"`
|
|
Code string `gorm:"size:20;column:code" json:"code"`
|
|
Sort int `gorm:"column:sort" json:"sort"`
|
|
Menus []*SundynixMenu `gorm:"many2many:sundynix_role_menu;" json:"menus"`
|
|
}
|
|
|
|
func (SundynixRole) TableName() string {
|
|
return "sundynix_role"
|
|
}
|
|
|
|
// SundynixMenu 菜单表
|
|
type SundynixMenu struct {
|
|
model.BaseModel
|
|
ParentID string `gorm:"size:100;default:'0';column:parent_id" json:"parentId"`
|
|
Category int `gorm:"column:category" json:"category"`
|
|
Name string `gorm:"size:20;column:name" json:"name"`
|
|
Title string `gorm:"size:20;column:title" json:"title"`
|
|
Code string `gorm:"size:50;column:code" json:"code"`
|
|
Path string `gorm:"size:100;column:path" json:"path"`
|
|
Permission string `gorm:"size:20;column:permission" json:"permission"`
|
|
Locale string `gorm:"size:50;column:locale" json:"locale"`
|
|
Icon string `gorm:"size:20;column:icon" json:"icon"`
|
|
Sort int `gorm:"column:sort" json:"sort"`
|
|
Children []*SundynixMenu `gorm:"-" json:"children"`
|
|
}
|
|
|
|
func (SundynixMenu) TableName() string {
|
|
return "sundynix_menu"
|
|
}
|
|
|
|
// SundynixRoleMenu 角色菜单关联表
|
|
type SundynixRoleMenu struct {
|
|
RoleID string `gorm:"size:50;primaryKey;column:role_id" json:"roleId"`
|
|
MenuID string `gorm:"size:50;primaryKey;column:menu_id" json:"menuId"`
|
|
}
|
|
|
|
func (SundynixRoleMenu) TableName() string {
|
|
return "sundynix_role_menu"
|
|
}
|
|
|
|
// SundynixUserRole 用户角色关联表
|
|
type SundynixUserRole struct {
|
|
UserID string `gorm:"size:50;primaryKey;column:user_id" json:"userId"`
|
|
RoleID string `gorm:"size:50;primaryKey;column:role_id" json:"roleId"`
|
|
}
|
|
|
|
func (SundynixUserRole) TableName() string {
|
|
return "sundynix_user_role"
|
|
}
|
|
|
|
// SundynixOperationRecord 操作记录表
|
|
type SundynixOperationRecord struct {
|
|
model.BaseModel
|
|
IP string `gorm:"column:ip;comment:请求ip" json:"ip"`
|
|
Method string `gorm:"column:method;comment:请求方法" json:"method"`
|
|
Path string `gorm:"column:path;comment:请求路径" json:"path"`
|
|
Status int `gorm:"column:status;comment:请求状态" json:"status"`
|
|
Latency time.Duration `gorm:"column:latency;comment:延迟" json:"latency"`
|
|
Agent string `gorm:"type:text;column:agent;comment:代理" json:"agent"`
|
|
ErrorMessage string `gorm:"column:error_message;comment:错误信息" json:"errorMessage"`
|
|
Body string `gorm:"type:text;column:body;comment:请求Body" json:"body"`
|
|
Resp string `gorm:"type:text;column:resp;comment:响应Body" json:"resp"`
|
|
UserID string `gorm:"column:user_id;comment:用户id" json:"userId"`
|
|
}
|
|
|
|
func (SundynixOperationRecord) TableName() string {
|
|
return "sundynix_operation_record"
|
|
}
|
|
|
|
// SundynixDict 字典表(新增)
|
|
type SundynixDict struct {
|
|
model.BaseModel
|
|
Type string `gorm:"size:50;column:type;comment:字典类型" json:"type"`
|
|
Label string `gorm:"size:100;column:label;comment:字典标签" json:"label"`
|
|
Value string `gorm:"size:100;column:value;comment:字典值" json:"value"`
|
|
Sort int `gorm:"column:sort;default:0;comment:排序" json:"sort"`
|
|
Desc string `gorm:"size:200;column:desc;comment:描述" json:"desc"`
|
|
}
|
|
|
|
func (SundynixDict) TableName() string {
|
|
return "sundynix_dict"
|
|
}
|