作者 陈志颖

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

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