package fms import ( "hongze/fms_api/global" "hongze/fms_api/models/base" ) // 合同套餐金额表 type ContractServiceAmount struct { Id int `gorm:"primaryKey;column:id" json:"id"` ContractRegisterId int `gorm:"column:contract_register_id" json:"contract_register_id"` //登记ID ProductId int `gorm:"column:product_id" json:"product_id"` //产品ID ServiceAmount float64 `gorm:"column:service_amount" json:"service_amount"` //套餐总金额 CurrencyUnit string `gorm:"column:currency_unit" json:"currency_unit"` //货币国际代码 base.TimeBase } // ContractServiceAmountAddReq 新增合同套餐金额请求体 type ContractServiceAmountAddReq struct { ProductId int `json:"product_id"` //产品ID ServiceAmount float64 `json:"service_amount"` //套餐总金额 } func (c *ContractServiceAmount) TableName() string { return "contract_service_amount" } func (c *ContractServiceAmount) Create() (err error) { err = global.DEFAULT_MYSQL.Create(c).Error return } func (c *ContractServiceAmount) AddInBatches(list []*ContractServiceAmount) (err error) { err = global.DEFAULT_MYSQL.CreateInBatches(list, len(list)).Error return } type ContractServiceAmountItem struct { ContractRegisterId int `gorm:"column:contract_register_id" json:"contract_register_id"` //登记ID ProductId int `gorm:"column:product_id" json:"product_id"` //产品ID ServiceAmount float64 `gorm:"column:service_amount" json:"service_amount"` //套餐总金额 CurrencyUnit string `gorm:"column:currency_unit" json:"currency_unit"` //货币国际代码 } // GetContractServiceAmountByContractRegisterIds 根据登记id获取套餐金额列表数据 func GetContractServiceAmountByContractRegisterIds(contractRegisterIds []int) (list []*ContractServiceAmount, err error) { err = global.DEFAULT_MYSQL.Model(ContractServiceAmount{}). Where("contract_register_id in (?)", contractRegisterIds). Find(&list).Error return } // GetContractServiceAmountByRegisterId 根据id获取合同套餐金额数据 func GetContractServiceAmountByRegisterId(contractRegisterId int) (list []*ContractServiceAmount, err error) { err = global.DEFAULT_MYSQL.Model(ContractServiceAmount{}). Where("contract_register_id = ?", contractRegisterId). Find(&list).Error return }