|
@ -9,6 +9,7 @@ import ( |
|
|
meta "leit.com/LAPP_CHEERSSON_BACKEND/meta/ap" |
|
|
meta "leit.com/LAPP_CHEERSSON_BACKEND/meta/ap" |
|
|
model "leit.com/LAPP_CHEERSSON_BACKEND/models/ap" |
|
|
model "leit.com/LAPP_CHEERSSON_BACKEND/models/ap" |
|
|
baseModel "leit.com/LAPP_CHEERSSON_BACKEND/models/base" |
|
|
baseModel "leit.com/LAPP_CHEERSSON_BACKEND/models/base" |
|
|
|
|
|
"leit.com/LAPP_CHEERSSON_BACKEND/models/common" |
|
|
"leit.com/LAPP_CHEERSSON_BACKEND/utils" |
|
|
"leit.com/LAPP_CHEERSSON_BACKEND/utils" |
|
|
"xorm.io/core" |
|
|
"xorm.io/core" |
|
|
) |
|
|
) |
|
@ -434,7 +435,7 @@ func (impl *CustDemandVerHeadDAOImplement) SelectData(paging *grmi.Paging, group |
|
|
//查询有效的版本
|
|
|
//查询有效的版本
|
|
|
where := fmt.Sprintf("AP_CustDemandVerHead.PlantNr = %d", impl.plantNr) |
|
|
where := fmt.Sprintf("AP_CustDemandVerHead.PlantNr = %d", impl.plantNr) |
|
|
|
|
|
|
|
|
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 " |
|
|
|
|
|
|
|
|
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 INNER JOIN Customer ON AP_CustDemandVerHead.PlantNr = Customer.PlantNr And AP_CustDemandVerHead.CustomerId = Customer.CustomerId " |
|
|
|
|
|
|
|
|
where += fmt.Sprintf(" AND AP_UserCustlst.UserId = '%s'", impl.userid) |
|
|
where += fmt.Sprintf(" AND AP_UserCustlst.UserId = '%s'", impl.userid) |
|
|
|
|
|
|
|
@ -454,23 +455,29 @@ func (impl *CustDemandVerHeadDAOImplement) SelectData(paging *grmi.Paging, group |
|
|
where += fmt.Sprintf(" and AP_CustDemandVerDetail.ArtId like concat('%%', '%s', '%%')", artId) |
|
|
where += fmt.Sprintf(" and AP_CustDemandVerDetail.ArtId like concat('%%', '%s', '%%')", artId) |
|
|
} |
|
|
} |
|
|
if grouptype != "" { |
|
|
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 " |
|
|
orderBy := " order by " + " AP_CustDemandVerHead.VersionId " |
|
|
where = " where " + where |
|
|
where = " where " + where |
|
|
data := make([]model.CustDemandVerHead, 0, 10) |
|
|
|
|
|
err := impl.session.Table(impl.meta.TableName).SQL("select DISTINCT AP_CustDemandVerHead.* from AP_CustDemandVerHead " + joinstr + where + orderBy + " offset " + utils.ValueToString(paging.Offset(), "") + " row fetch next " + utils.ValueToString(paging.Size, "") + " row only").Find(&data) |
|
|
|
|
|
|
|
|
data := make([]common.CustOrderData, 0) |
|
|
|
|
|
|
|
|
|
|
|
err := impl.session.Table(impl.meta.TableName).SQL("select * from AP_CustDemandVerHead " + joinstr + where + orderBy + " offset " + utils.ValueToString(paging.Offset(), "") + " row fetch next " + utils.ValueToString(paging.Size, "") + " row only").Find(&data) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return grmi.EmptyPagingResult, grmi.NewDataBaseError(err) |
|
|
return grmi.EmptyPagingResult, grmi.NewDataBaseError(err) |
|
|
} |
|
|
} |
|
|
return grmi.PagingResult{Records: data, Count: paging.Size, PageNumber: paging.Number, PageSize: paging.Size}, nil |
|
|
|
|
|
|
|
|
datalst := make([]model.CustDemandVerHead, 0) |
|
|
|
|
|
for _, item := range data { |
|
|
|
|
|
custHead := item.CustDemandVerHead |
|
|
|
|
|
custHead.CustomerName = item.Customer.Name1 |
|
|
|
|
|
datalst = append(datalst, custHead) |
|
|
|
|
|
} |
|
|
|
|
|
return grmi.PagingResult{Records: datalst, Count: paging.Size, PageNumber: paging.Number, PageSize: paging.Size}, nil |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
|
|
|
//查询有效的版本
|
|
|
//查询有效的版本
|
|
|
where := fmt.Sprintf("AP_CustDemandVerHead.PlantNr = %d", impl.plantNr) |
|
|
where := fmt.Sprintf("AP_CustDemandVerHead.PlantNr = %d", impl.plantNr) |
|
|
|
|
|
|
|
|
joinstr := " INNER JOIN AP_UserCustlst ON AP_CustDemandVerHead.PlantNr = AP_UserCustlst.PlantNr AND AP_CustDemandVerHead.CustomerId = AP_UserCustlst.CustomerId " |
|
|
|
|
|
|
|
|
joinstr := " INNER JOIN AP_UserCustlst ON AP_CustDemandVerHead.PlantNr = AP_UserCustlst.PlantNr AND AP_CustDemandVerHead.CustomerId = AP_UserCustlst.CustomerId INNER JOIN Customer ON AP_CustDemandVerHead.PlantNr = Customer.PlantNr And AP_CustDemandVerHead.CustomerId = Customer.CustomerId " |
|
|
where += fmt.Sprintf(" AND AP_UserCustlst.UserId = '%s'", impl.userid) |
|
|
where += fmt.Sprintf(" AND AP_UserCustlst.UserId = '%s'", impl.userid) |
|
|
if customerId != "" { |
|
|
if customerId != "" { |
|
|
where += fmt.Sprintf(" AND AP_CustDemandVerHead.CustomerId = '%s'", customerId) |
|
|
where += fmt.Sprintf(" AND AP_CustDemandVerHead.CustomerId = '%s'", customerId) |
|
@ -488,19 +495,23 @@ func (impl *CustDemandVerHeadDAOImplement) SelectData(paging *grmi.Paging, group |
|
|
where += fmt.Sprintf(" and AP_CustDemandVerDetail.ArtId like concat('%%', '%s', '%%')", artId) |
|
|
where += fmt.Sprintf(" and AP_CustDemandVerDetail.ArtId like concat('%%', '%s', '%%')", artId) |
|
|
} |
|
|
} |
|
|
if grouptype != "" { |
|
|
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 " |
|
|
orderBy := " order by " + " AP_CustDemandVerHead.VersionId " |
|
|
where = " where " + where |
|
|
where = " where " + where |
|
|
data := make([]model.CustDemandVerHead, 0, 10) |
|
|
|
|
|
err := impl.session.Table(impl.meta.TableName).SQL("select DISTINCT AP_CustDemandVerHead.* from AP_CustDemandVerHead " + joinstr + where + orderBy + " offset " + utils.ValueToString(paging.Offset(), "") + " row fetch next " + utils.ValueToString(paging.Size, "") + " row only").Find(&data) |
|
|
|
|
|
|
|
|
data := make([]common.CustOrderData, 0) |
|
|
|
|
|
err := impl.session.Table(impl.meta.TableName).SQL("select * from AP_CustDemandVerHead " + joinstr + where + orderBy + " offset " + utils.ValueToString(paging.Offset(), "") + " row fetch next " + utils.ValueToString(paging.Size, "") + " row only").Find(&data) |
|
|
|
|
|
|
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return grmi.EmptyPagingResult, grmi.NewDataBaseError(err) |
|
|
return grmi.EmptyPagingResult, grmi.NewDataBaseError(err) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return grmi.PagingResult{Records: data, Count: paging.Size, PageNumber: paging.Number, PageSize: paging.Size}, nil |
|
|
|
|
|
|
|
|
datalst := make([]model.CustDemandVerHead, 0) |
|
|
|
|
|
for _, item := range data { |
|
|
|
|
|
custHead := item.CustDemandVerHead |
|
|
|
|
|
custHead.CustomerName = item.Customer.Name1 |
|
|
|
|
|
datalst = append(datalst, custHead) |
|
|
|
|
|
} |
|
|
|
|
|
return grmi.PagingResult{Records: datalst, Count: paging.Size, PageNumber: paging.Number, PageSize: paging.Size}, nil |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|