1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- package model
- import (
- "git.getensh.com/common/gopkgsv2/database"
- "gorm.io/gorm"
- )
- type Dws17Model interface {
- Get(db *gorm.DB) (*Dws17, error)
- List(db *gorm.DB) ([]Dws17, error)
- }
- type Dws17 struct {
- ID int64 `gorm:"column:id" json:"id"`
- Vin string `gorm:"column:vin" json:"vin"`
- ThirdStyleId string `gorm:"column:third_style_id" json:"third_style_id"`
- Source string `gorm:"column:source" json:"source"`
- }
- type defaultDws17Model struct {
- tableName string
- fields string
- }
- func NewDws17Model() Dws17Model {
- return &defaultDws17Model{
- "t_adm_dws17",
- "id, vin, third_style_id, source",
- }
- }
- func (d *defaultDws17Model) Get(db *gorm.DB) (*Dws17, error) {
- var res Dws17
- err := database.Get(db, &res, database.Option{
- TableName: d.tableName,
- Fields: d.fields,
- })
- return &res, err
- }
- func (d *defaultDws17Model) List(db *gorm.DB) ([]Dws17, error) {
- var res []Dws17
- err := database.List(db, &res, database.Option{
- TableName: d.tableName,
- Fields: d.fields,
- })
- return res, err
- }
|