fill_data.go 4.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. package model
  2. import (
  3. "database/sql/driver"
  4. "encoding/json"
  5. model2 "gas-cylinder-api/common/model"
  6. )
  7. type TbGasLog struct {
  8. Id string `json:"id" gorm:"size:36"` // 主键 是 UUID
  9. OrgHex string `json:"orgHex" gorm:"size:128"` // 源码字符串 是 充装枪上报源码
  10. GunCode string `json:"gunCode" gorm:"size:14"` // 枪编码 是 需要现在平台录入/接口平台上传后返回的对应id
  11. InnerCode string `json:"innerCode" gorm:"size:36"` // 气瓶唯一性编码,单位内编号 否 气瓶唯一编号
  12. ChipId string `json:"chipId" gorm:"size:14"` // 气瓶标签ID 否
  13. PersonCode string `json:"personCode" gorm:"size:36"` // 充装人员编码 否 需要先在平台录入/接口平台上传后返回的对应id
  14. ChipContent string `json:"chipContent" gorm:"size:200"` // 标签内容 否
  15. PersonFlag int `json:"personFlag" gorm:"size:4"` // 是否绑定充装人员 否 0:false;1:true
  16. ChipFlag int `json:"chipFlag" gorm:"size:4"` // 是否读到标签 否 0:false;1:true
  17. OpenStatus int `json:"openStatus" gorm:"size:4"` // 阀开关状态 否 0:open;1:close
  18. ReturnOpenStatus int `json:"returnOpenStatus" gorm:"size:4"` // 返回开关状态 否 0:open;1:close
  19. ReturnLightStatus int `json:"returnLightStatus" gorm:"size:4"` // 返回灯状态,消息码 否
  20. ReturnMsgId int `json:"returnMsgId" gorm:"size:4"` // 返回消息ID 否
  21. FillTime int `json:"fillTime" gorm:"size:4"` // 充装时长 否 单位s
  22. CreateTime string `json:"createTime" gorm:"size:19"` // 创建时间 否 格式:yyyy-MM-dd HH:mm:ss
  23. }
  24. type TbFillData struct {
  25. FillId string `json:"fillId" gorm:"size:36"` // 主键 是
  26. GunCode string `json:"gunCode" gorm:"size:14"` // 枪编码 是
  27. StationId string `json:"stationId" gorm:"size:36"` // 气站ID 否
  28. CompanyId string `json:"companyId" gorm:"size:36"` // 企业Id 否
  29. Area string `json:"area" gorm:"size:6"` // 所在区 否
  30. City string `json:"city" gorm:"size:6"` // 所在市 否
  31. UserId string `json:"userId" gorm:"size:36"` // 充装工id 否
  32. PersonCode string `json:"personCode" gorm:"size:36"` // 充装人员编码 否
  33. InnerCode string `json:"innerCode" gorm:"size:36"` // 气瓶编号 否
  34. ChipId string `json:"chipId" gorm:"size:14"` // 气瓶标签ID 否
  35. ProductId int `json:"productId" gorm:"size:4"` // 气瓶类型id 否
  36. ProductMediaId int `json:"productMediaId" gorm:"size:4"` // 充装介质id 否
  37. ChipContent string `json:"chipContent" gorm:"size:200"` // 标签内容 否
  38. FillTime string `json:"fillTime" gorm:"size:19"` // 充装时间 否 yyyy-MM-dd HH:mm:ss
  39. FillDuration int `json:"fillDuration" gorm:"size:4"` // 充装时长 否 单位s
  40. CreateTime string `json:"createTime" gorm:"size:19"` // 创建时间 否 yyyy-MM-dd HH:mm:ss
  41. }
  42. type TbGasLogList []TbGasLog
  43. type TbFillDataList []TbFillData
  44. type FillData struct {
  45. model2.Model
  46. Status int
  47. GasLog TbGasLog `json:"gasLog"`
  48. TbGasLog TbGasLog `json:"tbGasLog"`
  49. TbFillData TbFillData `json:"tbFillData"`
  50. StationId string `json:"stationId" gorm:"size:36"` // 气站ID 否
  51. CompanyId string `json:"companyId" gorm:"size:36"` // 企业Id 否
  52. UserId string `json:"userId" gorm:"size:36"` // 充装工id 否
  53. User SysUserOmit `json:"user" gorm:"->;foreignkey:UserId;references:ProvUserId"`
  54. Station SysDeptOmit `json:"station" gorm:"->;foreignkey:StationId;references:CmpCode"`
  55. Company SysDeptOmit `json:"company" gorm:"->;foreignkey:CompanyId;references:CmpCode"`
  56. model2.ControlBy
  57. model2.ModelTime
  58. model2.DeptBy
  59. }
  60. type FillDataDistinctStation struct {
  61. StationId string `json:"stationId" gorm:"size:36"` // 气站ID 否
  62. Station SysDeptOmit `json:"station" gorm:"->;foreignkey:StationId;references:CmpCode"`
  63. }
  64. type FillDataDistinctUser struct {
  65. UserId string `json:"userId" gorm:"size:36"` // 充装工id 否
  66. User SysUserOmit `json:"user" gorm:"->;foreignkey:UserId;references:ProvUserId"`
  67. }
  68. func (FillData) TableName() string {
  69. return "fill_data"
  70. }
  71. func (e TbGasLog) Value() (driver.Value, error) {
  72. d, err := json.Marshal(e)
  73. return string(d), err
  74. }
  75. func (e *TbGasLog) Scan(src interface{}) error {
  76. return json.Unmarshal(src.([]byte), e)
  77. }
  78. func (e TbFillData) Value() (driver.Value, error) {
  79. d, err := json.Marshal(e)
  80. return string(d), err
  81. }
  82. func (e *TbFillData) Scan(src interface{}) error {
  83. return json.Unmarshal(src.([]byte), e)
  84. }