fix:优化代码

This commit is contained in:
zhangwenjian committed 2021-02-19 10:48:27 +08:00
1 parent 981e992f28
commit 9186c6ce04
5 files changed
+62 -12

No files matched your search

+7 -6
View File
@@ -3,8 +3,8 @@ package models
import "time"
type ControlBy struct {
CreateBy int `gorm:"index;comment:'创建者'"`
UpdateBy int `gorm:"index;comment:'更新者'"`
CreateBy int `json:"createBy" gorm:"index;comment:创建者"`
UpdateBy int `json:"updateBy" gorm:"index;comment:更新者"`
}
func (e *ControlBy) SetCreateBy(createBy int) {
@@ -17,11 +17,12 @@ func (e *ControlBy) SetUpdateBy(updateBy int) {
type Model struct {
ID int `gorm:"primaryKey;autoIncrement;comment:'主键编码'"`
ID int `json:"id" gorm:"primaryKey;autoIncrement;comment:主键编码"`
}
type ModelTime struct {
CreatedAt time.Time `gorm:"comment:'创建时间'"`
UpdatedAt time.Time `gorm:"comment:'最后更新时间'"`
DeletedAt *time.Time `gorm:"index;comment:'删除时间'"`
CreatedAt time.Time `json:"createdAt" gorm:"comment:创建时间"`
UpdatedAt time.Time `json:"updatedAt" gorm:"comment:最后更新时间"`
DeletedAt *time.Time `json:"-" gorm:"index;comment:删除时间"`
}