Pārlūkot izejas kodu

feat: map.bag下载&world上传&gen生成数据库操作基础代码

HeWang 10 mēneši atpakaļ
vecāks
revīzija
cc2d75a785

+ 3 - 0
biz/dal/mysql/init.go

@@ -3,6 +3,7 @@ package mysql
 import (
 	"gorm.io/driver/mysql"
 	"gorm.io/gorm"
+	"pji_desktop_http/biz/dal/query"
 	"time"
 )
 
@@ -21,4 +22,6 @@ func Init() {
 	sqlDB.SetMaxIdleConns(10)           // 设置空闲连接池中连接的最大数量
 	sqlDB.SetMaxOpenConns(100)          // 设置打开数据库连接的最大数量
 	sqlDB.SetConnMaxLifetime(time.Hour) // 设置连接可复用的最大时间
+
+	query.SetDefault(db)
 }

+ 15 - 0
biz/dal/mysql/world.go

@@ -0,0 +1,15 @@
+package mysql
+
+import (
+	"context"
+	"pji_desktop_http/biz/dal/query"
+	"pji_desktop_http/biz/model"
+)
+
+func TestAddWorld(ctx context.Context, world model.World) {
+	w := query.World
+	err := w.WithContext(ctx).Create(&world)
+	if err != nil {
+		panic(err)
+	}
+}

+ 119 - 0
biz/dal/query/gen.go

@@ -0,0 +1,119 @@
+// Code generated by gorm.io/gen. DO NOT EDIT.
+// Code generated by gorm.io/gen. DO NOT EDIT.
+// Code generated by gorm.io/gen. DO NOT EDIT.
+
+package query
+
+import (
+	"context"
+	"database/sql"
+
+	"gorm.io/gorm"
+
+	"gorm.io/gen"
+
+	"gorm.io/plugin/dbresolver"
+)
+
+var (
+	Q                    = new(Query)
+	MapUpdate            *mapUpdate
+	SimulationTestRecord *simulationTestRecord
+	World                *world
+)
+
+func SetDefault(db *gorm.DB, opts ...gen.DOOption) {
+	*Q = *Use(db, opts...)
+	MapUpdate = &Q.MapUpdate
+	SimulationTestRecord = &Q.SimulationTestRecord
+	World = &Q.World
+}
+
+func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
+	return &Query{
+		db:                   db,
+		MapUpdate:            newMapUpdate(db, opts...),
+		SimulationTestRecord: newSimulationTestRecord(db, opts...),
+		World:                newWorld(db, opts...),
+	}
+}
+
+type Query struct {
+	db *gorm.DB
+
+	MapUpdate            mapUpdate
+	SimulationTestRecord simulationTestRecord
+	World                world
+}
+
+func (q *Query) Available() bool { return q.db != nil }
+
+func (q *Query) clone(db *gorm.DB) *Query {
+	return &Query{
+		db:                   db,
+		MapUpdate:            q.MapUpdate.clone(db),
+		SimulationTestRecord: q.SimulationTestRecord.clone(db),
+		World:                q.World.clone(db),
+	}
+}
+
+func (q *Query) ReadDB() *Query {
+	return q.ReplaceDB(q.db.Clauses(dbresolver.Read))
+}
+
+func (q *Query) WriteDB() *Query {
+	return q.ReplaceDB(q.db.Clauses(dbresolver.Write))
+}
+
+func (q *Query) ReplaceDB(db *gorm.DB) *Query {
+	return &Query{
+		db:                   db,
+		MapUpdate:            q.MapUpdate.replaceDB(db),
+		SimulationTestRecord: q.SimulationTestRecord.replaceDB(db),
+		World:                q.World.replaceDB(db),
+	}
+}
+
+type queryCtx struct {
+	MapUpdate            IMapUpdateDo
+	SimulationTestRecord ISimulationTestRecordDo
+	World                IWorldDo
+}
+
+func (q *Query) WithContext(ctx context.Context) *queryCtx {
+	return &queryCtx{
+		MapUpdate:            q.MapUpdate.WithContext(ctx),
+		SimulationTestRecord: q.SimulationTestRecord.WithContext(ctx),
+		World:                q.World.WithContext(ctx),
+	}
+}
+
+func (q *Query) Transaction(fc func(tx *Query) error, opts ...*sql.TxOptions) error {
+	return q.db.Transaction(func(tx *gorm.DB) error { return fc(q.clone(tx)) }, opts...)
+}
+
+func (q *Query) Begin(opts ...*sql.TxOptions) *QueryTx {
+	tx := q.db.Begin(opts...)
+	return &QueryTx{Query: q.clone(tx), Error: tx.Error}
+}
+
+type QueryTx struct {
+	*Query
+	Error error
+}
+
+func (q *QueryTx) Commit() error {
+	return q.db.Commit().Error
+}
+
+func (q *QueryTx) Rollback() error {
+	return q.db.Rollback().Error
+}
+
+func (q *QueryTx) SavePoint(name string) error {
+	return q.db.SavePoint(name).Error
+}
+
+func (q *QueryTx) RollbackTo(name string) error {
+	return q.db.RollbackTo(name).Error
+}

+ 450 - 0
biz/dal/query/map_update.gen.go

