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

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