123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- package model
- import (
- "git.getensh.com/common/gopkgsv2/database"
- "gorm.io/gorm"
- )
- type Dws10Model interface {
- Get(db *gorm.DB) (*Dws10, error)
- List(db *gorm.DB) ([]Dws10, error)
- }
- type Dws10 struct {
- ID int64 `gorm:"column:id" json:"id"`
- ModelNo string `gorm:"column:model_no" json:"model_no"`
- SpySeriesId string `gorm:"column:spy_series_id" json:"spy_series_id"`
- SeriesId string `gorm:"column:series_id" json:"series_id"`
- ModelYear string `gorm:"column:model_year" json:"model_year"`
- DisplacementL string `gorm:"column:displacement_l" json:"displacement_l"`
- Vin10 string `gorm:"column:vin10" json:"vin10"`
- AirIntakForm string `gorm:"column:air_intak_form" json:"air_intak_form"`
- VinRule string `gorm:"column:vin_rule" json:"vin_rule"`
- }
- type defaultDws10Model struct {
- tableName string
- }
- func NewDws10Model() Dws10Model {
- return &defaultDws10Model{
- "t_adm_dws10",
- }
- }
- func (d *defaultDws10Model) Get(db *gorm.DB) (*Dws10, error) {
- var res Dws10
- err := database.Get(db, &res, database.Option{
- TableName: d.tableName,
- OrderBy: "model_year DESC",
- })
- return &res, err
- }
- func (d *defaultDws10Model) List(db *gorm.DB) ([]Dws10, error) {
- var res []Dws10
- err := database.List(db, &res, database.Option{
- TableName: d.tableName,
- })
- return res, err
- }
|