...
|
...
|
@@ -136,12 +136,6 @@ func (repository *ContractUndertakerFeedbackRepository) FindOne(queryOptions map |
|
|
if contractUndertakerFeedbackModel.FeedbackId == 0 {
|
|
|
return nil, nil
|
|
|
} else {
|
|
|
//// 获取共创模式
|
|
|
//cooperationModeModel := new(models.CooperationMode)
|
|
|
//cooperationModeQuery := tx.Model(cooperationModeModel)
|
|
|
//if err := cooperationModeQuery.Where("cooperation_mode_number = ?", contractUndertakerFeedbackModel.CooperationModeNumber).First(); err != nil {
|
|
|
// return nil, err
|
|
|
//}
|
|
|
return transform.TransformToContractUndertakerFeedbackDomainModelFromPgModels(contractUndertakerFeedbackModel)
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -151,24 +145,24 @@ func (repository *ContractUndertakerFeedbackRepository) Find(queryOptions map[st |
|
|
var contractUndertakerFeedbackModels []*models.ContractUndertakerFeedback
|
|
|
contractUndertakerFeedbacks := make([]*domain.ContractUndertakerFeedback, 0)
|
|
|
query := sqlbuilder.BuildQuery(tx.Model(&contractUndertakerFeedbackModels), queryOptions)
|
|
|
if cooperationContractName, ok := queryOptions["cooperationContractName"]; ok && cooperationContractName != "" {
|
|
|
query.Where("cooperation_contract_number like ?", fmt.Sprintf("%%%s%%", cooperationContractName))
|
|
|
}
|
|
|
if undertakerName, ok := queryOptions["undertakerName"]; ok && undertakerName != "" {
|
|
|
query.Where("contract_undertaker->>'userName' like ?", fmt.Sprintf("%%%s%%", undertakerName))
|
|
|
}
|
|
|
query.SetOffsetAndLimit(20)
|
|
|
query.SetOrderDirect("feedback_id", "DESC")
|
|
|
if count, err := query.SelectAndCount(); err != nil {
|
|
|
return 0, contractUndertakerFeedbacks, err
|
|
|
} else {
|
|
|
//for _, contractUndertakerFeedbackModel := range contractUndertakerFeedbackModels {
|
|
|
// // 获取共创模式
|
|
|
// cooperationModeModel := new(models.CooperationMode)
|
|
|
// cooperationModeQuery := tx.Model(cooperationModeModel)
|
|
|
// if err := cooperationModeQuery.Where("cooperation_mode_number = ?", contractUndertakerFeedbackModel.CooperationModeNumber).First(); err != nil {
|
|
|
// return 0, nil, err
|
|
|
// }
|
|
|
// if contractUndertakerFeedback, err := transform.TransformToContractUndertakerFeedbackDomainModelFromPgModels(contractUndertakerFeedbackModel, cooperationModeModel); err != nil {
|
|
|
// return 0, contractUndertakerFeedbacks, err
|
|
|
// } else {
|
|
|
// contractUndertakerFeedbacks = append(contractUndertakerFeedbacks, contractUndertakerFeedback)
|
|
|
// }
|
|
|
//}
|
|
|
for _, contractUndertakerFeedbackModel := range contractUndertakerFeedbackModels {
|
|
|
if contractUndertakerFeedback, err := transform.TransformToContractUndertakerFeedbackDomainModelFromPgModels(contractUndertakerFeedbackModel); err != nil {
|
|
|
return 0, contractUndertakerFeedbacks, err
|
|
|
} else {
|
|
|
contractUndertakerFeedbacks = append(contractUndertakerFeedbacks, contractUndertakerFeedback)
|
|
|
}
|
|
|
}
|
|
|
return int64(count), contractUndertakerFeedbacks, nil
|
|
|
}
|
|
|
}
|
...
|
...
|
|