@@ -0,0 +1,450 @@
+// Code generated by gorm.io/gen. DO NOT EDIT.
+// Code generated by gorm.io/gen. DO NOT EDIT.
+// Code generated by gorm.io/gen. DO NOT EDIT.
+
+package query
+
+import (
+	"context"
+
+	"gorm.io/gorm"
+	"gorm.io/gorm/clause"
+	"gorm.io/gorm/schema"
+
+	"gorm.io/gen"
+	"gorm.io/gen/field"
+
+	"gorm.io/plugin/dbresolver"
+
+	"pji_desktop_http/biz/model"
+)
+
+func newMapUpdate(db *gorm.DB, opts ...gen.DOOption) mapUpdate {
+	_mapUpdate := mapUpdate{}
+
+	_mapUpdate.mapUpdateDo.UseDB(db, opts...)
+	_mapUpdate.mapUpdateDo.UseModel(&model.MapUpdate{})
+
+	tableName := _mapUpdate.mapUpdateDo.TableName()
+	_mapUpdate.ALL = field.NewAsterisk(tableName)
+	_mapUpdate.ID = field.NewString(tableName, "id")
+	_mapUpdate.MapID = field.NewString(tableName, "map_id")
+	_mapUpdate.DeviceID = field.NewString(tableName, "device_id")
+	_mapUpdate.DeviceName = field.NewString(tableName, "device_name")
+	_mapUpdate.DeviceType = field.NewString(tableName, "device_type")
+	_mapUpdate.OriginPgmPath = field.NewString(tableName, "origin_pgm_path")
+	_mapUpdate.PrePgmPath = field.NewString(tableName, "pre_pgm_path")
+	_mapUpdate.CurrentPgmPath = field.NewString(tableName, "current_pgm_path")
+	_mapUpdate.CumulativeUpdateRate = field.NewInt32(tableName, "cumulative_update_rate")
+	_mapUpdate.UpdateFlag = field.NewInt32(tableName, "update_flag")
+	_mapUpdate.UpdateSource = field.NewInt32(tableName, "update_source")
+	_mapUpdate.FromSceneList = field.NewString(tableName, "from_scene_list")
+	_mapUpdate.ValidFlag = field.NewInt32(tableName, "valid_flag")
+	_mapUpdate.CreatedAt = field.NewTime(tableName, "created_at")
+	_mapUpdate.UpdatedAt = field.NewTime(tableName, "updated_at")
+	_mapUpdate.DeletedAt = field.NewField(tableName, "deleted_at")
+
+	_mapUpdate.fillFieldMap()
+
+	return _mapUpdate
+}
+
+type mapUpdate struct {
+	mapUpdateDo mapUpdateDo
+
+	ALL                  field.Asterisk
+	ID                   field.String
+	MapID                field.String
+	DeviceID             field.String
+	DeviceName           field.String
+	DeviceType           field.String
+	OriginPgmPath        field.String
+	PrePgmPath           field.String
+	CurrentPgmPath       field.String
+	CumulativeUpdateRate field.Int32
+	UpdateFlag           field.Int32
+	UpdateSource         field.Int32
+	FromSceneList        field.String
+	ValidFlag            field.Int32
+	CreatedAt            field.Time
+	UpdatedAt            field.Time
+	DeletedAt            field.Field
+
+	fieldMap map[string]field.Expr
+}
+
+func (m mapUpdate) Table(newTableName string) *mapUpdate {
+	m.mapUpdateDo.UseTable(newTableName)
+	return m.updateTableName(newTableName)
+}
+
+func (m mapUpdate) As(alias string) *mapUpdate {
+	m.mapUpdateDo.DO = *(m.mapUpdateDo.As(alias).(*gen.DO))
+	return m.updateTableName(alias)
+}
+
+func (m *mapUpdate) updateTableName(table string) *mapUpdate {
+	m.ALL = field.NewAsterisk(table)
+	m.ID = field.NewString(table, "id")
+	m.MapID = field.NewString(table, "map_id")
+	m.DeviceID = field.NewString(table, "device_id")
+	m.DeviceName = field.NewString(table, "device_name")
+	m.DeviceType = field.NewString(table, "device_type")
+	m.OriginPgmPath = field.NewString(table, "origin_pgm_path")
+	m.PrePgmPath = field.NewString(table, "pre_pgm_path")
+	m.CurrentPgmPath = field.NewString(table, "current_pgm_path")
+	m.CumulativeUpdateRate = field.NewInt32(table, "cumulative_update_rate")
+	m.UpdateFlag = field.NewInt32(table, "update_flag")
+	m.UpdateSource = field.NewInt32(table, "update_source")
+	m.FromSceneList = field.NewString(table, "from_scene_list")
+	m.ValidFlag = field.NewInt32(table, "valid_flag")
+	m.CreatedAt = field.NewTime(table, "created_at")
+	m.UpdatedAt = field.NewTime(table, "updated_at")
+	m.DeletedAt = field.NewField(table, "deleted_at")
+
+	m.fillFieldMap()
+
+	return m
+}
+
+func (m *mapUpdate) WithContext(ctx context.Context) IMapUpdateDo {
+	return m.mapUpdateDo.WithContext(ctx)
+}
+
+func (m mapUpdate) TableName() string { return m.mapUpdateDo.TableName() }
+
+func (m mapUpdate) Alias() string { return m.mapUpdateDo.Alias() }
+
+func (m mapUpdate) Columns(cols ...field.Expr) gen.Columns { return m.mapUpdateDo.Columns(cols...) }
+
+func (m *mapUpdate) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
+	_f, ok := m.fieldMap[fieldName]
+	if !ok || _f == nil {
+		return nil, false
+	}
+	_oe, ok := _f.(field.OrderExpr)
+	return _oe, ok
+}
+
+func (m *mapUpdate) fillFieldMap() {
+	m.fieldMap = make(map[string]field.Expr, 16)
+	m.fieldMap["id"] = m.ID
+	m.fieldMap["map_id"] = m.MapID
+	m.fieldMap["device_id"] = m.DeviceID
+	m.fieldMap["device_name"] = m.DeviceName
+	m.fieldMap["device_type"] = m.DeviceType
+	m.fieldMap["origin_pgm_path"] = m.OriginPgmPath
+	m.fieldMap["pre_pgm_path"] = m.PrePgmPath
+	m.fieldMap["current_pgm_path"] = m.CurrentPgmPath
+	m.fieldMap["cumulative_update_rate"] = m.CumulativeUpdateRate
+	m.fieldMap["update_flag"] = m.UpdateFlag
+	m.fieldMap["update_source"] = m.UpdateSource
+	m.fieldMap["from_scene_list"] = m.FromSceneList
+	m.fieldMap["valid_flag"] = m.ValidFlag
+	m.fieldMap["created_at"] = m.CreatedAt
+	m.fieldMap["updated_at"] = m.UpdatedAt
+	m.fieldMap["deleted_at"] = m.DeletedAt
+}
+
+func (m mapUpdate) clone(db *gorm.DB) mapUpdate {
+	m.mapUpdateDo.ReplaceConnPool(db.Statement.ConnPool)
+	return m
+}
+
+func (m mapUpdate) replaceDB(db *gorm.DB) mapUpdate {
+	m.mapUpdateDo.ReplaceDB(db)
+	return m
+}
+
+type mapUpdateDo struct{ gen.DO }
+
+type IMapUpdateDo interface {
+	gen.SubQuery
+	Debug() IMapUpdateDo
+	WithContext(ctx context.Context) IMapUpdateDo
+	WithResult(fc func(tx gen.Dao)) gen.ResultInfo
+	ReplaceDB(db *gorm.DB)
+	ReadDB() IMapUpdateDo
+	WriteDB() IMapUpdateDo
+	As(alias string) gen.Dao
+	Session(config *gorm.Session) IMapUpdateDo
+	Columns(cols ...field.Expr) gen.Columns
+	Clauses(conds ...clause.Expression) IMapUpdateDo
+	Not(conds ...gen.Condition) IMapUpdateDo
+	Or(conds ...gen.Condition) IMapUpdateDo
+	Select(conds ...field.Expr) IMapUpdateDo
+	Where(conds ...gen.Condition) IMapUpdateDo
+	Order(conds ...field.Expr) IMapUpdateDo
+	Distinct(cols ...field.Expr) IMapUpdateDo
+	Omit(cols ...field.Expr) IMapUpdateDo
+	Join(table schema.Tabler, on ...field.Expr) IMapUpdateDo
+	LeftJoin(table schema.Tabler, on ...field.Expr) IMapUpdateDo
+	RightJoin(table schema.Tabler, on ...field.Expr) IMapUpdateDo
+	Group(cols ...field.Expr) IMapUpdateDo
+	Having(conds ...gen.Condition) IMapUpdateDo
+	Limit(limit int) IMapUpdateDo
+	Offset(offset int) IMapUpdateDo
+	Count() (count int64, err error)
+	Scopes(funcs ...func(gen.Dao) gen.Dao) IMapUpdateDo
+	Unscoped() IMapUpdateDo
+	Create(values ...*model.MapUpdate) error
+	CreateInBatches(values []*model.MapUpdate, batchSize int) error
+	Save(values ...*model.MapUpdate) error
+	First() (*model.MapUpdate, error)
+	Take() (*model.MapUpdate, error)
+	Last() (*model.MapUpdate, error)
+	Find() ([]*model.MapUpdate, error)
+	FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.MapUpdate, err error)
+	FindInBatches(result *[]*model.MapUpdate, batchSize int, fc func(tx gen.Dao, batch int) error) error
+	Pluck(column field.Expr, dest interface{}) error
+	Delete(...*model.MapUpdate) (info gen.ResultInfo, err error)
+	Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
+	UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
+	Updates(value interface{}) (info gen.ResultInfo, err error)
+	UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
+	UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
+	UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
+	UpdateFrom(q gen.SubQuery) gen.Dao
+	Attrs(attrs ...field.AssignExpr) IMapUpdateDo
+	Assign(attrs ...field.AssignExpr) IMapUpdateDo
+	Joins(fields ...field.RelationField) IMapUpdateDo
+	Preload(fields ...field.RelationField) IMapUpdateDo
+	FirstOrInit() (*model.MapUpdate, error)
+	FirstOrCreate() (*model.MapUpdate, error)
+	FindByPage(offset int, limit int) (result []*model.MapUpdate, count int64, err error)
+	ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
+	Scan(result interface{}) (err error)
+	Returning(value interface{}, columns ...string) IMapUpdateDo
+	UnderlyingDB() *gorm.DB
+	schema.Tabler
+}
+
+func (m mapUpdateDo) Debug() IMapUpdateDo {
+	return m.withDO(m.DO.Debug())
+}
+
+func (m mapUpdateDo) WithContext(ctx context.Context) IMapUpdateDo {
+	return m.withDO(m.DO.WithContext(ctx))
+}
+
+func (m mapUpdateDo) ReadDB() IMapUpdateDo {
+	return m.Clauses(dbresolver.Read)
+}
+
+func (m mapUpdateDo) WriteDB() IMapUpdateDo {
+	return m.Clauses(dbresolver.Write)
+}
+
+func (m mapUpdateDo) Session(config *gorm.Session) IMapUpdateDo {
+	return m.withDO(m.DO.Session(config))
+}
+
+func (m mapUpdateDo) Clauses(conds ...clause.Expression) IMapUpdateDo {
+	return m.withDO(m.DO.Clauses(conds...))
+}
+
+func (m mapUpdateDo) Returning(value interface{}, columns ...string) IMapUpdateDo {
+	return m.withDO(m.DO.Returning(value, columns...))
+}
+
+func (m mapUpdateDo) Not(conds ...gen.Condition) IMapUpdateDo {
+	return m.withDO(m.DO.Not(conds...))
+}
+
+func (m mapUpdateDo) Or(conds ...gen.Condition) IMapUpdateDo {
+	return m.withDO(m.DO.Or(conds...))
+}
+
+func (m mapUpdateDo) Select(conds ...field.Expr) IMapUpdateDo {
+	return m.withDO(m.DO.Select(conds...))
+}
+
+func (m mapUpdateDo) Where(conds ...gen.Condition) IMapUpdateDo {
+	return m.withDO(m.DO.Where(conds...))
+}
+
+func (m mapUpdateDo) Order(conds ...field.Expr) IMapUpdateDo {
+	return m.withDO(m.DO.Order(conds...))
+}
+
+func (m mapUpdateDo) Distinct(cols ...field.Expr) IMapUpdateDo {
+	return m.withDO(m.DO.Distinct(cols...))
+}
+
+func (m mapUpdateDo) Omit(cols ...field.Expr) IMapUpdateDo {
+	return m.withDO(m.DO.Omit(cols...))
+}
+
+func (m mapUpdateDo) Join(table schema.Tabler, on ...field.Expr) IMapUpdateDo {
+	return m.withDO(m.DO.Join(table, on...))
+}
+
+func (m mapUpdateDo) LeftJoin(table schema.Tabler, on ...field.Expr) IMapUpdateDo {
+	return m.withDO(m.DO.LeftJoin(table, on...))
+}
+
+func (m mapUpdateDo) RightJoin(table schema.Tabler, on ...field.Expr) IMapUpdateDo {
+	return m.withDO(m.DO.RightJoin(table, on...))
+}
+
+func (m mapUpdateDo) Group(cols ...field.Expr) IMapUpdateDo {
+	return m.withDO(m.DO.Group(cols...))
+}
+
+func (m mapUpdateDo) Having(conds ...gen.Condition) IMapUpdateDo {
+	return m.withDO(m.DO.Having(conds...))
+}
+
+func (m mapUpdateDo) Limit(limit int) IMapUpdateDo {
+	return m.withDO(m.DO.Limit(limit))
+}
+
+func (m mapUpdateDo) Offset(offset int) IMapUpdateDo {
+	return m.withDO(m.DO.Offset(offset))
+}
+
+func (m mapUpdateDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IMapUpdateDo {
+	return m.withDO(m.DO.Scopes(funcs...))
+}
+
+func (m mapUpdateDo) Unscoped() IMapUpdateDo {
+	return m.withDO(m.DO.Unscoped())
+}
+
+func (m mapUpdateDo) Create(values ...*model.MapUpdate) error {
+	if len(values) == 0 {
+		return nil
+	}
+	return m.DO.Create(values)
+}
+
+func (m mapUpdateDo) CreateInBatches(values []*model.MapUpdate, batchSize int) error {
+	return m.DO.CreateInBatches(values, batchSize)
+}
+
+// Save : !!! underlying implementation is different with GORM
+// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
+func (m mapUpdateDo) Save(values ...*model.MapUpdate) error {
+	if len(values) == 0 {
+		return nil
+	}
+	return m.DO.Save(values)
+}
+
+func (m mapUpdateDo) First() (*model.MapUpdate, error) {
+	if result, err := m.DO.First(); err != nil {
+		return nil, err
+	} else {
+		return result.(*model.MapUpdate), nil
+	}
+}
+
+func (m mapUpdateDo) Take() (*model.MapUpdate, error) {
+	if result, err := m.DO.Take(); err != nil {
+		return nil, err
+	} else {
+		return result.(*model.MapUpdate), nil
+	}
+}
+
+func (m mapUpdateDo) Last() (*model.MapUpdate, error) {
+	if result, err := m.DO.Last(); err != nil {
+		return nil, err
+	} else {
+		return result.(*model.MapUpdate), nil
+	}
+}
+
+func (m mapUpdateDo) Find() ([]*model.MapUpdate, error) {
+	result, err := m.DO.Find()
+	return result.([]*model.MapUpdate), err
+}
+
+func (m mapUpdateDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.MapUpdate, err error) {
+	buf := make([]*model.MapUpdate, 0, batchSize)
+	err = m.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
+		defer func() { results = append(results, buf...) }()
+		return fc(tx, batch)
+	})
+	return results, err
+}
+
+func (m mapUpdateDo) FindInBatches(result *[]*model.MapUpdate, batchSize int, fc func(tx gen.Dao, batch int) error) error {
+	return m.DO.FindInBatches(result, batchSize, fc)
+}
+
+func (m mapUpdateDo) Attrs(attrs ...field.AssignExpr) IMapUpdateDo {
+	return m.withDO(m.DO.Attrs(attrs...))
+}
+
+func (m mapUpdateDo) Assign(attrs ...field.AssignExpr) IMapUpdateDo {
+	return m.withDO(m.DO.Assign(attrs...))
+}
+
+func (m mapUpdateDo) Joins(fields ...field.RelationField) IMapUpdateDo {
+	for _, _f := range fields {
+		m = *m.withDO(m.DO.Joins(_f))
+	}
+	return &m
+}
+
+func (m mapUpdateDo) Preload(fields ...field.RelationField) IMapUpdateDo {
+	for _, _f := range fields {
+		m = *m.withDO(m.DO.Preload(_f))
+	}
+	return &m
+}
+
+func (m mapUpdateDo) FirstOrInit() (*model.MapUpdate, error) {
+	if result, err := m.DO.FirstOrInit(); err != nil {
+		return nil, err
+	} else {
+		return result.(*model.MapUpdate), nil
+	}
+}
+
+func (m mapUpdateDo) FirstOrCreate() (*model.MapUpdate, error) {
+	if result, err := m.DO.FirstOrCreate(); err != nil {
+		return nil, err
+	} else {
+		return result.(*model.MapUpdate), nil
+	}
+}
+
+func (m mapUpdateDo) FindByPage(offset int, limit int) (result []*model.MapUpdate, count int64, err error) {
+	result, err = m.Offset(offset).Limit(limit).Find()
+	if err != nil {
+		return
+	}
+
+	if size := len(result); 0 < limit && 0 < size && size < limit {
+		count = int64(size + offset)
+		return
+	}
+
+	count, err = m.Offset(-1).Limit(-1).Count()
+	return
+}
+
+func (m mapUpdateDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
+	count, err = m.Count()
+	if err != nil {
+		return
+	}
+
+	err = m.Offset(offset).Limit(limit).Scan(result)
+	return
+}
+
+func (m mapUpdateDo) Scan(result interface{}) (err error) {
+	return m.DO.Scan(result)
+}
+
+func (m mapUpdateDo) Delete(models ...*model.MapUpdate) (result gen.ResultInfo, err error) {
+	return m.DO.Delete(models)
+}
+
+func (m *mapUpdateDo) withDO(do gen.Dao) *mapUpdateDo {
+	m.DO = *do.(*gen.DO)
+	return m
+}

