dws11.go 769 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package model
  2. import (
  3. "git.getensh.com/common/gopkgsv2/database"
  4. "gorm.io/gorm"
  5. )
  6. type Dws11Model interface {
  7. Get(db *gorm.DB) (*AdmDws11, error)
  8. }
  9. type AdmDws11 struct {
  10. ID int64 `gorm:"column:id" json:"id"`
  11. VinRule string `gorm:"column:vin_rule" json:"vin_rule"`
  12. ModelNo string `gorm:"column:model_no" json:"model_no"`
  13. }
  14. type defaultDws11Model struct {
  15. tableName string
  16. fields string
  17. }
  18. func NewDws11Model() Dws11Model {
  19. return &defaultDws11Model{
  20. tableName: "db_adm_dws.t_adm_dws11",
  21. fields: "id, vin_rule, model_no",
  22. }
  23. }
  24. func (d *defaultDws11Model) Get(db *gorm.DB) (*AdmDws11, error) {
  25. var res AdmDws11
  26. err := database.Get(db, &res, database.Option{
  27. TableName: d.tableName,
  28. Fields: d.fields,
  29. })
  30. return &res, err
  31. }