zhangqian
2023-08-13 6e87a1f6795af50133b10fa853fd6c2d14bb698c
model/salesRefund.go
@@ -1,35 +1,39 @@
package model
import (
   "aps_crm/constvar"
   "aps_crm/pkg/mysqlx"
   "gorm.io/gorm"
   "time"
)
type (
   SalesRefund struct {
      Id           int       `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
      ClientId     int       `json:"clientId" gorm:"column:client_id;type:int;comment:客户id"`
      Number       string    `json:"number" gorm:"column:number;type:varchar(255);comment:退款单号"`
      MemberId     int       `json:"memberId" gorm:"column:member_id;type:int;comment:负责人id"`
      RefundDate   time.Time `json:"refundDate" gorm:"column:refund_date;type:datetime;comment:退款日期"`
      RefundMethod string    `json:"refundMethod" gorm:"column:refund_method;type:varchar(255);comment:退款方式"`
      AccountId    int       `json:"accountId" gorm:"column:account_id;type:int;comment:账户"`
      IsInvoice    int       `json:"isInvoice" gorm:"column:is_invoice;type:int;comment:是否开票"`
      Reason       string    `json:"reason" gorm:"column:reason;type:varchar(255);comment:退款原因"`
      Products     []Product `json:"products" gorm:"many2many:salesRefund_product;"`
      gorm.Model   `json:"-"`
      Id            int                       `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
      ClientId      int                       `json:"clientId" gorm:"column:client_id;type:int;comment:客户id"`
      Client        Client                    `json:"client" gorm:"foreignKey:ClientId"`
      Number        string                    `json:"number" gorm:"column:number;type:varchar(255);comment:退款单号"`
      SourceType    constvar.RefundSourceType `gorm:"column:source_type;type:int;not null;default 0;comment:来源类型(1销售明细单2服务合同3销售发票4收款计划5出库单)" json:"sourceType"` // 来源类型(1销售明细单2服务合同3销售发票4收款计划5出库单)
      SourceId      int                       `gorm:"column:source_id;type:int;not null;default 0;comment:源单id " json:"sourceId"`                               // 源单id
      MemberId      int                       `json:"memberId" gorm:"column:member_id;type:int;comment:负责人id"`
      RefundDate    string                    `json:"refundDate" gorm:"column:refund_date;type:datetime;comment:退款日期"`
      PaymentTypeId int                       `gorm:"column:payment_type_id;type:int;not null;default 0;comment:收款方式ID" json:"paymentTypeId"` // 收款方式ID
      PaymentType   PaymentType               `gorm:"foreignKey:PaymentTypeId" json:"paymentType"`
      BankAccountId int                       `gorm:"column:bank_account_id;type:int;not null;default 0;comment:账户id" json:"bankAccountId"` // 账户id
      BankAccount   BankAccount               `gorm:"foreignKey:BankAccountId" json:"bankAccount"`
      IsInvoice     int                       `json:"isInvoice" gorm:"column:is_invoice;type:int;comment:是否开票"`
      Reason        string                    `json:"reason" gorm:"column:reason;type:varchar(255);comment:退款原因"`
      Products      []*Product                `json:"products" gorm:"many2many:salesRefund_product;"`
      gorm.Model    `json:"-"`
   }
   SalesRefundSearch struct {
      SalesRefund
            Orm      *gorm.DB
      Orm      *gorm.DB
      Keyword  string
      OrderBy  string
      PageNum  int
      PageSize int
   }
)
@@ -114,4 +118,4 @@
func (slf *SalesRefundSearch) SetOrder(order string) *SalesRefundSearch {
   slf.OrderBy = order
   return slf
}
}