zhangqian
2023-08-08 d5c533de0c2ccb5614ea3c600ede9c13da77e127
model/serviceCollectionPlan.go
@@ -5,27 +5,30 @@
   "aps_crm/pkg/mysqlx"
   "errors"
   "fmt"
   "github.com/shopspring/decimal"
   "gorm.io/gorm"
   "time"
)
type (
   // ServiceCollectionPlan 服务合同收款计划
   // ServiceCollectionPlan 收款计划
   ServiceCollectionPlan struct {
      Id                int     `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
      CollectionType    int     `gorm:"collection_type" json:"collectionType"`        // 类型(1 计划收款日期 2 项目状态)
      ServiceContractId int     `gorm:"service_contract_id" json:"serviceContractId"` // 服务合同id
      PrincipalId       int     `gorm:"principal_id" json:"principalId"`              // 收款负责人ID
      Term              int     `gorm:"term" json:"term"`                             // 期次
      Percent           float64 `gorm:"percent" json:"percent"`                       // 比例
      Amount            float64 `gorm:"amount" json:"amount"`                         // 金额
      MoneyType         string  `gorm:"money_type" json:"moneyType"`                  // 币种
      CollectionDate    string  `gorm:"collection_date" json:"collectionDate"`        // 计划收款日期
      Remark            string  `gorm:"remark" json:"remark"`                         // 备注
      Status            int     `gorm:"status" json:"status"`                         // 状态(1未收2已收)
      FileId            int     `gorm:"file_id" json:"fileId"`                        // 附件id
      Id             int                       `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
      CollectionType int                       `gorm:"collection_type" json:"collectionType"` // 类型(1 计划收款日期 2 项目状态)
      SourceType     int                       `gorm:"source_type" json:"sourceType"`         // 源单类型(1销售明细2服务合同3销售发票)
      SourceId       int                       `gorm:"source_id" json:"sourceId"`             // 源单id
      PrincipalId    int                       `gorm:"principal_id" json:"principalId"`       // 收款负责人ID
      Term           int                       `gorm:"term" json:"term"`                      // 期次
      Percent        decimal.Decimal           `gorm:"percent" json:"percent"`                // 比例
      Amount         decimal.Decimal           `gorm:"amount" json:"amount"`                  // 金额
      MoneyType      string                    `gorm:"money_type" json:"moneyType"`           // 币种
      CollectionDate time.Time                 `gorm:"collection_date" json:"collectionDate"` // 计划收款日期
      Remark         string                    `gorm:"remark" json:"remark"`                  // 备注
      Status         constvar.CollectionStatus `gorm:"status" json:"status"`                  // 状态(1未收2已收)
      FileId         int                       `gorm:"file_id" json:"fileId"`                 // 附件id
   }
   // ServiceCollectionPlanSearch 服务合同收款计划搜索条件
   // ServiceCollectionPlanSearch 收款计划搜索条件
   ServiceCollectionPlanSearch struct {
      ServiceCollectionPlan
      Orm         *gorm.DB
@@ -38,7 +41,7 @@
)
func (ServiceCollectionPlan) TableName() string {
   return "service_collection_plan"
   return "collection_plan"
}
func NewServiceCollectionPlanSearch() *ServiceCollectionPlanSearch {
@@ -53,8 +56,8 @@
      db = db.Where("id = ?", slf.Id)
   }
   if slf.ServiceContractId != 0 {
      db = db.Where("service_contract_id = ?", slf.ServiceContractId)
   if slf.SourceId != 0 {
      db = db.Where("source_id = ?", slf.SourceId)
   }
   return db
@@ -97,8 +100,8 @@
   return slf
}
func (slf *ServiceCollectionPlanSearch) SetServiceContractId(id int) *ServiceCollectionPlanSearch {
   slf.ServiceContractId = id
func (slf *ServiceCollectionPlanSearch) SetSourceId(id int) *ServiceCollectionPlanSearch {
   slf.SourceId = id
   return slf
}