code generation tool
This commit is contained in:
1 parent
1c650ce539
commit
1b03cf2c48
7 files changed
+261
-79
No files matched your search
@@ -1,11 +1,14 @@
|
||||
package tools
|
||||
|
||||
import orm "go-admin/database"
|
||||
import (
|
||||
orm "go-admin/database"
|
||||
"go-admin/utils"
|
||||
)
|
||||
|
||||
type SysColumns struct {
|
||||
ColumnId int64 `gorm:"column:configId;primary_key" json:"configId"`
|
||||
TableId int64 `gorm:"column:configId" json:"configId"`
|
||||
ColumnName string `gorm:"column:configId" json:"configId"`
|
||||
ColumnId int64 `gorm:"column:column_id;primary_key" json:"columnId"`
|
||||
TableId int64 `gorm:"column:table_id" json:"tableId"`
|
||||
ColumnName string `gorm:"column:column_name" json:"columnName"`
|
||||
ColumnComment string `gorm:"column:column_comment" json:"columnComment"`
|
||||
ColumnType string `gorm:"column:column_type" json:"columnType"`
|
||||
GoType string `gorm:"column:go_type" json:"goType"`
|
||||
@@ -50,3 +53,15 @@ func (e *SysColumns) GetList() ([]SysColumns, error) {
|
||||
}
|
||||
return doc, nil
|
||||
}
|
||||
|
||||
func (e *SysColumns) Create() (SysColumns, error) {
|
||||
var doc SysColumns
|
||||
e.CreateTime = utils.GetCurrntTime()
|
||||
result := orm.Eloquent.Table("sys_columns").Create(&e)
|
||||
if result.Error != nil {
|
||||
err := result.Error
|
||||
return doc, err
|
||||
}
|
||||
doc = *e
|
||||
return doc, nil
|
||||
}
|
||||
Reference in new issue
Block a user