|
@@ -57,6 +57,7 @@ type ContractInvoiceItem struct {
|
|
|
ServiceProductId int `gorm:"column:service_product_id" json:"service_product_id" description:"套餐类型:1ficc套餐,2权益套餐"`
|
|
|
IsPrePay int `gorm:"column:is_pre_pay" json:"is_pre_pay" description:"是否预付款: 0-不是; 1-是"`
|
|
|
CreateTime string `gorm:"column:create_time" json:"create_time" description:"创建时间"`
|
|
|
+ CompanyName string `gorm:"column:company_name" json:"company_name" description:"客户名称"`
|
|
|
}
|
|
|
|
|
|
func (c *ContractInvoice) Create() (err error) {
|
|
@@ -220,9 +221,11 @@ type ContractInvoiceListReq struct {
|
|
|
|
|
|
// GetContractInvoiceItemPageList 获取合同开票/到款列表-分页
|
|
|
func GetContractInvoiceItemPageList(page base.IPage, condition string, pars []interface{}) (count int64, results []*ContractInvoiceItem, err error) {
|
|
|
- list := make([]*ContractInvoice, 0)
|
|
|
- query := global.DEFAULT_MYSQL.Table("contract_invoice").
|
|
|
- Where("is_deleted = 0").
|
|
|
+ list := make([]*ContractInvoiceRespItem, 0)
|
|
|
+ query := global.DEFAULT_MYSQL.Table("contract_invoice AS a").
|
|
|
+ Select("a.*, b.company_name").
|
|
|
+ Joins("JOIN contract_register b ON a.contract_register_id = b.contract_register_id").
|
|
|
+ Where("a.is_deleted = 0").
|
|
|
Where(condition, pars...)
|
|
|
query.Count(&count)
|
|
|
if len(page.GetOrderItemsString()) > 0 {
|
|
@@ -239,7 +242,7 @@ func GetContractInvoiceItemPageList(page base.IPage, condition string, pars []in
|
|
|
}
|
|
|
|
|
|
// formatContractInvoice2Item 格式化ContractInvoiceItem
|
|
|
-func formatContractInvoice2Item(item *ContractInvoice) (formatItem *ContractInvoiceItem) {
|
|
|
+func formatContractInvoice2Item(item *ContractInvoiceRespItem) (formatItem *ContractInvoiceItem) {
|
|
|
formatItem = new(ContractInvoiceItem)
|
|
|
formatItem.ContractInvoiceId = item.ContractInvoiceId
|
|
|
formatItem.ContractRegisterId = item.ContractRegisterId
|
|
@@ -256,6 +259,7 @@ func formatContractInvoice2Item(item *ContractInvoice) (formatItem *ContractInvo
|
|
|
formatItem.IsPrePay = item.IsPrePay
|
|
|
formatItem.ServiceProductId = item.ServiceProductId
|
|
|
formatItem.CreateTime = utils.TimeTransferString(utils.FormatDateTime, item.CreateTime)
|
|
|
+ formatItem.CompanyName = item.CompanyName
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -495,3 +499,8 @@ func GetInvoiceListCurrencySum(condition string, pars []interface{}, groupRule s
|
|
|
err = query.Find(&results).Error
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+type ContractInvoiceRespItem struct {
|
|
|
+ ContractInvoice
|
|
|
+ CompanyName string `gorm:"column:company_name" json:"company_name" description:"客户名称"`
|
|
|
+}
|