正在显示
1 个修改的文件
包含
13 行增加
和
19 行删除
| @@ -136,12 +136,6 @@ func (repository *ContractUndertakerFeedbackRepository) FindOne(queryOptions map | @@ -136,12 +136,6 @@ func (repository *ContractUndertakerFeedbackRepository) FindOne(queryOptions map | ||
| 136 | if contractUndertakerFeedbackModel.FeedbackId == 0 { | 136 | if contractUndertakerFeedbackModel.FeedbackId == 0 { |
| 137 | return nil, nil | 137 | return nil, nil |
| 138 | } else { | 138 | } else { |
| 139 | - //// 获取共创模式 | ||
| 140 | - //cooperationModeModel := new(models.CooperationMode) | ||
| 141 | - //cooperationModeQuery := tx.Model(cooperationModeModel) | ||
| 142 | - //if err := cooperationModeQuery.Where("cooperation_mode_number = ?", contractUndertakerFeedbackModel.CooperationModeNumber).First(); err != nil { | ||
| 143 | - // return nil, err | ||
| 144 | - //} | ||
| 145 | return transform.TransformToContractUndertakerFeedbackDomainModelFromPgModels(contractUndertakerFeedbackModel) | 139 | return transform.TransformToContractUndertakerFeedbackDomainModelFromPgModels(contractUndertakerFeedbackModel) |
| 146 | } | 140 | } |
| 147 | } | 141 | } |
| @@ -151,24 +145,24 @@ func (repository *ContractUndertakerFeedbackRepository) Find(queryOptions map[st | @@ -151,24 +145,24 @@ func (repository *ContractUndertakerFeedbackRepository) Find(queryOptions map[st | ||
| 151 | var contractUndertakerFeedbackModels []*models.ContractUndertakerFeedback | 145 | var contractUndertakerFeedbackModels []*models.ContractUndertakerFeedback |
| 152 | contractUndertakerFeedbacks := make([]*domain.ContractUndertakerFeedback, 0) | 146 | contractUndertakerFeedbacks := make([]*domain.ContractUndertakerFeedback, 0) |
| 153 | query := sqlbuilder.BuildQuery(tx.Model(&contractUndertakerFeedbackModels), queryOptions) | 147 | query := sqlbuilder.BuildQuery(tx.Model(&contractUndertakerFeedbackModels), queryOptions) |
| 148 | + if cooperationContractName, ok := queryOptions["cooperationContractName"]; ok && cooperationContractName != "" { | ||
| 149 | + query.Where("cooperation_contract_number like ?", fmt.Sprintf("%%%s%%", cooperationContractName)) | ||
| 150 | + } | ||
| 151 | + if undertakerName, ok := queryOptions["undertakerName"]; ok && undertakerName != "" { | ||
| 152 | + query.Where("contract_undertaker->>'userName' like ?", fmt.Sprintf("%%%s%%", undertakerName)) | ||
| 153 | + } | ||
| 154 | query.SetOffsetAndLimit(20) | 154 | query.SetOffsetAndLimit(20) |
| 155 | query.SetOrderDirect("feedback_id", "DESC") | 155 | query.SetOrderDirect("feedback_id", "DESC") |
| 156 | if count, err := query.SelectAndCount(); err != nil { | 156 | if count, err := query.SelectAndCount(); err != nil { |
| 157 | return 0, contractUndertakerFeedbacks, err | 157 | return 0, contractUndertakerFeedbacks, err |
| 158 | } else { | 158 | } else { |
| 159 | - //for _, contractUndertakerFeedbackModel := range contractUndertakerFeedbackModels { | ||
| 160 | - // // 获取共创模式 | ||
| 161 | - // cooperationModeModel := new(models.CooperationMode) | ||
| 162 | - // cooperationModeQuery := tx.Model(cooperationModeModel) | ||
| 163 | - // if err := cooperationModeQuery.Where("cooperation_mode_number = ?", contractUndertakerFeedbackModel.CooperationModeNumber).First(); err != nil { | ||
| 164 | - // return 0, nil, err | ||
| 165 | - // } | ||
| 166 | - // if contractUndertakerFeedback, err := transform.TransformToContractUndertakerFeedbackDomainModelFromPgModels(contractUndertakerFeedbackModel, cooperationModeModel); err != nil { | ||
| 167 | - // return 0, contractUndertakerFeedbacks, err | ||
| 168 | - // } else { | ||
| 169 | - // contractUndertakerFeedbacks = append(contractUndertakerFeedbacks, contractUndertakerFeedback) | ||
| 170 | - // } | ||
| 171 | - //} | 159 | + for _, contractUndertakerFeedbackModel := range contractUndertakerFeedbackModels { |
| 160 | + if contractUndertakerFeedback, err := transform.TransformToContractUndertakerFeedbackDomainModelFromPgModels(contractUndertakerFeedbackModel); err != nil { | ||
| 161 | + return 0, contractUndertakerFeedbacks, err | ||
| 162 | + } else { | ||
| 163 | + contractUndertakerFeedbacks = append(contractUndertakerFeedbacks, contractUndertakerFeedback) | ||
| 164 | + } | ||
| 165 | + } | ||
| 172 | return int64(count), contractUndertakerFeedbacks, nil | 166 | return int64(count), contractUndertakerFeedbacks, nil |
| 173 | } | 167 | } |
| 174 | } | 168 | } |
-
请 注册 或 登录 后发表评论