瀏覽代碼

fix:业务合同的关联合同逻辑调整

Roc 3 年之前
父節點
當前提交
98bbf85dc8
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      models/tables/contract_relation/contract_relation.go

+ 3 - 3
models/tables/contract_relation/contract_relation.go

@@ -23,7 +23,7 @@ type RelationContractList struct {
 // GetContractRelationListByRelationContractIds 根据业务合同id集合获取对应的业务合同基础信息
 func GetContractRelationListByRelationContractIds(contractIdStr string) (list []*RelationContractList, err error) {
 	o := orm.NewOrm()
-	sql := `select a.contract_id,a.company_name,b.payment_on_behalf_contract_id from contract a join contract_relation b on a.contract_id=b.payment_on_behalf_contract_id where a.status in ("已签回","已审批") AND a.is_delete = 0 AND b.contract_id in (` + contractIdStr + `)  order by a.contract_id asc`
+	sql := `select b.contract_id,a.company_name,b.payment_on_behalf_contract_id from contract a join contract_relation b on a.contract_id=b.payment_on_behalf_contract_id where a.status in ("已签回","已审批") AND a.is_delete = 0 AND b.contract_id in (` + contractIdStr + `)  order by a.contract_id asc`
 
 	_, err = o.Raw(sql).QueryRows(&list)
 	return
@@ -42,7 +42,7 @@ where a.status in ("已签回","已审批") AND a.is_delete = 0 AND b.payment_on
 // GetContractRelationListByRelationContractId 根据业务合同id获取对应的代付合同基础信息
 func GetContractRelationListByRelationContractId(contractId int) (list []*RelationContractList, err error) {
 	o := orm.NewOrm()
-	sql := `select a.contract_id,a.company_name,b.payment_on_behalf_contract_id from contract a join contract_relation b on  a.contract_id=b.payment_on_behalf_contract_id
+	sql := `select b.contract_id,a.company_name,b.payment_on_behalf_contract_id from contract a join contract_relation b on  a.contract_id=b.payment_on_behalf_contract_id
 where a.status in ("已签回","已审批") AND a.is_delete = 0 AND b.contract_id =?  order by a.contract_id asc`
 
 	_, err = o.Raw(sql, contractId).QueryRows(&list)
@@ -62,7 +62,7 @@ where a.status in ("已签回","已审批") AND a.is_delete = 0 AND b.payment_on
 // GetContractRelationListByContractId 根据业务合同id获取已经给他代付过的合同列表
 func GetContractRelationListByContractId(contractId int) (list []*RelationContractList, err error) {
 	o := orm.NewOrm()
-	sql := `select  a.contract_id,a.company_name,b.payment_on_behalf_contract_id,a.price from contract a join contract_relation b on  a.contract_id=b.payment_on_behalf_contract_id
+	sql := `select  b.contract_id,a.company_name,b.payment_on_behalf_contract_id,a.price from contract a join contract_relation b on  a.contract_id=b.payment_on_behalf_contract_id
 where a.status in ("已签回","已审批","待审批") AND a.is_delete = 0 AND b.contract_id =? order by a.contract_id asc`
 
 	_, err = o.Raw(sql, contractId).QueryRows(&list)