+ 452 - 0
biz/dal/query/simulation_test_record.gen.go

@@ -0,0 +1,452 @@
+// Code generated by gorm.io/gen. DO NOT EDIT.
+// Code generated by gorm.io/gen. DO NOT EDIT.
+// Code generated by gorm.io/gen. DO NOT EDIT.
+
+package query
+
+import (
+	"context"
+
+	"gorm.io/gorm"
+	"gorm.io/gorm/clause"
+	"gorm.io/gorm/schema"
+
+	"gorm.io/gen"
+	"gorm.io/gen/field"
+
+	"gorm.io/plugin/dbresolver"
+
+	"pji_desktop_http/biz/model"
+)
+
+func newSimulationTestRecord(db *gorm.DB, opts ...gen.DOOption) simulationTestRecord {
+	_simulationTestRecord := simulationTestRecord{}
+
+	_simulationTestRecord.simulationTestRecordDo.UseDB(db, opts...)
+	_simulationTestRecord.simulationTestRecordDo.UseModel(&model.SimulationTestRecord{})
+
+	tableName := _simulationTestRecord.simulationTestRecordDo.TableName()
+	_simulationTestRecord.ALL = field.NewAsterisk(tableName)
+	_simulationTestRecord.ID = field.NewString(tableName, "id")
+	_simulationTestRecord.DeviceID = field.NewString(tableName, "device_id")
+	_simulationTestRecord.DeviceName = field.NewString(tableName, "device_name")
+	_simulationTestRecord.DeviceType = field.NewString(tableName, "device_type")
+	_simulationTestRecord.AlgoImageName = field.NewString(tableName, "algo_image_name")
+	_simulationTestRecord.AlgoVersion = field.NewString(tableName, "algo_version")
+	_simulationTestRecord.PgmPath = field.NewString(tableName, "pgm_path")
+	_simulationTestRecord.WorldPath = field.NewString(tableName, "world_path")
+	_simulationTestRecord.TestBagPath = field.NewString(tableName, "test_bag_path")
+	_simulationTestRecord.TestDuration = field.NewInt32(tableName, "test_duration")
+	_simulationTestRecord.TestDistance = field.NewInt32(tableName, "test_distance")
+	_simulationTestRecord.AlgoEvaluationLevel = field.NewString(tableName, "algo_evaluation_level")
+	_simulationTestRecord.AlgoEvaluationReport = field.NewString(tableName, "algo_evaluation_report")
+	_simulationTestRecord.CreatedAt = field.NewTime(tableName, "created_at")
+	_simulationTestRecord.UpdatedAt = field.NewTime(tableName, "updated_at")
+	_simulationTestRecord.DeletedAt = field.NewField(tableName, "deleted_at")
+
+	_simulationTestRecord.fillFieldMap()
+
+	return _simulationTestRecord
+}
+
+type simulationTestRecord struct {
+	simulationTestRecordDo simulationTestRecordDo
+
+	ALL                  field.Asterisk
+	ID                   field.String
+	DeviceID             field.String
+	DeviceName           field.String
+	DeviceType           field.String
+	AlgoImageName        field.String
+	AlgoVersion          field.String
+	PgmPath              field.String
+	WorldPath            field.String
+	TestBagPath          field.String
+	TestDuration         field.Int32
+	TestDistance         field.Int32
+	AlgoEvaluationLevel  field.String
+	AlgoEvaluationReport field.String
+	CreatedAt            field.Time
+	UpdatedAt            field.Time
+	DeletedAt            field.Field
+
+	fieldMap map[string]field.Expr
+}
+
+func (s simulationTestRecord) Table(newTableName string) *simulationTestRecord {
+	s.simulationTestRecordDo.UseTable(newTableName)
+	return s.updateTableName(newTableName)
+}
+
+func (s simulationTestRecord) As(alias string) *simulationTestRecord {
+	s.simulationTestRecordDo.DO = *(s.simulationTestRecordDo.As(alias).(*gen.DO))
+	return s.updateTableName(alias)
+}
+
+func (s *simulationTestRecord) updateTableName(table string) *simulationTestRecord {
+	s.ALL = field.NewAsterisk(table)
+	s.ID = field.NewString(table, "id")
+	s.DeviceID = field.NewString(table, "device_id")
+	s.DeviceName = field.NewString(table, "device_name")
+	s.DeviceType = field.NewString(table, "device_type")
+	s.AlgoImageName = field.NewString(table, "algo_image_name")
+	s.AlgoVersion = field.NewString(table, "algo_version")
+	s.PgmPath = field.NewString(table, "pgm_path")
+	s.WorldPath = field.NewString(table, "world_path")
+	s.TestBagPath = field.NewString(table, "test_bag_path")
+	s.TestDuration = field.NewInt32(table, "test_duration")
+	s.TestDistance = field.NewInt32(table, "test_distance")
+	s.AlgoEvaluationLevel = field.NewString(table, "algo_evaluation_level")
+	s.AlgoEvaluationReport = field.NewString(table, "algo_evaluation_report")
+	s.CreatedAt = field.NewTime(table, "created_at")
+	s.UpdatedAt = field.NewTime(table, "updated_at")
+	s.DeletedAt = field.NewField(table, "deleted_at")
+
+	s.fillFieldMap()
+
+	return s
+}
+
+func (s *simulationTestRecord) WithContext(ctx context.Context) ISimulationTestRecordDo {
+	return s.simulationTestRecordDo.WithContext(ctx)
+}
+
+func (s simulationTestRecord) TableName() string { return s.simulationTestRecordDo.TableName() }
+
+func (s simulationTestRecord) Alias() string { return s.simulationTestRecordDo.Alias() }
+
+func (s simulationTestRecord) Columns(cols ...field.Expr) gen.Columns {
+	return s.simulationTestRecordDo.Columns(cols...)
+}
+
+func (s *simulationTestRecord) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
+	_f, ok := s.fieldMap[fieldName]
+	if !ok || _f == nil {
+		return nil, false
+	}
+	_oe, ok := _f.(field.OrderExpr)
+	return _oe, ok
+}
+
+func (s *simulationTestRecord) fillFieldMap() {
+	s.fieldMap = make(map[string]field.Expr, 16)
+	s.fieldMap["id"] = s.ID
+	s.fieldMap["device_id"] = s.DeviceID
+	s.fieldMap["device_name"] = s.DeviceName
+	s.fieldMap["device_type"] = s.DeviceType
+	s.fieldMap["algo_image_name"] = s.AlgoImageName
+	s.fieldMap["algo_version"] = s.AlgoVersion
+	s.fieldMap["pgm_path"] = s.PgmPath
+	s.fieldMap["world_path"] = s.WorldPath
+	s.fieldMap["test_bag_path"] = s.TestBagPath
+	s.fieldMap["test_duration"] = s.TestDuration
+	s.fieldMap["test_distance"] = s.TestDistance
+	s.fieldMap["algo_evaluation_level"] = s.AlgoEvaluationLevel
+	s.fieldMap["algo_evaluation_report"] = s.AlgoEvaluationReport
+	s.fieldMap["created_at"] = s.CreatedAt
+	s.fieldMap["updated_at"] = s.UpdatedAt
+	s.fieldMap["deleted_at"] = s.DeletedAt
+}
+
+func (s simulationTestRecord) clone(db *gorm.DB) simulationTestRecord {
+	s.simulationTestRecordDo.ReplaceConnPool(db.Statement.ConnPool)
+	return s
+}
+
+func (s simulationTestRecord) replaceDB(db *gorm.DB) simulationTestRecord {
+	s.simulationTestRecordDo.ReplaceDB(db)
+	return s
+}
+
+type simulationTestRecordDo struct{ gen.DO }
+
+type ISimulationTestRecordDo interface {
+	gen.SubQuery
+	Debug() ISimulationTestRecordDo
+	WithContext(ctx context.Context) ISimulationTestRecordDo
+	WithResult(fc func(tx gen.Dao)) gen.ResultInfo
+	ReplaceDB(db *gorm.DB)
+	ReadDB() ISimulationTestRecordDo
+	WriteDB() ISimulationTestRecordDo
+	As(alias string) gen.Dao
+	Session(config *gorm.Session) ISimulationTestRecordDo
+	Columns(cols ...field.Expr) gen.Columns
+	Clauses(conds ...clause.Expression) ISimulationTestRecordDo
+	Not(conds ...gen.Condition) ISimulationTestRecordDo
+	Or(conds ...gen.Condition) ISimulationTestRecordDo
+	Select(conds ...field.Expr) ISimulationTestRecordDo
+	Where(conds ...gen.Condition) ISimulationTestRecordDo
+	Order(conds ...field.Expr) ISimulationTestRecordDo
+	Distinct(cols ...field.Expr) ISimulationTestRecordDo
+	Omit(cols ...field.Expr) ISimulationTestRecordDo
+	Join(table schema.Tabler, on ...field.Expr) ISimulationTestRecordDo
+	LeftJoin(table schema.Tabler, on ...field.Expr) ISimulationTestRecordDo
+	RightJoin(table schema.Tabler, on ...field.Expr) ISimulationTestRecordDo
+	Group(cols ...field.Expr) ISimulationTestRecordDo
+	Having(conds ...gen.Condition) ISimulationTestRecordDo
+	Limit(limit int) ISimulationTestRecordDo
+	Offset(offset int) ISimulationTestRecordDo
+	Count() (count int64, err error)
+	Scopes(funcs ...func(gen.Dao) gen.Dao) ISimulationTestRecordDo
+	Unscoped() ISimulationTestRecordDo
+	Create(values ...*model.SimulationTestRecord) error
+	CreateInBatches(values []*model.SimulationTestRecord, batchSize int) error
+	Save(values ...*model.SimulationTestRecord) error
+	First() (*model.SimulationTestRecord, error)
+	Take() (*model.SimulationTestRecord, error)
+	Last() (*model.SimulationTestRecord, error)
+	Find() ([]*model.SimulationTestRecord, error)
+	FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.SimulationTestRecord, err error)
+	FindInBatches(result *[]*model.SimulationTestRecord, batchSize int, fc func(tx gen.Dao, batch int) error) error
+	Pluck(column field.Expr, dest interface{}) error
+	Delete(...*model.SimulationTestRecord) (info gen.ResultInfo, err error)
+	Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
+	UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
+	Updates(value interface{}) (info gen.ResultInfo, err error)
+	UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
+	UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
+	UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
+	UpdateFrom(q gen.SubQuery) gen.Dao
+	Attrs(attrs ...field.AssignExpr) ISimulationTestRecordDo
+	Assign(attrs ...field.AssignExpr) ISimulationTestRecordDo
+	Joins(fields ...field.RelationField) ISimulationTestRecordDo
+	Preload(fields ...field.RelationField) ISimulationTestRecordDo
+	FirstOrInit() (*model.SimulationTestRecord, error)
+	FirstOrCreate() (*model.SimulationTestRecord, error)
+	FindByPage(offset int, limit int) (result []*model.SimulationTestRecord, count int64, err error)
+	ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
+	Scan(result interface{}) (err error)
+	Returning(value interface{}, columns ...string) ISimulationTestRecordDo
+	UnderlyingDB() *gorm.DB
+	schema.Tabler
+}
+
+func (s simulationTestRecordDo) Debug() ISimulationTestRecordDo {
+	return s.withDO(s.DO.Debug())
+}
+
+func (s simulationTestRecordDo) WithContext(ctx context.Context) ISimulationTestRecordDo {
+	return s.withDO(s.DO.WithContext(ctx))
+}
+
+func (s simulationTestRecordDo) ReadDB() ISimulationTestRecordDo {
+	return s.Clauses(dbresolver.Read)
+}
+
+func (s simulationTestRecordDo) WriteDB() ISimulationTestRecordDo {
+	return s.Clauses(dbresolver.Write)
+}
+
+func (s simulationTestRecordDo) Session(config *gorm.Session) ISimulationTestRecordDo {
+	return s.withDO(s.DO.Session(config))
+}
+
+func (s simulationTestRecordDo) Clauses(conds ...clause.Expression) ISimulationTestRecordDo {
+	return s.withDO(s.DO.Clauses(conds...))
+}
+
+func (s simulationTestRecordDo) Returning(value interface{}, columns ...string) ISimulationTestRecordDo {
+	return s.withDO(s.DO.Returning(value, columns...))
+}
+
+func (s simulationTestRecordDo) Not(conds ...gen.Condition) ISimulationTestRecordDo {
+	return s.withDO(s.DO.Not(conds...))
+}
+
+func (s simulationTestRecordDo) Or(conds ...gen.Condition) ISimulationTestRecordDo {
+	return s.withDO(s.DO.Or(conds...))
+}
+
+func (s simulationTestRecordDo) Select(conds ...field.Expr) ISimulationTestRecordDo {
+	return s.withDO(s.DO.Select(conds...))
+}
+
+func (s simulationTestRecordDo) Where(conds ...gen.Condition) ISimulationTestRecordDo {
+	return s.withDO(s.DO.Where(conds...))
+}
+
+func (s simulationTestRecordDo) Order(conds ...field.Expr) ISimulationTestRecordDo {
+	return s.withDO(s.DO.Order(conds...))
+}
+
+func (s simulationTestRecordDo) Distinct(cols ...field.Expr) ISimulationTestRecordDo {
+	return s.withDO(s.DO.Distinct(cols...))
+}
+
+func (s simulationTestRecordDo) Omit(cols ...field.Expr) ISimulationTestRecordDo {
+	return s.withDO(s.DO.Omit(cols...))
+}
+
+func (s simulationTestRecordDo) Join(table schema.Tabler, on ...field.Expr) ISimulationTestRecordDo {
+	return s.withDO(s.DO.Join(table, on...))
+}
+
+func (s simulationTestRecordDo) LeftJoin(table schema.Tabler, on ...field.Expr) ISimulationTestRecordDo {
+	return s.withDO(s.DO.LeftJoin(table, on...))
+}
+
+func (s simulationTestRecordDo) RightJoin(table schema.Tabler, on ...field.Expr) ISimulationTestRecordDo {
+	return s.withDO(s.DO.RightJoin(table, on...))
+}
+
+func (s simulationTestRecordDo) Group(cols ...field.Expr) ISimulationTestRecordDo {
+	return s.withDO(s.DO.Group(cols...))
+}
+
+func (s simulationTestRecordDo) Having(conds ...gen.Condition) ISimulationTestRecordDo {
+	return s.withDO(s.DO.Having(conds...))
+}
+
+func (s simulationTestRecordDo) Limit(limit int) ISimulationTestRecordDo {
+	return s.withDO(s.DO.Limit(limit))
+}
+
+func (s simulationTestRecordDo) Offset(offset int) ISimulationTestRecordDo {
+	return s.withDO(s.DO.Offset(offset))
+}
+
+func (s simulationTestRecordDo) Scopes(funcs ...func(gen.Dao) gen.Dao) ISimulationTestRecordDo {
+	return s.withDO(s.DO.Scopes(funcs...))
+}
+
+func (s simulationTestRecordDo) Unscoped() ISimulationTestRecordDo {
+	return s.withDO(s.DO.Unscoped())
+}
+
+func (s simulationTestRecordDo) Create(values ...*model.SimulationTestRecord) error {
+	if len(values) == 0 {
+		return nil
+	}
+	return s.DO.Create(values)
+}
+
+func (s simulationTestRecordDo) CreateInBatches(values []*model.SimulationTestRecord, batchSize int) error {
+	return s.DO.CreateInBatches(values, batchSize)
+}
+
+// Save : !!! underlying implementation is different with GORM
+// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
+func (s simulationTestRecordDo) Save(values ...*model.SimulationTestRecord) error {
+	if len(values) == 0 {
+		return nil
+	}
+	return s.DO.Save(values)
+}
+
+func (s simulationTestRecordDo) First() (*model.SimulationTestRecord, error) {
+	if result, err := s.DO.First(); err != nil {
+		return nil, err
+	} else {
+		return result.(*model.SimulationTestRecord), nil
+	}
+}
+
+func (s simulationTestRecordDo) Take() (*model.SimulationTestRecord, error) {
+	if result, err := s.DO.Take(); err != nil {
+		return nil, err
+	} else {
+		return result.(*model.SimulationTestRecord), nil
+	}
+}
+
+func (s simulationTestRecordDo) Last() (*model.SimulationTestRecord, error) {
+	if result, err := s.DO.Last(); err != nil {
+		return nil, err
+	} else {
+		return result.(*model.SimulationTestRecord), nil
+	}
+}
+
+func (s simulationTestRecordDo) Find() ([]*model.SimulationTestRecord, error) {
+	result, err := s.DO.Find()
+	return result.([]*model.SimulationTestRecord), err
+}
+
+func (s simulationTestRecordDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.SimulationTestRecord, err error) {
+	buf := make([]*model.SimulationTestRecord, 0, batchSize)
+	err = s.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
+		defer func() { results = append(results, buf...) }()
+		return fc(tx, batch)
+	})
+	return results, err
+}
+
+func (s simulationTestRecordDo) FindInBatches(result *[]*model.SimulationTestRecord, batchSize int, fc func(tx gen.Dao, batch int) error) error {
+	return s.DO.FindInBatches(result, batchSize, fc)
+}
+
+func (s simulationTestRecordDo) Attrs(attrs ...field.AssignExpr) ISimulationTestRecordDo {
+	return s.withDO(s.DO.Attrs(attrs...))
+}
+
+func (s simulationTestRecordDo) Assign(attrs ...field.AssignExpr) ISimulationTestRecordDo {
+	return s.withDO(s.DO.Assign(attrs...))
+}
+
+func (s simulationTestRecordDo) Joins(fields ...field.RelationField) ISimulationTestRecordDo {
+	for _, _f := range fields {
+		s = *s.withDO(s.DO.Joins(_f))
+	}
+	return &s
+}
+
+func (s simulationTestRecordDo) Preload(fields ...field.RelationField) ISimulationTestRecordDo {
+	for _, _f := range fields {
+		s = *s.withDO(s.DO.Preload(_f))
+	}
+	return &s
+}
+
+func (s simulationTestRecordDo) FirstOrInit() (*model.SimulationTestRecord, error) {
+	if result, err := s.DO.FirstOrInit(); err != nil {
+		return nil, err
+	} else {
+		return result.(*model.SimulationTestRecord), nil
+	}
+}
+
+func (s simulationTestRecordDo) FirstOrCreate() (*model.SimulationTestRecord, error) {
+	if result, err := s.DO.FirstOrCreate(); err != nil {
+		return nil, err
+	} else {
+		return result.(*model.SimulationTestRecord), nil
+	}
+}
+
+func (s simulationTestRecordDo) FindByPage(offset int, limit int) (result []*model.SimulationTestRecord, count int64, err error) {
+	result, err = s.Offset(offset).Limit(limit).Find()
+	if err != nil {
+		return
+	}
+
+	if size := len(result); 0 < limit && 0 < size && size < limit {
+		count = int64(size + offset)
+		return
+	}
+
+	count, err = s.Offset(-1).Limit(-1).Count()
+	return
+}
+
+func (s simulationTestRecordDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
+	count, err = s.Count()
+	if err != nil {
+		return
+	}
+
+	err = s.Offset(offset).Limit(limit).Scan(result)
+	return
+}
+
+func (s simulationTestRecordDo) Scan(result interface{}) (err error) {
+	return s.DO.Scan(result)
+}
+
+func (s simulationTestRecordDo) Delete(models ...*model.SimulationTestRecord) (result gen.ResultInfo, err error) {
+	return s.DO.Delete(models)
+}
+
+func (s *simulationTestRecordDo) withDO(do gen.Dao) *simulationTestRecordDo {
+	s.DO = *do.(*gen.DO)
+	return s
+}

