作者 陈志颖

合并分支 'dev' 到 'test'

Dev



查看合并请求 !34
@@ -34,7 +34,7 @@ type CooperationContractRelevant struct { @@ -34,7 +34,7 @@ type CooperationContractRelevant struct {
34 // 更新时间 34 // 更新时间
35 UpdatedAt time.Time `comment:"更新时间"` 35 UpdatedAt time.Time `comment:"更新时间"`
36 // 删除时间 36 // 删除时间
37 - DeletedAt time.Time `comment:"删除时间"` 37 + DeletedAt time.Time `comment:"删除时间" pg:",soft_delete"`
38 // 创建时间 38 // 创建时间
39 CreatedAt time.Time `comment:"创建时间"` 39 CreatedAt time.Time `comment:"创建时间"`
40 } 40 }
@@ -44,5 +44,5 @@ type CooperationContractUndertaker struct { @@ -44,5 +44,5 @@ type CooperationContractUndertaker struct {
44 // 更新时间 44 // 更新时间
45 UpdatedAt time.Time `comment:"更新时间"` 45 UpdatedAt time.Time `comment:"更新时间"`
46 // 删除时间 46 // 删除时间
47 - DeletedAt time.Time `comment:"删除时间"` 47 + DeletedAt time.Time `comment:"删除时间" pg:",soft_delete"`
48 } 48 }
@@ -143,7 +143,16 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai @@ -143,7 +143,16 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
143 // 新增承接人 143 // 新增承接人
144 var undertakersModel []*models.CooperationContractUndertaker 144 var undertakersModel []*models.CooperationContractUndertaker
145 for _, undertaker := range cooperationContract.Undertakers { 145 for _, undertaker := range cooperationContract.Undertakers {
  146 + if undertaker.Identify() == nil {
  147 + undertakerId, err := repository.nextIdentify()
  148 + if err != nil {
  149 + return nil, err
  150 + } else {
  151 + undertaker.UndertakerId = undertakerId
  152 + }
  153 + }
146 undertakersModel = append(undertakersModel, &models.CooperationContractUndertaker{ 154 undertakersModel = append(undertakersModel, &models.CooperationContractUndertaker{
  155 + CooperationContractUndertakerId: undertaker.UndertakerId,
147 CooperationContractNumber: cooperationContract.CooperationContractNumber, 156 CooperationContractNumber: cooperationContract.CooperationContractNumber,
148 CooperationContractId: cooperationContract.CooperationContractId, 157 CooperationContractId: cooperationContract.CooperationContractId,
149 UserId: undertaker.UserId, 158 UserId: undertaker.UserId,
@@ -1063,16 +1072,6 @@ func (repository *CooperationContractRepository) FindOne(queryOptions map[string @@ -1063,16 +1072,6 @@ func (repository *CooperationContractRepository) FindOne(queryOptions map[string
1063 if cooperationContractModel.CooperationContractId == 0 { 1072 if cooperationContractModel.CooperationContractId == 0 {
1064 return nil, nil 1073 return nil, nil
1065 } else { 1074 } else {
1066 - // 获取共创模式  
1067 - //cooperationModeModels := new(models.CooperationMode)  
1068 - //cooperationModeQuery := tx.Model(cooperationModeModels)  
1069 - //if err := cooperationModeQuery.  
1070 - // Where("company->>'companyId' = '?'", cooperationContractModel.Company.CompanyId).  
1071 - // Where("org->>'orgId' = '?'", cooperationContractModel.Org.OrgId).  
1072 - // Where("cooperation_mode_number = ?", cooperationContractModel.CooperationModeNumber).  
1073 - // First(); err != nil {  
1074 - // return nil, fmt.Errorf("共创合约关联的共创模式不存在")  
1075 - //}  
1076 var cooperationModeModels []*models.CooperationMode 1075 var cooperationModeModels []*models.CooperationMode
1077 cooperationModeQuery := tx.Model(&cooperationModeModels) 1076 cooperationModeQuery := tx.Model(&cooperationModeModels)
1078 if countMode, err := cooperationModeQuery. 1077 if countMode, err := cooperationModeQuery.
@@ -1151,7 +1150,7 @@ func (repository *CooperationContractRepository) Find(queryOptions map[string]in @@ -1151,7 +1150,7 @@ func (repository *CooperationContractRepository) Find(queryOptions map[string]in
1151 query.Where("cooperation_contract_name like ?", fmt.Sprintf("%%%s%%", cooperationContractName)) 1150 query.Where("cooperation_contract_name like ?", fmt.Sprintf("%%%s%%", cooperationContractName))
1152 } 1151 }
1153 if departmentName, ok := queryOptions["departmentName"]; ok && departmentName != "" { 1152 if departmentName, ok := queryOptions["departmentName"]; ok && departmentName != "" {
1154 - query.Where(`(cooperation_contract.department->>'departmentName')::test LIKE ?`, fmt.Sprintf("%%%s%%", departmentName)) 1153 + query.Where(`(cooperation_contract.department->>'departmentName')::text LIKE ?`, fmt.Sprintf("%%%s%%", departmentName))
1155 } 1154 }
1156 if sponsorName, ok := queryOptions["sponsorName"]; ok && sponsorName != "" { 1155 if sponsorName, ok := queryOptions["sponsorName"]; ok && sponsorName != "" {
1157 query.Where(`(cooperation_contract.cooperation_contract_sponsor->>'userName')::text LIKE ?`, fmt.Sprintf("%%%s%%", sponsorName)) 1156 query.Where(`(cooperation_contract.cooperation_contract_sponsor->>'userName')::text LIKE ?`, fmt.Sprintf("%%%s%%", sponsorName))