contract_payment_service_amount.go 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package fms
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. // ContractPaymentServiceAmount 到款登记-套餐金额分配表
  7. type ContractPaymentServiceAmount struct {
  8. ContractPaymentServiceAmountId int `gorm:"primaryKey;column:contract_payment_service_amount_id" json:"contract_payment_service_amount_id"`
  9. ContractRegisterId int `gorm:"column:contract_register_id" json:"contract_register_id" description:"合同登记ID"`
  10. ContractPaymentId int `gorm:"column:contract_payment_id" json:"contract_payment_id" description:"到款登记ID"`
  11. ServiceTemplateId int `gorm:"column:service_template_id" json:"service_template_id" description:"套餐ID"`
  12. ServiceTemplatePid int `gorm:"column:service_template_pid" json:"service_template_pid" description:"套餐父级ID"`
  13. Amount float64 `gorm:"column:amount" json:"amount" description:"分配金额"`
  14. IsDeleted int `gorm:"column:is_deleted" json:"is_deleted" description:"是否已删除: 0-正常; 1-已删除"`
  15. InitType int `gorm:"column:init_type" json:"init_type" description:"初始分配类型:0人为分配,1自动分配"`
  16. CreateTime time.Time `gorm:"autoCreateTime;column:create_time" json:"create_time" description:"创建时间"`
  17. ModifyTime time.Time `gorm:"autoUpdateTime:milli;column:modify_time" json:"modify_time" description:"最后更新时间"`
  18. }
  19. // ContractPaymentServiceAmountItem 到款套餐分配信息
  20. type ContractPaymentServiceAmountItem struct {
  21. ContractPaymentServiceAmountId int `json:"contract_payment_service_amount_id"`
  22. ContractPaymentId int `json:"contract_payment_id" description:"到款登记ID"`
  23. ServiceTemplateId int `json:"service_template_id" description:"套餐ID"`
  24. ServiceTemplatePid int `json:"service_template_pid" description:"套餐父级ID"`
  25. ServiceTemplateName string `json:"service_template_name"`
  26. Amount float64 `json:"amount" description:"分配金额"`
  27. ServiceProductId int `json:"service_product_id" description:"套餐类型:1ficc套餐,2权益套餐"`
  28. }
  29. // DistributePaymentServiceAmountReq 到款登记-分配套餐金额请求体
  30. type DistributePaymentServiceAmountReq struct {
  31. ContractRegisterId int `json:"contract_register_id" binding:"required,gte=1" description:"合同登记ID"`
  32. ContractPaymentId int `json:"contract_payment_id" binding:"required,gte=1" description:"到款登记ID"`
  33. List []*DistributePaymentServiceAmountItem `json:"list"`
  34. }
  35. // GetPaymentServiceAmountReq 到款登记-查询分配套餐金额请求体
  36. type GetPaymentServiceAmountReq struct {
  37. ContractRegisterId int `json:"contract_register_id" binding:"required,gte=1" description:"合同登记ID"`
  38. ContractPaymentId int `json:"contract_payment_id" binding:"required,gte=1" description:"到款登记ID"`
  39. }
  40. // DistributePaymentServiceAmountItem 到款登记-分配套餐金额列表信息
  41. type DistributePaymentServiceAmountItem struct {
  42. ContractPaymentServiceAmountId int `json:"contract_payment_service_amount_id"`
  43. ServiceTemplateId int `json:"service_template_id" description:"套餐ID"`
  44. ServiceTemplatePid int `json:"service_template_pid" description:"套餐父级ID"`
  45. Amount float64 `json:"amount" description:"分配金额"`
  46. }
  47. func (c *ContractPaymentServiceAmount) List(condition string, pars []interface{}) (list []*ContractPaymentServiceAmount, err error) {
  48. list = make([]*ContractPaymentServiceAmount, 0)
  49. o := orm.NewOrmUsingDB("fms")
  50. sql := `SELECT * FROM contract_payment_service_amount WHERE 1=1 AND is_deleted = 0 `
  51. sql += condition
  52. _,err = o.Raw(sql, pars).QueryRows(&list)
  53. return
  54. }