scene.go 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. package models
  2. // 总场景
  3. type Scene struct {
  4. BaseModel
  5. SceneName string `gorm:"type:varchar(255);not null;comment:场景名称" json:"scene_name"` //桥梁、隧道、特种设备、加油站、高速运营公路
  6. //英文名
  7. SceneEnName string `gorm:"type:varchar(255);not null;comment:场景英文名" json:"scene_en_name"`
  8. }
  9. // TableName 指定表名
  10. func (Scene) TableName() string {
  11. return "scene"
  12. }
  13. // 一级场景
  14. type FirstScene struct {
  15. BaseModel
  16. FirstSceneName string `gorm:"type:varchar(255);not null;comment:一级场景名称" json:"first_scene_name"`
  17. SceneID int `gorm:"type:int;not null;comment:场景ID" json:"scene_id"`
  18. //关联表
  19. Scene Scene `gorm:"foreignKey:SceneID"`
  20. }
  21. // TableName 指定表名
  22. func (FirstScene) TableName() string {
  23. return "first_scene"
  24. }
  25. // 二级场景
  26. type SecondScene struct {
  27. BaseModel
  28. SecondSceneName string `gorm:"type:varchar(255);not null;comment:二级场景名称" json:"second_scene_name"`
  29. FirstSceneID int `gorm:"type:int;not null;comment:一级场景ID" json:"first_scene_id"`
  30. //关联表
  31. FirstScene FirstScene `gorm:"foreignKey:FirstSceneID"`
  32. }
  33. // TableName 指定表名
  34. func (SecondScene) TableName() string {
  35. return "second_scene"
  36. }
  37. // 三级场景
  38. type ThirdScene struct {
  39. BaseModel
  40. ThirdSceneName string `gorm:"type:varchar(255);not null;comment:三级场景名称" json:"third_scene_name"`
  41. SecondSceneID int `gorm:"type:int;not null;comment:二级场景ID" json:"second_scene_id"`
  42. //关联表
  43. SecondScene SecondScene `gorm:"foreignKey:SecondSceneID"`
  44. //正确示例图
  45. CorrectExampleImage string `gorm:"type:varchar(255);not null;comment:正确示例图" json:"correct_example_image"`
  46. //错误示例图
  47. WrongExampleImage string `gorm:"type:varchar(255);not null;comment:错误示例图" json:"wrong_example_image"`
  48. }
  49. // TableName 指定表名
  50. func (ThirdScene) TableName() string {
  51. return "third_scene"
  52. }
  53. // 识别记录
  54. type RecognitionRecord struct {
  55. BaseModel
  56. //原图地址
  57. OriginalImageUrl string `gorm:"type:text;not null;comment:原图地址" json:"original_image_url"`
  58. //识别结果图地址
  59. RecognitionImageUrl string `gorm:"type:text;not null;comment:识别结果图地址" json:"recognition_image_url"`
  60. //用户ID
  61. UserID int `gorm:"type:int;not null;comment:用户ID" json:"user_id"`
  62. //title
  63. Title string `gorm:"type:varchar(255);not null;comment:标题" json:"title"`
  64. //描述
  65. Description string `gorm:"type:text;not null;comment:描述" json:"description"`
  66. //标签
  67. Labels string `gorm:"type:varchar(255);not null;comment:标签" json:"labels"`
  68. //主标签
  69. TagType string `gorm:"type:varchar(255);not null;comment:标签类型" json:"tag_type"`
  70. //详情页的二级场景
  71. SecondScene string `gorm:"type:varchar(1000);comment:详情页的二级场景" json:"second_scene"`
  72. //详情页的三级场景
  73. ThirdScene string `gorm:"type:varchar(1000);comment:详情页的三级场景" json:"third_scene"`
  74. //评价系统
  75. //场景匹配(是/否)
  76. SceneMatch int `gorm:"type:int;not null;comment:场景匹配(0、否,1、是)" json:"scene_match"`
  77. //提示准确(是/否)
  78. TipAccuracy int `gorm:"type:int;not null;comment:提示准确(0、否,1、是)" json:"tip_accuracy"`
  79. //效果评价(1-5)
  80. EffectEvaluation int `gorm:"type:int;not null;comment:效果评价(1-5)" json:"effect_evaluation"`
  81. //用户备注
  82. UserRemark string `gorm:"type:varchar(200);comment:用户备注" json:"user_remark"`
  83. }
  84. // TableName 指定表名
  85. func (RecognitionRecord) TableName() string {
  86. return "recognition_record"
  87. }
  88. // 识别记录对应的二级场景表
  89. type RecognitionRecordSecondScene struct {
  90. BaseModel
  91. RecognitionRecordID int `gorm:"type:int;not null;comment:识别记录ID" json:"recognition_record_id"`
  92. SecondSceneID int `gorm:"type:int;not null;comment:二级场景ID" json:"second_scene_id"`
  93. //关联表
  94. SecondScene SecondScene `gorm:"foreignKey:SecondSceneID"`
  95. }
  96. // TableName 指定表名
  97. func (RecognitionRecordSecondScene) TableName() string {
  98. return "recognition_record_second_scene"
  99. }