+ 408 - 0
biz/dal/query/world.gen.go

@@ -0,0 +1,408 @@
+// Code generated by gorm.io/gen. DO NOT EDIT.
+// Code generated by gorm.io/gen. DO NOT EDIT.
+// Code generated by gorm.io/gen. DO NOT EDIT.
+
+package query
+
+import (
+	"context"
+
+	"gorm.io/gorm"
+	"gorm.io/gorm/clause"
+	"gorm.io/gorm/schema"
+
+	"gorm.io/gen"
+	"gorm.io/gen/field"
+
+	"gorm.io/plugin/dbresolver"
+
+	"pji_desktop_http/biz/model"
+)
+
+func newWorld(db *gorm.DB, opts ...gen.DOOption) world {
+	_world := world{}
+
+	_world.worldDo.UseDB(db, opts...)
+	_world.worldDo.UseModel(&model.World{})
+
+	tableName := _world.worldDo.TableName()
+	_world.ALL = field.NewAsterisk(tableName)
+	_world.ID = field.NewString(tableName, "id")
+	_world.SceneID = field.NewString(tableName, "scene_id")
+	_world.WorldURL = field.NewString(tableName, "world_url")
+	_world.CreatedAt = field.NewTime(tableName, "created_at")
+	_world.UpdatedAt = field.NewTime(tableName, "updated_at")
+	_world.DeletedAt = field.NewField(tableName, "deleted_at")
+
+	_world.fillFieldMap()
+
+	return _world
+}
+
+type world struct {
+	worldDo worldDo
+
+	ALL       field.Asterisk
+	ID        field.String
+	SceneID   field.String
+	WorldURL  field.String
+	CreatedAt field.Time
+	UpdatedAt field.Time
+	DeletedAt field.Field
+
+	fieldMap map[string]field.Expr
+}
+
+func (w world) Table(newTableName string) *world {
+	w.worldDo.UseTable(newTableName)
+	return w.updateTableName(newTableName)
+}
+
+func (w world) As(alias string) *world {
+	w.worldDo.DO = *(w.worldDo.As(alias).(*gen.DO))
+	return w.updateTableName(alias)
+}
+
+func (w *world) updateTableName(table string) *world {
+	w.ALL = field.NewAsterisk(table)
+	w.ID = field.NewString(table, "id")
+	w.SceneID = field.NewString(table, "scene_id")
+	w.WorldURL = field.NewString(table, "world_url")
+	w.CreatedAt = field.NewTime(table, "created_at")
+	w.UpdatedAt = field.NewTime(table, "updated_at")
+	w.DeletedAt = field.NewField(table, "deleted_at")
+
+	w.fillFieldMap()
+
+	return w
+}
+
+func (w *world) WithContext(ctx context.Context) IWorldDo { return w.worldDo.WithContext(ctx) }
+
+func (w world) TableName() string { return w.worldDo.TableName() }
+
+func (w world) Alias() string { return w.worldDo.Alias() }
+
+func (w world) Columns(cols ...field.Expr) gen.Columns { return w.worldDo.Columns(cols...) }
+
+func (w *world) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
+	_f, ok := w.fieldMap[fieldName]
+	if !ok || _f == nil {
+		return nil, false
+	}
+	_oe, ok := _f.(field.OrderExpr)
+	return _oe, ok
+}
+
+func (w *world) fillFieldMap() {
+	w.fieldMap = make(map[string]field.Expr, 6)
+	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
+}
+
+func (w world) clone(db *gorm.DB) world {
+	w.worldDo.ReplaceConnPool(db.Statement.ConnPool)
+	return w
+}
+
+func (w world) replaceDB(db *gorm.DB) world {
+	w.worldDo.ReplaceDB(db)
+	return w
+}
+
+type worldDo struct{ gen.DO }
+
+type IWorldDo interface {
+	gen.SubQuery
+	Debug() IWorldDo
+	WithContext(ctx context.Context) IWorldDo
+	WithResult(fc func(tx gen.Dao)) gen.ResultInfo
+	ReplaceDB(db *gorm.DB)
+	ReadDB() IWorldDo
+	WriteDB() IWorldDo
+	As(alias string) gen.Dao
+	Session(config *gorm.Session) IWorldDo
+	Columns(cols ...field.Expr) gen.Columns
+	Clauses(conds ...clause.Expression) IWorldDo
+	Not(conds ...gen.Condition) IWorldDo
+	Or(conds ...gen.Condition) IWorldDo
+	Select(conds ...field.Expr) IWorldDo
+	Where(conds ...gen.Condition) IWorldDo
+	Order(conds ...field.Expr) IWorldDo
+	Distinct(cols ...field.Expr) IWorldDo
+	Omit(cols ...field.Expr) IWorldDo
+	Join(table schema.Tabler, on ...field.Expr) IWorldDo
+	LeftJoin(table schema.Tabler, on ...field.Expr) IWorldDo
+	RightJoin(table schema.Tabler, on ...field.Expr) IWorldDo
+	Group(cols ...field.Expr) IWorldDo
+	Having(conds ...gen.Condition) IWorldDo
+	Limit(limit int) IWorldDo
+	Offset(offset int) IWorldDo
+	Count() (count int64, err error)
+	Scopes(funcs ...func(gen.Dao) gen.Dao) IWorldDo
+	Unscoped() IWorldDo
+	Create(values ...*model.World) error
+	CreateInBatches(values []*model.World, batchSize int) error
+	Save(values ...*model.World) error
+	First() (*model.World, error)
+	Take() (*model.World, error)
+	Last() (*model.World, error)
+	Find() ([]*model.World, error)
+	FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.World, err error)
+	FindInBatches(result *[]*model.World, batchSize int, fc func(tx gen.Dao, batch int) error) error
+	Pluck(column field.Expr, dest interface{}) error
+	Delete(...*model.World) (info gen.ResultInfo, err error)
+	Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
+	UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
+	Updates(value interface{}) (info gen.ResultInfo, err error)
+	UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
+	UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
+	UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
+	UpdateFrom(q gen.SubQuery) gen.Dao
+	Attrs(attrs ...field.AssignExpr) IWorldDo
+	Assign(attrs ...field.AssignExpr) IWorldDo
+	Joins(fields ...field.RelationField) IWorldDo
+	Preload(fields ...field.RelationField) IWorldDo
+	FirstOrInit() (*model.World, error)
+	FirstOrCreate() (*model.World, error)
+	FindByPage(offset int, limit int) (result []*model.World, count int64, err error)
+	ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
+	Scan(result interface{}) (err error)
+	Returning(value interface{}, columns ...string) IWorldDo
+	UnderlyingDB() *gorm.DB
+	schema.Tabler
+}
+
+func (w worldDo) Debug() IWorldDo {
+	return w.withDO(w.DO.Debug())
+}
+
+func (w worldDo) WithContext(ctx context.Context) IWorldDo {
+	return w.withDO(w.DO.WithContext(ctx))
+}
+
+func (w worldDo) ReadDB() IWorldDo {
+	return w.Clauses(dbresolver.Read)
+}
+
+func (w worldDo) WriteDB() IWorldDo {
+	return w.Clauses(dbresolver.Write)
+}
+
+func (w worldDo) Session(config *gorm.Session) IWorldDo {
+	return w.withDO(w.DO.Session(config))
+}
+
+func (w worldDo) Clauses(conds ...clause.Expression) IWorldDo {
+	return w.withDO(w.DO.Clauses(conds...))
+}
+
+func (w worldDo) Returning(value interface{}, columns ...string) IWorldDo {
+	return w.withDO(w.DO.Returning(value, columns...))
+}
+
+func (w worldDo) Not(conds ...gen.Condition) IWorldDo {
+	return w.withDO(w.DO.Not(conds...))
+}
+
+func (w worldDo) Or(conds ...gen.Condition) IWorldDo {
+	return w.withDO(w.DO.Or(conds...))
+}
+
+func (w worldDo) Select(conds ...field.Expr) IWorldDo {
+	return w.withDO(w.DO.Select(conds...))
+}
+
+func (w worldDo) Where(conds ...gen.Condition) IWorldDo {
+	return w.withDO(w.DO.Where(conds...))
+}
+
+func (w worldDo) Order(conds ...field.Expr) IWorldDo {
+	return w.withDO(w.DO.Order(conds...))
+}
+
+func (w worldDo) Distinct(cols ...field.Expr) IWorldDo {
+	return w.withDO(w.DO.Distinct(cols...))
+}
+
+func (w worldDo) Omit(cols ...field.Expr) IWorldDo {
+	return w.withDO(w.DO.Omit(cols...))
+}
+
+func (w worldDo) Join(table schema.Tabler, on ...field.Expr) IWorldDo {
+	return w.withDO(w.DO.Join(table, on...))
+}
+
+func (w worldDo) LeftJoin(table schema.Tabler, on ...field.Expr) IWorldDo {
+	return w.withDO(w.DO.LeftJoin(table, on...))
+}
+
+func (w worldDo) RightJoin(table schema.Tabler, on ...field.Expr) IWorldDo {
+	return w.withDO(w.DO.RightJoin(table, on...))
+}
+
+func (w worldDo) Group(cols ...field.Expr) IWorldDo {
+	return w.withDO(w.DO.Group(cols...))
+}
+
+func (w worldDo) Having(conds ...gen.Condition) IWorldDo {
+	return w.withDO(w.DO.Having(conds...))
+}
+
+func (w worldDo) Limit(limit int) IWorldDo {
+	return w.withDO(w.DO.Limit(limit))
+}
+
+func (w worldDo) Offset(offset int) IWorldDo {
+	return w.withDO(w.DO.Offset(offset))
+}
+
+func (w worldDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IWorldDo {
+	return w.withDO(w.DO.Scopes(funcs...))
+}
+
+func (w worldDo) Unscoped() IWorldDo {
+	return w.withDO(w.DO.Unscoped())
+}
+
+func (w worldDo) Create(values ...*model.World) error {
+	if len(values) == 0 {
+		return nil
+	}
+	return w.DO.Create(values)
+}
+
+func (w worldDo) CreateInBatches(values []*model.World, batchSize int) error {
+	return w.DO.CreateInBatches(values, batchSize)
+}
+
+// Save : !!! underlying implementation is different with GORM
+// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
+func (w worldDo) Save(values ...*model.World) error {
+	if len(values) == 0 {
+		return nil
+	}
+	return w.DO.Save(values)
+}
+
+func (w worldDo) First() (*model.World, error) {
+	if result, err := w.DO.First(); err != nil {
+		return nil, err
+	} else {
+		return result.(*model.World), nil
+	}
+}
+
+func (w worldDo) Take() (*model.World, error) {
+	if result, err := w.DO.Take(); err != nil {
+		return nil, err
+	} else {
+		return result.(*model.World), nil
+	}
+}
+
+func (w worldDo) Last() (*model.World, error) {
+	if result, err := w.DO.Last(); err != nil {
+		return nil, err
+	} else {
+		return result.(*model.World), nil
+	}
+}
+
+func (w worldDo) Find() ([]*model.World, error) {
+	result, err := w.DO.Find()
+	return result.([]*model.World), err
+}
+
+func (w worldDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.World, err error) {
+	buf := make([]*model.World, 0, batchSize)
+	err = w.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
+		defer func() { results = append(results, buf...) }()
+		return fc(tx, batch)
+	})
+	return results, err
+}
+
+func (w worldDo) FindInBatches(result *[]*model.World, batchSize int, fc func(tx gen.Dao, batch int) error) error {
+	return w.DO.FindInBatches(result, batchSize, fc)
+}
+
+func (w worldDo) Attrs(attrs ...field.AssignExpr) IWorldDo {
+	return w.withDO(w.DO.Attrs(attrs...))
+}
+
+func (w worldDo) Assign(attrs ...field.AssignExpr) IWorldDo {
+	return w.withDO(w.DO.Assign(attrs...))
+}
+
+func (w worldDo) Joins(fields ...field.RelationField) IWorldDo {
+	for _, _f := range fields {
+		w = *w.withDO(w.DO.Joins(_f))
+	}
+	return &w
+}
+
+func (w worldDo) Preload(fields ...field.RelationField) IWorldDo {
+	for _, _f := range fields {
+		w = *w.withDO(w.DO.Preload(_f))
+	}
+	return &w
+}
+
+func (w worldDo) FirstOrInit() (*model.World, error) {
+	if result, err := w.DO.FirstOrInit(); err != nil {
+		return nil, err
+	} else {
+		return result.(*model.World), nil
+	}
+}
+
+func (w worldDo) FirstOrCreate() (*model.World, error) {
+	if result, err := w.DO.FirstOrCreate(); err != nil {
+		return nil, err
+	} else {
+		return result.(*model.World), nil
+	}
+}
+
+func (w worldDo) FindByPage(offset int, limit int) (result []*model.World, count int64, err error) {
+	result, err = w.Offset(offset).Limit(limit).Find()
+	if err != nil {
+		return
+	}
+
+	if size := len(result); 0 < limit && 0 < size && size < limit {
+		count = int64(size + offset)
+		return
+	}
+
+	count, err = w.Offset(-1).Limit(-1).Count()
+	return
+}
+
+func (w worldDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
+	count, err = w.Count()
+	if err != nil {
+		return
+	}
+
+	err = w.Offset(offset).Limit(limit).Scan(result)
+	return
+}
+
+func (w worldDo) Scan(result interface{}) (err error) {
+	return w.DO.Scan(result)
+}
+
+func (w worldDo) Delete(models ...*model.World) (result gen.ResultInfo, err error) {
+	return w.DO.Delete(models)
+}
+
+func (w *worldDo) withDO(do gen.Dao) *worldDo {
+	w.DO = *do.(*gen.DO)
+	return w
+}

