|
|
@ -437,23 +437,23 @@ func (impl *CustDemandVerHeadDAOImplement) SelectData(paging *grmi.Paging, group |
|
|
|
joinstr := " INNER JOIN AP_UserCustlst ON AP_CustDemandVerHead.PlantNr = AP_UserCustlst.PlantNr AND AP_CustDemandVerHead.CustomerId = AP_UserCustlst.CustomerId INNER JOIN AP_CustDemandHead ON AP_CustDemandVerHead.PlantNr = AP_CustDemandHead.PlantNr AND AP_CustDemandVerHead.CustomerId = AP_CustDemandHead.CustomerId AND AP_CustDemandVerHead.VersionId = AP_CustDemandHead.VersionId " |
|
|
|
|
|
|
|
if customerId != "" { |
|
|
|
where += fmt.Sprintf(" AND AP_CustDemandVerHead.CustomerId = %s", customerId) |
|
|
|
where += fmt.Sprintf(" AND AP_CustDemandVerHead.CustomerId = '%s'", customerId) |
|
|
|
} |
|
|
|
if versionId != "" { |
|
|
|
where += fmt.Sprintf(" AND AP_CustDemandVerHead.VersionId = %s", versionId) |
|
|
|
where += fmt.Sprintf(" AND AP_CustDemandVerHead.VersionId = '%s'", versionId) |
|
|
|
} |
|
|
|
|
|
|
|
if status != "" { |
|
|
|
where += fmt.Sprintf(" AND AP_CustDemandVerHead.Status = %s", status) |
|
|
|
where += fmt.Sprintf(" AND AP_CustDemandVerHead.Status = '%s'", status) |
|
|
|
} |
|
|
|
|
|
|
|
if artId != "" { |
|
|
|
joinstr += " INNER JOIN AP_CustDemandVerDetail ON AP_CustDemandVerHead.PlantNr = AP_CustDemandVerDetail.PlantNr And AP_CustDemandVerHead.CustomerId = AP_CustDemandVerDetail.CustomerId And AP_CustDemandVerHead.VersionId = AP_CustDemandVerDetail.VersionId " |
|
|
|
where += fmt.Sprintf(" and AP_CustDemandVerDetail.ArtId like concat('%%', %s, '%%')", artId) |
|
|
|
where += fmt.Sprintf(" and AP_CustDemandVerDetail.ArtId like concat('%%', '%s', '%%')", artId) |
|
|
|
} |
|
|
|
if grouptype != "" { |
|
|
|
joinstr += " INNER JOIN Customer ON AP_CustDemandVerHead.PlantNr = Customer.PlantNr And AP_CustDemandVerHead.CustomerId = Customer.CustomerId " |
|
|
|
where += fmt.Sprintf(" AND Customer.CustomerType = %s", grouptype) |
|
|
|
where += fmt.Sprintf(" AND Customer.CustomerType = '%s'", grouptype) |
|
|
|
} |
|
|
|
orderBy := " order by " + " AP_CustDemandVerHead.VersionId " |
|
|
|
where = " where " + where |
|
|
@ -471,23 +471,23 @@ func (impl *CustDemandVerHeadDAOImplement) SelectData(paging *grmi.Paging, group |
|
|
|
joinstr := " INNER JOIN AP_UserCustlst ON AP_CustDemandVerHead.PlantNr = AP_UserCustlst.PlantNr AND AP_CustDemandVerHead.CustomerId = AP_UserCustlst.CustomerId " |
|
|
|
|
|
|
|
if customerId != "" { |
|
|
|
where += fmt.Sprintf(" AND AP_CustDemandVerHead.CustomerId = %s", customerId) |
|
|
|
where += fmt.Sprintf(" AND AP_CustDemandVerHead.CustomerId = '%s'", customerId) |
|
|
|
} |
|
|
|
if versionId != "" { |
|
|
|
where += fmt.Sprintf(" AND AP_CustDemandVerHead.VersionId = %s", versionId) |
|
|
|
where += fmt.Sprintf(" AND AP_CustDemandVerHead.VersionId = '%s'", versionId) |
|
|
|
} |
|
|
|
|
|
|
|
if status != "" { |
|
|
|
where += fmt.Sprintf(" AND AP_CustDemandVerHead.Status = %s", status) |
|
|
|
where += fmt.Sprintf(" AND AP_CustDemandVerHead.Status = '%s'", status) |
|
|
|
} |
|
|
|
|
|
|
|
if artId != "" { |
|
|
|
joinstr += " INNER JOIN AP_CustDemandVerDetail ON AP_CustDemandVerHead.PlantNr = AP_CustDemandVerDetail.PlantNr And AP_CustDemandVerHead.CustomerId = AP_CustDemandVerDetail.CustomerId And AP_CustDemandVerHead.VersionId = AP_CustDemandVerDetail.VersionId " |
|
|
|
where += fmt.Sprintf(" and AP_CustDemandVerDetail.ArtId like concat('%%', %s, '%%')", artId) |
|
|
|
where += fmt.Sprintf(" and AP_CustDemandVerDetail.ArtId like concat('%%', '%s', '%%')", artId) |
|
|
|
} |
|
|
|
if grouptype != "" { |
|
|
|
joinstr += " INNER JOIN Customer ON AP_CustDemandVerHead.PlantNr = Customer.PlantNr And AP_CustDemandVerHead.CustomerId = Customer.CustomerId " |
|
|
|
where += fmt.Sprintf(" AND Customer.CustomerType = %s", grouptype) |
|
|
|
where += fmt.Sprintf(" AND Customer.CustomerType = '%s'", grouptype) |
|
|
|
} |
|
|
|
orderBy := " order by " + " AP_CustDemandVerHead.VersionId " |
|
|
|
where = " where " + where |
|
|
|