Simon Zhou hace 5 años
padre
commit
67c0620329
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  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)
 	}