You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.7 KiB
52 lines
1.7 KiB
package gys
|
|
|
|
import (
|
|
"github.com/shopspring/decimal"
|
|
"recook/internal/v2/lib/db"
|
|
)
|
|
|
|
const (
|
|
GysSourceModelBillTypeBank = 1 // 银行打款
|
|
GysSourceModelBillTypeDeposit = 2 // 预付款扣除
|
|
)
|
|
|
|
type GysSourceModel struct {
|
|
db.BaseModel
|
|
Id uint `gorm:"column:id;primary_key" json:"id"`
|
|
Name string `gorm:"column:name" json:"name"`
|
|
Order int `gorm:"column:order" json:"-"`
|
|
IsDefault int `gorm:"column:is_default" json:"isDefault"`
|
|
IsShow int `json:"isShow"`
|
|
TaxNumber string `json:"taxNumber"`
|
|
OperationAddress string `json:"operationAddress"`
|
|
Address string `json:"address"`
|
|
BankName string `json:"bankName"`
|
|
BankCode string `json:"bankCode"`
|
|
Coefficient decimal.Decimal `json:"coefficient"`
|
|
BillType uint // 结算类型 1=银行打款 2=预付款扣除
|
|
Wallet GysSourceWallet `gorm:"foreignKey:SourceId"`
|
|
SourceStatus uint `gorm:"column:source_status" json:"source_status"`
|
|
}
|
|
|
|
func (g *GysSourceModel) TableName() string {
|
|
return "gys_source"
|
|
}
|
|
|
|
// @Style 根据ids获取列表
|
|
func (g *GysSourceModel) FindById(id uint) (result GysSourceModel) {
|
|
g.GetDb().First(&result, "id = ?", id)
|
|
return
|
|
}
|
|
|
|
// @Style 根据ids获取列表
|
|
func (g *GysSourceModel) GetListsByIds(ids []uint) (result []GysSourceModel) {
|
|
g.GetDb().Model(&GysSourceModel{}).Find(&result, "id in (?)", ids)
|
|
return
|
|
}
|
|
|
|
// @Style 根据ids获取列表
|
|
func (g *GysSourceModel) GetAll() (result []GysSourceModel) {
|
|
g.GetDb().Model(&GysSourceModel{}).Find(&result)
|
|
return
|
|
}
|