123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- 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"`
- ProductId int `gorm:"column:product_id" json:"product_id"`
- ServiceAmount float64 `gorm:"column:service_amount" json:"service_amount"`
- CurrencyUnit string `gorm:"column:currency_unit" json:"currency_unit"`
- base.TimeBase
- }
- type ContractServiceAmountAddReq struct {
- ProductId int `json:"product_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"`
- ProductId int `gorm:"column:product_id" json:"product_id"`
- ServiceAmount float64 `gorm:"column:service_amount" json:"service_amount"`
- CurrencyUnit string `gorm:"column:currency_unit" json:"currency_unit"`
- }
- func GetContractServiceAmountByContractRegisterIds(contractRegisterIds []int) (list []*ContractServiceAmount, err error) {
- err = global.DEFAULT_MYSQL.Model(ContractServiceAmount{}).
- Where("contract_register_id in (?)", contractRegisterIds).
- Find(&list).Error
- return
- }
- func GetContractServiceAmountByRegisterId(contractRegisterId int) (list []*ContractServiceAmount, err error) {
- err = global.DEFAULT_MYSQL.Model(ContractServiceAmount{}).
- Where("contract_register_id = ?", contractRegisterId).
- Find(&list).Error
- return
- }
|