feat✨ gen中修改创建人和修改人为0

This commit is contained in:
wenjianzhang committed 2021-05-13 09:18:06 +08:00
1 parent 57067907d3
commit 3a4bfe915b
3 files changed
+11 -12

No files matched your search

+4 -4
View File
@@ -41,8 +41,8 @@ type SysColumns struct {
FkCol []SysColumns `gorm:"-" json:"fkCol"`
FkLabelId string `gorm:"" json:"fkLabelId"`
FkLabelName string `gorm:"size:255;" json:"fkLabelName"`
CreateBy string `gorm:"column:create_by;size:128;" json:"createBy"`
UpdateBy string `gorm:"column:update_By;size:128;" json:"updateBy"`
CreateBy int `gorm:"column:create_by;size:20;" json:"createBy"`
UpdateBy int `gorm:"column:update_By;size:20;" json:"updateBy"`
models.BaseModel
}
@@ -66,7 +66,7 @@ func (e *SysColumns) GetList(tx *gorm.DB) ([]SysColumns, error) {
func (e *SysColumns) Create(tx *gorm.DB) (SysColumns, error) {
var doc SysColumns
e.CreateBy = "1"
e.CreateBy = 0
result := tx.Table("sys_columns").Create(&e)
if result.Error != nil {
err := result.Error
@@ -83,7 +83,7 @@ func (e *SysColumns) Update(tx *gorm.DB) (update SysColumns, err error) {
//参数1:是要修改的数据
//参数2:是修改的数据
e.UpdateBy = "1"
e.UpdateBy = 0
if err = tx.Table("sys_columns").Model(&update).Updates(&e).Error; err != nil {
return
}
+4 -4
View File
@@ -34,8 +34,8 @@ type SysTables struct {
IsLogicalDelete string `gorm:"size:1;" json:"isLogicalDelete"`
LogicalDelete bool `gorm:"size:1;" json:"logicalDelete"`
LogicalDeleteColumn string `gorm:"size:128;" json:"logicalDeleteColumn"`
CreateBy string `gorm:"size:128;" json:"createBy"`
UpdateBy string `gorm:"size:128;" json:"updateBy"`
CreateBy int `gorm:"size:128;" json:"createBy"`
UpdateBy int `gorm:"size:128;" json:"updateBy"`
DataScope string `gorm:"-" json:"dataScope"`
Params Params `gorm:"-" json:"params"`
Columns []SysColumns `gorm:"-" json:"columns"`
@@ -134,7 +134,7 @@ func (e *SysTables) GetTree(tx *gorm.DB) ([]SysTables, error) {
func (e *SysTables) Create(tx *gorm.DB) (SysTables, error) {
var doc SysTables
e.CreateBy = "1"
e.CreateBy = 0
result := tx.Table("sys_tables").Create(&e)
if result.Error != nil {
err := result.Error
@@ -157,7 +157,7 @@ func (e *SysTables) Update(tx *gorm.DB) (update SysTables, err error) {
//参数1:是要修改的数据
//参数2:是修改的数据
e.UpdateBy="1"
e.UpdateBy = 0
if err = tx.Table("sys_tables").Where("table_id = ?", e.TableId).Updates(&e).Error; err != nil {
return
}