table.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /**
  2. #*****************************************************************************
  3. # @file table.go
  4. # @author MakerYang(https://www.makeryang.com)
  5. # @statement 免费课程配套开源项目,任何形式收费均为盗版
  6. #*****************************************************************************
  7. */
  8. package GameMapData
  9. import (
  10. "Game/framework/database"
  11. )
  12. var TableName = "game_map_data"
  13. type Data struct {
  14. MapId int `gorm:"primary_key;AUTO_INCREMENT;unique_index;not null;column:map_id"`
  15. MapServerId int `gorm:"column:map_server_id"`
  16. MapNumber string `gorm:"column:map_number"`
  17. MapName string `gorm:"column:map_name"`
  18. MapDefaultX int `gorm:"column:map_default_x"`
  19. MapDefaultY int `gorm:"column:map_default_y"`
  20. MapStatus int `gorm:"column:map_status"`
  21. Database.DefaultField
  22. }
  23. type Return struct {
  24. MapNumber string `json:"map_number"`
  25. MapName string `json:"map_name"`
  26. MapDefaultX int `json:"map_default_x"`
  27. MapDefaultY int `json:"map_default_y"`
  28. }
  29. func ReturnData(dataStruct *Data) Return {
  30. data := Return{}
  31. if dataStruct.MapId > 0 {
  32. data.MapNumber = dataStruct.MapNumber
  33. data.MapName = dataStruct.MapName
  34. data.MapDefaultX = dataStruct.MapDefaultX
  35. data.MapDefaultY = dataStruct.MapDefaultY
  36. }
  37. return data
  38. }