contract_service_amount.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package fms
  2. import (
  3. "hongze/fms_api/global"
  4. "hongze/fms_api/models/base"
  5. )
  6. // 合同套餐金额表
  7. type ContractServiceAmount struct {
  8. Id int `gorm:"primaryKey;column:id" json:"id"`
  9. ContractRegisterId int `gorm:"column:contract_register_id" json:"contract_register_id"` //登记ID
  10. ProductId int `gorm:"column:product_id" json:"product_id"` //产品ID
  11. ServiceAmount float64 `gorm:"column:service_amount" json:"service_amount"` //套餐总金额
  12. CurrencyUnit string `gorm:"column:currency_unit" json:"currency_unit"` //货币国际代码
  13. base.TimeBase
  14. }
  15. // ContractServiceAmountAddReq 新增合同套餐金额请求体
  16. type ContractServiceAmountAddReq struct {
  17. ProductId int `json:"product_id"` //产品ID
  18. ServiceAmount float64 `json:"service_amount"` //套餐总金额
  19. }
  20. func (c *ContractServiceAmount) TableName() string {
  21. return "contract_service_amount"
  22. }
  23. func (c *ContractServiceAmount) Create() (err error) {
  24. err = global.DEFAULT_MYSQL.Create(c).Error
  25. return
  26. }
  27. func (c *ContractServiceAmount) AddInBatches(list []*ContractServiceAmount) (err error) {
  28. err = global.DEFAULT_MYSQL.CreateInBatches(list, len(list)).Error
  29. return
  30. }
  31. // GetContractServiceAmountByContractRegisterIds 根据登记id获取套餐金额列表数据
  32. func GetContractServiceAmountByContractRegisterIds(contractRegisterIds []int) (list []*ContractServiceAmount, err error) {
  33. err = global.DEFAULT_MYSQL.Model(ContractServiceAmount{}).
  34. Where("contract_register_id in (?)", contractRegisterIds).
  35. Find(&list).Error
  36. return
  37. }