+ 1 - 1
biz/handler/map_service/map_service.go

@@ -71,7 +71,7 @@ func CheckMapBufConsistency(ctx context.Context, c *app.RequestContext) {
 // DownloadOSSFile 根据objectKey下载指定的oss文件
 // @router /map/downloadossfile [GET]
 func DownloadOSSFile(ctx context.Context, c *app.RequestContext) {
-	objectKey := "pjibot/pjibot-P1YNYD1M229000129/data_merge/2024-07-10-09-08-58_obstacledetection_30.bag"
+	objectKey := c.Query("objectKey")
 	// 从OSS下载文件
 	reader, err := config.OssBucket.GetObject(objectKey)
 

+ 56 - 0
biz/handler/world_service/world_service.go

@@ -0,0 +1,56 @@
+package world_service
+
+import (
+	"context"
+	"fmt"
+	"github.com/cloudwego/hertz/pkg/app"
+	"github.com/cloudwego/hertz/pkg/protocol/consts"
+	uuid "github.com/satori/go.uuid"
+	"net/http"
+	"pji_desktop_http/biz/dal/mysql"
+	"pji_desktop_http/biz/model"
+	"pji_desktop_http/common/config"
+	"pji_desktop_http/common/config/c_log"
+	"pji_desktop_http/common/entity"
+)
+
+// UploadWorldFile 将world文件上传到oss
+// @router /world/uploadworldfile [GET]
+func UploadWorldFile(ctx context.Context, c *app.RequestContext) {
+
+	equipmentNo := c.Query("equipmentNo")
+	fmt.Println("equipmentNo", equipmentNo)
+
+	sceneNo := c.Query("sceneNo")
+	fmt.Println("sceneNo", sceneNo)
+
+	header, err := c.FormFile("file")
+	if err != nil {
+		c.String(http.StatusBadRequest, fmt.Sprintf("get form err: %s", err.Error()))
+		return
+	}
+
+	fileName := header.Filename
+	fmt.Println("filename", fileName)
+
+	ossWorldObjectKey := config.WorldOssBasePrefix + "/" + equipmentNo + "/" + sceneNo + "/" + "map.world"
+	fmt.Println("ossWorldObjectKey", ossWorldObjectKey)
+
+	f, _ := header.Open()
+	defer f.Close()
+
+	config.OssMutex.Lock()
+	err = config.OssBucket.PutObject(ossWorldObjectKey, f)
+	config.OssMutex.Unlock()
+	if err != nil {
+		c_log.GlobalLogger.Error("程序异常退出。上传world文件", fileName, "->", ossWorldObjectKey, "出错:", err)
+		c.JSON(consts.StatusOK, entity.HttpResult{Status: false, Code: "", Message: "上传world文件失败"})
+		return
+	}
+	c_log.GlobalLogger.Info("上传world文件", fileName, "->", ossWorldObjectKey, "成功。")
+	c.JSON(consts.StatusOK, entity.HttpResult{Status: true, Code: "", Message: "上传world文件成功"})
+
+	// 保存world记录到数据库
+	world := model.World{ID: uuid.NewV1().String(), SceneID: sceneNo, WorldURL: ossWorldObjectKey}
+	mysql.TestAddWorld(ctx, world)
+}

+ 38 - 0
biz/model/map_update.go

@@ -0,0 +1,38 @@
+// Code generated by gorm.io/gen. DO NOT EDIT.
+// Code generated by gorm.io/gen. DO NOT EDIT.
+// Code generated by gorm.io/gen. DO NOT EDIT.
+
+package model
+
+import (
+	"time"
+
+	"gorm.io/gorm"
+)
+
+const TableNameMapUpdate = "map_update"
+
+// MapUpdate mapped from table <map_update>
+type MapUpdate struct {
+	ID                   string         `gorm:"column:id;type:varchar(100);primaryKey" json:"id"`
+	MapID                string         `gorm:"column:map_id;type:varchar(100);not null" json:"map_id"`
+	DeviceID             string         `gorm:"column:device_id;type:varchar(100);not null" json:"device_id"`
+	DeviceName           string         `gorm:"column:device_name;type:varchar(100);not null" json:"device_name"`
+	DeviceType           string         `gorm:"column:device_type;type:varchar(100);not null" json:"device_type"`
+	OriginPgmPath        string         `gorm:"column:origin_pgm_path;type:varchar(255);not null" json:"origin_pgm_path"`
+	PrePgmPath           string         `gorm:"column:pre_pgm_path;type:varchar(255);not null" json:"pre_pgm_path"`
+	CurrentPgmPath       string         `gorm:"column:current_pgm_path;type:varchar(255);not null" json:"current_pgm_path"`
+	CumulativeUpdateRate int32          `gorm:"column:cumulative_update_rate;type:int(11);not null" json:"cumulative_update_rate"`
+	UpdateFlag           int32          `gorm:"column:update_flag;type:int(11);not null" json:"update_flag"`
+	UpdateSource         *int32         `gorm:"column:update_source;type:int(11)" json:"update_source"`
+	FromSceneList        *string        `gorm:"column:from_scene_list;type:varchar(255)" json:"from_scene_list"`
+	ValidFlag            int32          `gorm:"column:valid_flag;type:int(11);not null" json:"valid_flag"`
+	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"`
+}
+
+// TableName MapUpdate's table name
+func (*MapUpdate) TableName() string {
+	return TableNameMapUpdate
+}

+ 38 - 0
biz/model/simulation_test_record.go

@@ -0,0 +1,38 @@
+// Code generated by gorm.io/gen. DO NOT EDIT.
+// Code generated by gorm.io/gen. DO NOT EDIT.
+// Code generated by gorm.io/gen. DO NOT EDIT.
+
+package model
+
+import (
+	"time"
+
+	"gorm.io/gorm"
+)
+
+const TableNameSimulationTestRecord = "simulation_test_record"
+
+// SimulationTestRecord mapped from table <simulation_test_record>
+type SimulationTestRecord struct {
+	ID                   string         `gorm:"column:id;type:varchar(100);primaryKey" json:"id"`
+	DeviceID             string         `gorm:"column:device_id;type:varchar(100);not null" json:"device_id"`
+	DeviceName           string         `gorm:"column:device_name;type:varchar(100);not null" json:"device_name"`
+	DeviceType           string         `gorm:"column:device_type;type:varchar(100);not null" json:"device_type"`
+	AlgoImageName        string         `gorm:"column:algo_image_name;type:varchar(100);not null" json:"algo_image_name"`
+	AlgoVersion          string         `gorm:"column:algo_version;type:varchar(50);not null" json:"algo_version"`
+	PgmPath              string         `gorm:"column:pgm_path;type:varchar(255);not null" json:"pgm_path"`
+	WorldPath            string         `gorm:"column:world_path;type:varchar(255);not null" json:"world_path"`
+	TestBagPath          string         `gorm:"column:test_bag_path;type:varchar(255);not null" json:"test_bag_path"`
+	TestDuration         int32          `gorm:"column:test_duration;type:int(11);not null" json:"test_duration"`
+	TestDistance         int32          `gorm:"column:test_distance;type:int(11);not null" json:"test_distance"`
+	AlgoEvaluationLevel  string         `gorm:"column:algo_evaluation_level;type:varchar(50);not null" json:"algo_evaluation_level"`
+	AlgoEvaluationReport string         `gorm:"column:algo_evaluation_report;type:varchar(100);not null" json:"algo_evaluation_report"`
+	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"`
+}
+
+// TableName SimulationTestRecord's table name
+func (*SimulationTestRecord) TableName() string {
+	return TableNameSimulationTestRecord
+}

+ 28 - 0
biz/model/world.go

@@ -0,0 +1,28 @@
+// Code generated by gorm.io/gen. DO NOT EDIT.
+// Code generated by gorm.io/gen. DO NOT EDIT.
+// Code generated by gorm.io/gen. DO NOT EDIT.
+
+package model
+
+import (
+	"time"
+
+	"gorm.io/gorm"
+)
+
+const TableNameWorld = "world"
+
+// World mapped from table <world>
+type World struct {
+	ID        string         `gorm:"column:id;type:varchar(100);primaryKey" json:"id"`
+	SceneID   string         `gorm:"column:scene_id;type:varchar(100);not null" json:"scene_id"`
+	WorldURL  string         `gorm:"column:world_url;type:varchar(255);not null" json:"world_url"`
+	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"`
+}
+
+// TableName World's table name
+func (*World) TableName() string {
+	return TableNameWorld
+}

+ 4 - 0
common/config/c_oss.go

@@ -20,6 +20,10 @@ var (
 	OssMutex  sync.Mutex
 )
 
+var (
+	WorldOssBasePrefix = "world"
+)
+
 func InitOssConfig() {
 	var err error
 	c_log.GlobalLogger.Info("初始化OSS客户端对象 - 开始。")

+ 59 - 0
gen/main.go

@@ -0,0 +1,59 @@
+package main
+
+import (
+	"fmt"
+	"gorm.io/driver/mysql"
+	"gorm.io/gen"
+	"gorm.io/gorm"
+)
+
+var dsn = "root:1qaz2wsx!@tcp(36.110.106.156:3306)/pji_desktop?charset=utf8&parseTime=True&loc=Local"
+
+func main() {
+
+	// 连接数据库
+	db, err := gorm.Open(mysql.Open(dsn))
+	if err != nil {
+		panic(fmt.Errorf("cannot establish db connection: %w", err))
+	}
+
+	// 生成实例
+	g := gen.NewGenerator(gen.Config{
+		// 相对执行`go run`时的路径, 会自动创建目录
+		OutPath: "dal/query",
+
+		// WithDefaultQuery 生成默认查询结构体(作为全局变量使用), 即`Q`结构体和其字段(各表模型)
+		// WithoutContext 生成没有context调用限制的代码供查询
+		// WithQueryInterface 生成interface形式的查询代码(可导出), 如`Where()`方法返回的就是一个可导出的接口类型
+		Mode: gen.WithDefaultQuery | gen.WithQueryInterface,
+
+		// 表字段可为 null 值时, 对应结体字段使用指针类型
+		FieldNullable: true, // generate pointer when field is nullable
+
+		// 表字段默认值与模型结构体字段零值不一致的字段, 在插入数据时需要赋值该字段值为零值的, 结构体字段须是指针类型才能成功, 即`FieldCoverable:true`配置下生成的结构体字段.
+		// 因为在插入时遇到字段为零值的会被GORM赋予默认值. 如字段`age`表默认值为10, 即使你显式设置为0最后也会被GORM设为10提交.
+		// 如果该字段没有上面提到的插入时赋零值的特殊需要, 则字段为非指针类型使用起来会比较方便.
+		FieldCoverable: false, // generate pointer when field has default value, to fix problem zero value cannot be assign: https://gorm.io/docs/create.html#Default-Values
+
+		// 模型结构体字段的数字类型的符号表示是否与表字段的一致, `false`指示都用有符号类型
+		FieldSignable: false, // detect integer field's unsigned type, adjust generated data type
+		// 生成 gorm 标签的字段索引属性
+		FieldWithIndexTag: false, // generate with gorm index tag
+		// 生成 gorm 标签的字段类型属性
+		FieldWithTypeTag: true, // generate with gorm column type tag
+	})
+
+	// 设置目标 db
+	g.UseDB(db)
+
+	// 创建模型文件
+	//User := g.GenerateModel("users")
+	MapUpdate := g.GenerateModel("map_update")
+	World := g.GenerateModel("world")
+	SimulationTestRecord := g.GenerateModel("simulation_test_record")
+
+	// 创建模型的方法,生成文件在 query 目录; 先创建结果不会被后创建的覆盖
+	g.ApplyBasic(MapUpdate, World, SimulationTestRecord)
+
+	g.Execute()
+}

+ 12 - 4
go.mod

@@ -14,7 +14,9 @@ require (
 	github.com/sirupsen/logrus v1.9.3
 	google.golang.org/protobuf v1.34.2
 	gorm.io/driver/mysql v1.5.7
+	gorm.io/gen v0.3.26
 	gorm.io/gorm v1.25.11
+	gorm.io/plugin/dbresolver v1.5.2
 )
 
 require (
@@ -47,6 +49,7 @@ require (
 	github.com/modern-go/reflect2 v1.0.2 // indirect
 	github.com/nyaruka/phonenumbers v1.0.55 // indirect
 	github.com/pelletier/go-toml/v2 v2.2.2 // indirect
+	github.com/satori/go.uuid v1.2.0 // indirect
 	github.com/tidwall/gjson v1.14.4 // indirect
 	github.com/tidwall/match v1.1.1 // indirect
 	github.com/tidwall/pretty v1.2.0 // indirect
@@ -56,10 +59,15 @@ require (
 	github.com/ugorji/go/codec v1.2.12 // indirect
 	github.com/yusufpapurcu/wmi v1.2.4 // indirect
 	golang.org/x/arch v0.8.0 // indirect
-	golang.org/x/crypto v0.23.0 // indirect
-	golang.org/x/net v0.25.0 // indirect
-	golang.org/x/sys v0.20.0 // indirect
-	golang.org/x/text v0.15.0 // indirect
+	golang.org/x/crypto v0.26.0 // indirect
+	golang.org/x/mod v0.20.0 // indirect
+	golang.org/x/net v0.28.0 // indirect
+	golang.org/x/sync v0.8.0 // indirect
+	golang.org/x/sys v0.23.0 // indirect
+	golang.org/x/text v0.17.0 // indirect
 	golang.org/x/time v0.5.0 // indirect
+	golang.org/x/tools v0.24.0 // indirect
 	gopkg.in/yaml.v3 v3.0.1 // indirect
+	gorm.io/datatypes v1.2.1 // indirect
+	gorm.io/hints v1.1.2 // indirect
 )

+ 51 - 10
go.sum

@@ -52,11 +52,16 @@ github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpv
 github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
 github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
 github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
+github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA=
+github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
+github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A=
+github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI=
 github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
 github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4=
 github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
-github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
 github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
+github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
 github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
 github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
 github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
@@ -69,6 +74,14 @@ github.com/henrylee2cn/goutil v0.0.0-20210127050712-89660552f6f8 h1:yE9ULgp02BhY
 github.com/henrylee2cn/goutil v0.0.0-20210127050712-89660552f6f8/go.mod h1:Nhe/DM3671a5udlv2AdV2ni/MZzgfv2qrPL5nIi3EGQ=
 github.com/hertz-contrib/cors v0.1.0 h1:PQ5mATygSMzTlYtfyMyHjobYoJeHKe2Qt3tcAOgbI6E=
 github.com/hertz-contrib/cors v0.1.0/go.mod h1:VPReoq+Rvu/lZOfpp5CcX3x4mpZUc3EpSXBcVDcbvOc=
+github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
+github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
+github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 h1:L0QtFUgDarD7Fpv9jeVMgy/+Ec0mtnmYuImjTz6dtDA=
+github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
+github.com/jackc/pgx/v5 v5.5.5 h1:amBjrZVmksIdNjxGW/IiIMzxMKZFelXbUoPNb+8sjQw=
+github.com/jackc/pgx/v5 v5.5.5/go.mod h1:ez9gk+OAat140fv9ErkZDYFWmXLfV+++K0uAOiwgm1A=
+github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk=
+github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
 github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
 github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
 github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
@@ -89,8 +102,12 @@ github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
 github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
 github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
 github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
+github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
+github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
 github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
 github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
+github.com/microsoft/go-mssqldb v0.17.0 h1:Fto83dMZPnYv1Zwx5vHHxpNraeEaUlQ/hhHLgZiaenE=
+github.com/microsoft/go-mssqldb v0.17.0/go.mod h1:OkoNGhGEs8EZqchVTtochlXruEhEOaO4S0d2sB5aeGQ=
 github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
 github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
 github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -102,6 +119,8 @@ github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6
 github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
+github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
 github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI=
 github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
 github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
@@ -147,12 +166,16 @@ golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUu
 golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc=
 golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
 golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
-golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
-golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
+golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
+golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
+golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0=
+golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
 golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
-golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
-golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
+golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
+golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
 golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
+golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
 golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20220110181412-a018aaa089fe/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -160,15 +183,16 @@ golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBc
 golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
-golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
+golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM=
+golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
 golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
-golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
-golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
+golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
+golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
 golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
 golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
 golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
-golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
+golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24=
+golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ=
 golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
 google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
 google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
@@ -180,10 +204,27 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
 gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
 gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gorm.io/datatypes v1.2.1 h1:r+g0bk4LPCW2v4+Ls7aeNgGme7JYdNDQ2VtvlNUfBh0=
+gorm.io/datatypes v1.2.1/go.mod h1:hYK6OTb/1x+m96PgoZZq10UXJ6RvEBb9kRDQ2yyhzGs=
+gorm.io/driver/mysql v1.5.6/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM=
 gorm.io/driver/mysql v1.5.7 h1:MndhOPYOfEp2rHKgkZIhJ16eVUIRf2HmzgoPmh7FCWo=
 gorm.io/driver/mysql v1.5.7/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM=
+gorm.io/driver/postgres v1.5.0 h1:u2FXTy14l45qc3UeCJ7QaAXZmZfDDv0YrthvmRq1l0U=
+gorm.io/driver/postgres v1.5.0/go.mod h1:FUZXzO+5Uqg5zzwzv4KK49R8lvGIyscBOqYrtI1Ce9A=
+gorm.io/driver/sqlite v1.5.0 h1:zKYbzRCpBrT1bNijRnxLDJWPjVfImGEn0lSnUY5gZ+c=
+gorm.io/driver/sqlite v1.5.0/go.mod h1:kDMDfntV9u/vuMmz8APHtHF0b4nyBB7sfCieC6G8k8I=
+gorm.io/driver/sqlserver v1.4.1 h1:t4r4r6Jam5E6ejqP7N82qAJIJAht27EGT41HyPfXRw0=
+gorm.io/driver/sqlserver v1.4.1/go.mod h1:DJ4P+MeZbc5rvY58PnmN1Lnyvb5gw5NPzGshHDnJLig=
+gorm.io/gen v0.3.26 h1:sFf1j7vNStimPRRAtH4zz5NiHM+1dr6eA9aaRdplyhY=
+gorm.io/gen v0.3.26/go.mod h1:a5lq5y3w4g5LMxBcw0wnO6tYUCdNutWODq5LrIt75LE=
+gorm.io/gorm v1.24.7-0.20230306060331-85eaf9eeda11/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=
+gorm.io/gorm v1.25.0/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=
 gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
 gorm.io/gorm v1.25.11 h1:/Wfyg1B/je1hnDx3sMkX+gAlxrlZpn6X0BXRlwXlvHg=
 gorm.io/gorm v1.25.11/go.mod h1:xh7N7RHfYlNc5EmcI/El95gXusucDrQnHXe0+CgWcLQ=
+gorm.io/hints v1.1.2 h1:b5j0kwk5p4+3BtDtYqqfY+ATSxjj+6ptPgVveuynn9o=
+gorm.io/hints v1.1.2/go.mod h1:/ARdpUHAtyEMCh5NNi3tI7FsGh+Cj/MIUlvNxCNCFWg=
+gorm.io/plugin/dbresolver v1.5.2 h1:Iut7lW4TXNoVs++I+ra3zxjSxTRj4ocIeFEVp4lLhII=
+gorm.io/plugin/dbresolver v1.5.2/go.mod h1:jPh59GOQbO7v7v28ZKZPd45tr+u3vyT+8tHdfdfOWcU=
 nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
 rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=

+ 3 - 0
router.go

@@ -7,6 +7,7 @@ import (
 	handler "pji_desktop_http/biz/handler"
 	"pji_desktop_http/biz/handler/map_service"
 	"pji_desktop_http/biz/handler/user_service"
+	"pji_desktop_http/biz/handler/world_service"
 )
 
 // customizeRegister registers customize routers.
@@ -23,4 +24,6 @@ func customizedRegister(r *server.Hertz) {
 
 	r.GET("/map/downloadmapbagfile", map_service.DownLoadMapBagFile)
 
+	r.GET("/world/uploadworldfile", world_service.UploadWorldFile)
+
 }