1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- package model
- import (
- "git.getensh.com/common/gopkgsv2/database"
- "gorm.io/gorm"
- )
- type Dws9Model interface {
- Get(db *gorm.DB) (*Dws9, error)
- List(db *gorm.DB) ([]Dws9, error)
- }
- type Dws9 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 defaultDws9Model struct {
- tableName string
- fields string
- }
- func NewDws9Model() Dws9Model {
- return &defaultDws9Model{
- "t_adm_dws9",
- "id, vin, third_style_id, source",
- }
- }
- func (d *defaultDws9Model) Get(db *gorm.DB) (*Dws9, error) {
- var res Dws9
- err := database.Get(db, &res, database.Option{
- TableName: d.tableName,
- Fields: d.fields,
- })
- return &res, err
- }
- func (d *defaultDws9Model) List(db *gorm.DB) ([]Dws9, error) {
- var res []Dws9
- err := database.List(db, &res, database.Option{
- TableName: d.tableName,
- Fields: d.fields,
- })
- return res, err
- }
|