Simon Zhou 5 năm trước cách đây
mục cha
commit
67c0620329
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      controllers/erms2/erms2.go

+ 5 - 1
controllers/erms2/erms2.go

@@ -387,7 +387,11 @@ func QuerySpotContract(c *gin.Context) {
 							t.RelatedStatus
 						from ERMS2_SpotContract t
 						left join ERMS2_ASSpotDetail a on t.spotcontractid = a.spotcontractid
-						where t.ContractStatus = 0 and a.asapplyid = %d`, req.AsApplyID)
+						where t.ContractStatus = 0 
+							and not exists (
+								select 1 from ERMS2_ASTradeDetails e where e.spotcontractid=t.spotcontractid
+							)
+							and a.asapplyid = %d`, req.AsApplyID)
 	if req.SpotContractID > 0 {
 		sql += fmt.Sprintf(" and a.spotcontractid = %d", req.SpotContractID)
 	}