dws12.go 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package model
  2. import (
  3. "git.getensh.com/common/gopkgsv2/database"
  4. "gorm.io/gorm"
  5. )
  6. type Dws12Model interface {
  7. Get(db *gorm.DB) (*Dws12, error)
  8. }
  9. type Dws12 struct {
  10. ID int64 `gorm:"column:id" json:"id"`
  11. ModelNo string `gorm:"column:model_no" json:"model_no"`
  12. PlateType string `gorm:"column:plate_type" json:"plate_type"`
  13. VehicleType string `gorm:"column:vehicle_type" json:"vehicle_type"`
  14. VehicleTypeDetail string `gorm:"column:vehicle_type_detail" json:"vehicle_type_detail"`
  15. CreatedAt int64 `gorm:"column:created_at" json:"created_at"`
  16. UpdatedAt int64 `gorm:"column:updated_at" json:"updated_at"`
  17. }
  18. type defaultDws12Model struct {
  19. tableName string
  20. fields string
  21. }
  22. func NewDws12Model() Dws12Model {
  23. return &defaultDws12Model{
  24. "t_adm_dws12",
  25. "id, model_no, plate_type, vehicle_type, vehicle_type_detail",
  26. }
  27. }
  28. func (d *defaultDws12Model) Get(db *gorm.DB) (*Dws12, error) {
  29. var res Dws12
  30. err := database.Get(db, &res, database.Option{
  31. TableName: d.tableName,
  32. })
  33. return &res, err
  34. }