|
|
@ -360,7 +360,7 @@ func (impl *CustDemandVerHeadDAOImplement) IssueGlobalVersion(entity *model.Cust |
|
|
|
func (impl *CustDemandVerHeadDAOImplement) SelectData(customerId string, artId string, Valid bool) ([]model.CustDemandVerHead, error) { |
|
|
|
|
|
|
|
if Valid { |
|
|
|
session := impl.session.Table("AP_CustDemandVerHead").Select("AP_CustDemandVerHead.*").Distinct("AP_CustDemandVerHead.VersionId").Join("LEFT", "AP_CustDemandHead", "AP_CustDemandHead.PlantNr = AP_CustDemandVerHead.PlantNr And AP_CustDemandHead.CustomerId = AP_CustDemandVerHead.CustomerId And AP_CustDemandHead.VersionId = AP_CustDemandVerHead.VersionId").Join("LEFT", meta.CustDemandVerDetail.TableName, "AP_CustDemandVerHead.PlantNr = AP_CustDemandVerDetail.PlantNr And AP_CustDemandVerHead.CustomerId = AP_CustDemandVerDetail.CustomerId And AP_CustDemandVerHead.VersionId = AP_CustDemandVerDetail.VersionId").Where("AP_CustDemandVerHead.PlantNr = ?", impl.plantNr) |
|
|
|
session := impl.session.Table("AP_CustDemandVerHead").Select("AP_CustDemandVerHead.*").Distinct("AP_CustDemandVerHead.VersionId").Join("INNER", "AP_CustDemandHead", "AP_CustDemandHead.PlantNr = AP_CustDemandVerHead.PlantNr And AP_CustDemandHead.CustomerId = AP_CustDemandVerHead.CustomerId And AP_CustDemandHead.VersionId = AP_CustDemandVerHead.VersionId").Join("INNER", meta.CustDemandVerDetail.TableName, "AP_CustDemandVerHead.PlantNr = AP_CustDemandVerDetail.PlantNr And AP_CustDemandVerHead.CustomerId = AP_CustDemandVerDetail.CustomerId And AP_CustDemandVerHead.VersionId = AP_CustDemandVerDetail.VersionId").Where("AP_CustDemandVerHead.PlantNr = ?", impl.plantNr) |
|
|
|
if customerId != "" { |
|
|
|
session = session.And("AP_CustDemandVerHead.CustomerId = ?", customerId) |
|
|
|
} |
|
|
@ -376,7 +376,7 @@ func (impl *CustDemandVerHeadDAOImplement) SelectData(customerId string, artId s |
|
|
|
} |
|
|
|
return data, nil |
|
|
|
} else { |
|
|
|
session := impl.session.Table(impl.meta.TableName).Select("AP_CustDemandVerHead.*").Distinct("AP_CustDemandVerHead.VersionId").Join("LEFT", meta.CustDemandVerDetail.TableName, "AP_CustDemandVerHead.PlantNr = AP_CustDemandVerDetail.PlantNr And AP_CustDemandVerHead.CustomerId = AP_CustDemandVerDetail.CustomerId And AP_CustDemandVerHead.VersionId = AP_CustDemandVerDetail.VersionId").Where("AP_CustDemandVerHead.PlantNr = ?", impl.plantNr) |
|
|
|
session := impl.session.Table(impl.meta.TableName).Select("AP_CustDemandVerHead.*").Distinct("AP_CustDemandVerHead.VersionId").Join("INNER", meta.CustDemandVerDetail.TableName, "AP_CustDemandVerHead.PlantNr = AP_CustDemandVerDetail.PlantNr And AP_CustDemandVerHead.CustomerId = AP_CustDemandVerDetail.CustomerId And AP_CustDemandVerHead.VersionId = AP_CustDemandVerDetail.VersionId").Where("AP_CustDemandVerHead.PlantNr = ?", impl.plantNr) |
|
|
|
if customerId != "" { |
|
|
|
session = session.And("AP_CustDemandVerHead.CustomerId = ?", customerId) |
|
|
|
} |
|
|
|