Quellcode durchsuchen

refactor: world数据表添加字段

HeWang vor 9 Monaten
Ursprung
Commit
d1dbd9d7f3
3 geänderte Dateien mit 10 neuen und 4 gelöschten Zeilen
  1. 5 1
      biz/dal/query/world.gen.go
  2. 3 1
      biz/model/world.go
  3. 2 2
      gen/main.go

+ 5 - 1
biz/dal/query/world.gen.go

@@ -33,6 +33,7 @@ func newWorld(db *gorm.DB, opts ...gen.DOOption) world {
 	_world.CreatedAt = field.NewTime(tableName, "created_at")
 	_world.UpdatedAt = field.NewTime(tableName, "updated_at")
 	_world.DeletedAt = field.NewField(tableName, "deleted_at")
+	_world.StlURL = field.NewString(tableName, "stl_url")
 
 	_world.fillFieldMap()
 
@@ -49,6 +50,7 @@ type world struct {
 	CreatedAt field.Time
 	UpdatedAt field.Time
 	DeletedAt field.Field
+	StlURL    field.String
 
 	fieldMap map[string]field.Expr
 }
@@ -71,6 +73,7 @@ func (w *world) updateTableName(table string) *world {
 	w.CreatedAt = field.NewTime(table, "created_at")
 	w.UpdatedAt = field.NewTime(table, "updated_at")
 	w.DeletedAt = field.NewField(table, "deleted_at")
+	w.StlURL = field.NewString(table, "stl_url")
 
 	w.fillFieldMap()
 
@@ -95,13 +98,14 @@ func (w *world) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
 }
 
 func (w *world) fillFieldMap() {
-	w.fieldMap = make(map[string]field.Expr, 6)
+	w.fieldMap = make(map[string]field.Expr, 7)
 	w.fieldMap["id"] = w.ID
 	w.fieldMap["scene_id"] = w.SceneID
 	w.fieldMap["world_url"] = w.WorldURL
 	w.fieldMap["created_at"] = w.CreatedAt
 	w.fieldMap["updated_at"] = w.UpdatedAt
 	w.fieldMap["deleted_at"] = w.DeletedAt
+	w.fieldMap["stl_url"] = w.StlURL
 }
 
 func (w world) clone(db *gorm.DB) world {

+ 3 - 1
biz/model/world.go

@@ -5,8 +5,9 @@
 package model
 
 import (
-	"gorm.io/gorm"
 	"time"
+
+	"gorm.io/gorm"
 )
 
 const TableNameWorld = "world"
@@ -19,6 +20,7 @@ type World struct {
 	CreatedAt time.Time      `gorm:"column:created_at;type:datetime;not null" json:"created_at"`
 	UpdatedAt *time.Time     `gorm:"column:updated_at;type:datetime" json:"updated_at"`
 	DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime" json:"deleted_at"`
+	StlURL    *string        `gorm:"column:stl_url;type:varchar(255)" json:"stl_url"`
 }
 
 // TableName World's table name

+ 2 - 2
gen/main.go

@@ -7,7 +7,7 @@ import (
 	"gorm.io/gorm"
 )
 
-var dsn = "root:1qaz2wsx!@tcp(36.110.106.156:3306)/pji_desktop?charset=utf8&parseTime=True&loc=Local"
+var dsn = "root:1qaz2wsx!@tcp(10.14.85.240:3306)/pji_desktop?charset=utf8&parseTime=True&loc=Local"
 
 func main() {
 
@@ -54,7 +54,7 @@ func main() {
 
 	// 创建模型的方法,生成文件在 query 目录; 先创建结果不会被后创建的覆盖
 	g.ApplyBasic(MapUpdate, World, SimulationTestRecord)
-	//g.ApplyBasic(MapUpdate)
+	//g.ApplyBasic(World)
 
 	g.Execute()
 }