mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-09-21 02:04:09 +00:00
feat✨ gen中修改创建人和修改人为0
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/pkg"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user"
|
||||
_ "github.com/go-admin-team/go-admin-core/sdk/pkg/response"
|
||||
"gorm.io/gorm"
|
||||
|
||||
@@ -188,7 +187,7 @@ func genTableInit(tx *gorm.DB, tablesList []string, i int, c *gin.Context) (tool
|
||||
var dbTable tools.DBTables
|
||||
var dbColumn tools.DBColumns
|
||||
data.TBName = tablesList[i]
|
||||
data.CreateBy = user.GetUserIdStr(c)
|
||||
data.CreateBy = 0
|
||||
|
||||
dbTable.TableName = data.TBName
|
||||
dbtable, err := dbTable.Get(tx)
|
||||
@@ -210,7 +209,7 @@ func genTableInit(tx *gorm.DB, tablesList []string, i int, c *gin.Context) (tool
|
||||
data.Crud = true
|
||||
|
||||
dbcolumn, err := dbColumn.GetList(tx)
|
||||
data.CreateBy = user.GetUserIdStr(c)
|
||||
data.CreateBy = 0
|
||||
data.TableComment = dbtable.TableComment
|
||||
if dbtable.TableComment == "" {
|
||||
data.TableComment = data.ClassName
|
||||
@@ -310,7 +309,7 @@ func (e *SysTable) UpdateSysTable(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
data.UpdateBy = user.GetUserIdStr(c)
|
||||
data.UpdateBy = 0
|
||||
result, err := data.Update(db)
|
||||
if err != nil {
|
||||
log.Errorf("Update error, %s", err.Error())
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user