作者 陈志颖

refactor:优化共创项目详情查看速度

@@ -363,9 +363,12 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec @@ -363,9 +363,12 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec
363 // 判断项目关联的合约承接人类型 363 // 判断项目关联的合约承接人类型
364 undertakers := make([]*domain.Undertaker, 0) 364 undertakers := make([]*domain.Undertaker, 0)
365 if countContracts, cooperationContracts, err := cooperationContractRepository.Find(map[string]interface{}{ 365 if countContracts, cooperationContracts, err := cooperationContractRepository.Find(map[string]interface{}{
  366 + "cooperationProjectNumber": cooperationProject.CooperationProjectNumber,
  367 + "companyId": cooperationProject.Company.CompanyId,
  368 + "orgId": cooperationProject.Org.OrgId,
366 "offsetLimit": false, 369 "offsetLimit": false,
367 }); err != nil { 370 }); err != nil {
368 - 371 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
369 } else { 372 } else {
370 if countContracts > 0 { 373 if countContracts > 0 {
371 for _, cooperationContract := range cooperationContracts { 374 for _, cooperationContract := range cooperationContracts {
@@ -1143,6 +1143,9 @@ func (repository *CooperationContractRepository) Find(queryOptions map[string]in @@ -1143,6 +1143,9 @@ func (repository *CooperationContractRepository) Find(queryOptions map[string]in
1143 if cooperationContractName, ok := queryOptions["cooperationContractName"]; ok && cooperationContractName != "" { 1143 if cooperationContractName, ok := queryOptions["cooperationContractName"]; ok && cooperationContractName != "" {
1144 query.Where("cooperation_contract_name like ?", fmt.Sprintf("%%%s%%", cooperationContractName)) 1144 query.Where("cooperation_contract_name like ?", fmt.Sprintf("%%%s%%", cooperationContractName))
1145 } 1145 }
  1146 + if cooperationProjectNumber, ok := queryOptions["cooperationProjectNumber"]; ok && cooperationProjectNumber != "" {
  1147 + query.Where("cooperation_project_number = ?", cooperationProjectNumber)
  1148 + }
1146 if departmentName, ok := queryOptions["departmentName"]; ok && departmentName != "" { 1149 if departmentName, ok := queryOptions["departmentName"]; ok && departmentName != "" {
1147 query.Where(`(cooperation_contract.department->>'departmentName')::text LIKE ?`, fmt.Sprintf("%%%s%%", departmentName)) 1150 query.Where(`(cooperation_contract.department->>'departmentName')::text LIKE ?`, fmt.Sprintf("%%%s%%", departmentName))
1148 } 1151 }