refactor🎨: 调整数据库模型字段类型,以适配其他数据库类型

This commit is contained in:
zhangwenjian committed 2021-06-07 16:36:50 +08:00
1 parent 4dfd4e4647
commit bb77450f2c
7 files changed
+62 -62

No files matched your search

+6 -6
View File
@@ -6,12 +6,12 @@ import (
type SysConfig struct { type SysConfig struct {
models.Model models.Model
ConfigName string `json:"configName" gorm:"type:varchar(128);comment:ConfigName"` // ConfigName string `json:"configName" gorm:"size:128;comment:ConfigName"` //
ConfigKey string `json:"configKey" gorm:"type:varchar(128);comment:ConfigKey"` // ConfigKey string `json:"configKey" gorm:"size:128;comment:ConfigKey"` //
ConfigValue string `json:"configValue" gorm:"type:varchar(255);comment:ConfigValue"` // ConfigValue string `json:"configValue" gorm:"size:255;comment:ConfigValue"` //
ConfigType string `json:"configType" gorm:"type:varchar(64);comment:ConfigType"` ConfigType string `json:"configType" gorm:"size:64;comment:ConfigType"`
IsFrontend int `json:"isFrontend" gorm:"type:varchar(64);comment:是否前台"` // IsFrontend int `json:"isFrontend" gorm:"size:64;comment:是否前台"` //
Remark string `json:"remark" gorm:"type:varchar(128);comment:Remark"` // Remark string `json:"remark" gorm:"size:128;comment:Remark"` //
models.ControlBy models.ControlBy
models.ModelTime models.ModelTime
} }
+10 -10
View File
@@ -9,16 +9,16 @@ type SysDictData struct {
models.ModelTime models.ModelTime
DictCode int `json:"dictCode" gorm:"primaryKey;column:dict_code;autoIncrement;comment:主键编码"` DictCode int `json:"dictCode" gorm:"primaryKey;column:dict_code;autoIncrement;comment:主键编码"`
DictSort int `json:"dictSort" gorm:"type:bigint(20);comment:DictSort"` DictSort int `json:"dictSort" gorm:"size:20;comment:DictSort"`
DictLabel string `json:"dictLabel" gorm:"type:varchar(128);comment:DictLabel"` DictLabel string `json:"dictLabel" gorm:"size:128;comment:DictLabel"`
DictValue string `json:"dictValue" gorm:"type:varchar(255);comment:DictValue"` DictValue string `json:"dictValue" gorm:"size:255;comment:DictValue"`
DictType string `json:"dictType" gorm:"type:varchar(64);comment:DictType"` DictType string `json:"dictType" gorm:"size:64;comment:DictType"`
CssClass string `json:"cssClass" gorm:"type:varchar(128);comment:CssClass"` CssClass string `json:"cssClass" gorm:"size:128;comment:CssClass"`
ListClass string `json:"listClass" gorm:"type:varchar(128);comment:ListClass"` ListClass string `json:"listClass" gorm:"size:128;comment:ListClass"`
IsDefault string `json:"isDefault" gorm:"type:varchar(8);comment:IsDefault"` IsDefault string `json:"isDefault" gorm:"size:8;comment:IsDefault"`
Status string `json:"status" gorm:"type:varchar(4);comment:Status"` Status string `json:"status" gorm:"size:4;comment:Status"`
Default string `json:"default" gorm:"type:varchar(8);comment:Default"` Default string `json:"default" gorm:"size:8;comment:Default"`
Remark string `json:"remark" gorm:"type:varchar(255);comment:Remark"` Remark string `json:"remark" gorm:"size:255;comment:Remark"`
} }
func (SysDictData) TableName() string { func (SysDictData) TableName() string {
+4 -4
View File
@@ -9,10 +9,10 @@ type SysDictType struct {
models.ModelTime models.ModelTime
ID int `json:"id" gorm:"primaryKey;column:dict_id;autoIncrement;comment:主键编码"` ID int `json:"id" gorm:"primaryKey;column:dict_id;autoIncrement;comment:主键编码"`
DictName string `json:"dictName" gorm:"type:varchar(128);comment:DictName"` DictName string `json:"dictName" gorm:"size:128;comment:DictName"`
DictType string `json:"dictType" gorm:"type:varchar(128);comment:DictType"` DictType string `json:"dictType" gorm:"size:128;comment:DictType"`
Status string `json:"status" gorm:"type:varchar(4);comment:Status"` Status string `json:"status" gorm:"size:4;comment:Status"`
Remark string `json:"remark" gorm:"type:varchar(255);comment:Remark"` Remark string `json:"remark" gorm:"size:255;comment:Remark"`
} }
func (SysDictType) TableName() string { func (SysDictType) TableName() string {
+10 -10
View File
@@ -14,16 +14,16 @@ import (
type SysLoginLog struct { type SysLoginLog struct {
models.Model models.Model
Username string `json:"username" gorm:"type:varchar(128);comment:用户名"` Username string `json:"username" gorm:"size:128;comment:用户名"`
Status string `json:"status" gorm:"type:varchar(4);comment:状态"` Status string `json:"status" gorm:"size:4;comment:状态"`
Ipaddr string `json:"ipaddr" gorm:"type:varchar(255);comment:ip地址"` Ipaddr string `json:"ipaddr" gorm:"size:255;comment:ip地址"`
LoginLocation string `json:"loginLocation" gorm:"type:varchar(255);comment:归属地"` LoginLocation string `json:"loginLocation" gorm:"size:255;comment:归属地"`
Browser string `json:"browser" gorm:"type:varchar(255);comment:浏览器"` Browser string `json:"browser" gorm:"size:255;comment:浏览器"`
Os string `json:"os" gorm:"type:varchar(255);comment:系统"` Os string `json:"os" gorm:"size:255;comment:系统"`
Platform string `json:"platform" gorm:"type:varchar(255);comment:固件"` Platform string `json:"platform" gorm:"size:255;comment:固件"`
LoginTime time.Time `json:"loginTime" gorm:"type:timestamp;comment:登录时间"` LoginTime time.Time `json:"loginTime" gorm:"comment:登录时间"`
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` Remark string `json:"remark" gorm:"size:255;comment:备注"`
Msg string `json:"msg" gorm:"type:varchar(255);comment:信息"` Msg string `json:"msg" gorm:"size:255;comment:信息"`
CreatedAt time.Time `json:"createdAt" gorm:"comment:创建时间"` CreatedAt time.Time `json:"createdAt" gorm:"comment:创建时间"`
UpdatedAt time.Time `json:"updatedAt" gorm:"comment:最后更新时间"` UpdatedAt time.Time `json:"updatedAt" gorm:"comment:最后更新时间"`
models.ControlBy models.ControlBy
+18 -18
View File
@@ -14,24 +14,24 @@ import (
type SysOperaLog struct { type SysOperaLog struct {
models.Model models.Model
Title string `json:"title" gorm:"type:varchar(255);comment:操作模块"` Title string `json:"title" gorm:"size:255;comment:操作模块"`
BusinessType string `json:"businessType" gorm:"type:varchar(128);comment:操作类型"` BusinessType string `json:"businessType" gorm:"size:128;comment:操作类型"`
BusinessTypes string `json:"businessTypes" gorm:"type:varchar(128);comment:BusinessTypes"` BusinessTypes string `json:"businessTypes" gorm:"size:128;comment:BusinessTypes"`
Method string `json:"method" gorm:"type:varchar(128);comment:函数"` Method string `json:"method" gorm:"size:128;comment:函数"`
RequestMethod string `json:"requestMethod" gorm:"type:varchar(128);comment:请求方式"` RequestMethod string `json:"requestMethod" gorm:"size:128;comment:请求方式"`
OperatorType string `json:"operatorType" gorm:"type:varchar(128);comment:操作类型"` OperatorType string `json:"operatorType" gorm:"size:128;comment:操作类型"`
OperName string `json:"operName" gorm:"type:varchar(128);comment:操作者"` OperName string `json:"operName" gorm:"size:128;comment:操作者"`
DeptName string `json:"deptName" gorm:"type:varchar(128);comment:部门名称"` DeptName string `json:"deptName" gorm:"size:128;comment:部门名称"`
OperUrl string `json:"operUrl" gorm:"type:varchar(255);comment:访问地址"` OperUrl string `json:"operUrl" gorm:"size:255;comment:访问地址"`
OperIp string `json:"operIp" gorm:"type:varchar(128);comment:客户端ip"` OperIp string `json:"operIp" gorm:"size:128;comment:客户端ip"`
OperLocation string `json:"operLocation" gorm:"type:varchar(128);comment:访问位置"` OperLocation string `json:"operLocation" gorm:"size:128;comment:访问位置"`
OperParam string `json:"operParam" gorm:"type:varchar(255);comment:请求参数"` OperParam string `json:"operParam" gorm:"size:255;comment:请求参数"`
Status string `json:"status" gorm:"type:varchar(4);comment:操作状态"` Status string `json:"status" gorm:"size:4;comment:操作状态"`
OperTime time.Time `json:"operTime" gorm:"type:timestamp;comment:操作时间"` OperTime time.Time `json:"operTime" gorm:"comment:操作时间"`
JsonResult string `json:"jsonResult" gorm:"type:varchar(255);comment:返回数据"` JsonResult string `json:"jsonResult" gorm:"size:255;comment:返回数据"`
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` Remark string `json:"remark" gorm:"size:255;comment:备注"`
LatencyTime string `json:"latencyTime" gorm:"type:varchar(128);comment:耗时"` LatencyTime string `json:"latencyTime" gorm:"size:128;comment:耗时"`
UserAgent string `json:"userAgent" gorm:"type:varchar(255);comment:ua"` UserAgent string `json:"userAgent" gorm:"size:255;comment:ua"`
CreatedAt time.Time `json:"createdAt" gorm:"comment:创建时间"` CreatedAt time.Time `json:"createdAt" gorm:"comment:创建时间"`
UpdatedAt time.Time `json:"updatedAt" gorm:"comment:最后更新时间"` UpdatedAt time.Time `json:"updatedAt" gorm:"comment:最后更新时间"`
models.ControlBy models.ControlBy
+1 -1
View File
@@ -15,7 +15,7 @@ type SysRole struct {
Params string `json:"params" gorm:"-"` Params string `json:"params" gorm:"-"`
MenuIds []int `json:"menuIds" gorm:"-"` MenuIds []int `json:"menuIds" gorm:"-"`
DeptIds []int `json:"deptIds" gorm:"-"` DeptIds []int `json:"deptIds" gorm:"-"`
SysMenu []SysMenu `json:"sysMenu" gorm:"many2many:sys_role_menu;foreignKey:RoleId;joinForeignKey:role_id;references:MenuId;joinReferences:menu_id;"` SysMenu *[]SysMenu `json:"sysMenu" gorm:"many2many:sys_role_menu;foreignKey:RoleId;joinForeignKey:role_id;references:MenuId;joinReferences:menu_id;"`
models.ControlBy models.ControlBy
models.ModelTime models.ModelTime
} }
+13 -13
View File
@@ -10,19 +10,19 @@ type SysUser struct {
models.ControlBy models.ControlBy
models.ModelTime models.ModelTime
UserId int `gorm:"primaryKey;autoIncrement;comment:编码" json:"userId"` UserId int `gorm:"primaryKey;autoIncrement;comment:编码" json:"userId"`
Username string `json:"username" gorm:"type:varchar(64);comment:用户名"` Username string `json:"username" gorm:"size:64;comment:用户名"`
Password string `json:"-" gorm:"type:varchar(128);comment:密码"` Password string `json:"-" gorm:"size:128;comment:密码"`
NickName string `json:"nickName" gorm:"type:varchar(128);comment:昵称"` NickName string `json:"nickName" gorm:"size:128;comment:昵称"`
Phone string `json:"phone" gorm:"type:varchar(11);comment:手机号"` Phone string `json:"phone" gorm:"size:11;comment:手机号"`
RoleId int `json:"roleId" gorm:"type:bigint(20);comment:角色ID"` RoleId int `json:"roleId" gorm:"size:20;comment:角色ID"`
Salt string `json:"-" gorm:"type:varchar(255);comment:加盐"` Salt string `json:"-" gorm:"size:255;comment:加盐"`
Avatar string `json:"avatar" gorm:"type:varchar(255);comment:头像"` Avatar string `json:"avatar" gorm:"size:255;comment:头像"`
Sex string `json:"sex" gorm:"type:varchar(255);comment:性别"` Sex string `json:"sex" gorm:"size:255;comment:性别"`
Email string `json:"email" gorm:"type:varchar(128);comment:邮箱"` Email string `json:"email" gorm:"size:128;comment:邮箱"`
DeptId int `json:"deptId" gorm:"type:bigint(20);comment:部门"` DeptId int `json:"deptId" gorm:"size:20;comment:部门"`
PostId int `json:"postId" gorm:"type:bigint(20);comment:岗位"` PostId int `json:"postId" gorm:"size:20;comment:岗位"`
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` Remark string `json:"remark" gorm:"size:255;comment:备注"`
Status string `json:"status" gorm:"type:varchar(4);comment:状态"` Status string `json:"status" gorm:"size:4;comment:状态"`
DeptIds []int `json:"deptIds" gorm:"-"` DeptIds []int `json:"deptIds" gorm:"-"`
PostIds []int `json:"postIds" gorm:"-"` PostIds []int `json:"postIds" gorm:"-"`
RoleIds []int `json:"roleIds" gorm:"-"` RoleIds []int `json:"roleIds" gorm:"-"`