|
@@ -591,6 +591,33 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai |
|
@@ -591,6 +591,33 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai |
|
591
|
return cooperationContract, nil
|
591
|
return cooperationContract, nil
|
|
592
|
}
|
592
|
}
|
|
593
|
|
593
|
|
|
|
|
594
|
+func (repository *CooperationContractRepository) UpdateOne(cooperationContract *domain.CooperationContract) (*domain.CooperationContract, error) {
|
|
|
|
595
|
+ tx := repository.transactionContext.PgTx
|
|
|
|
596
|
+ cooperationContractModel := new(models.CooperationContract)
|
|
|
|
597
|
+ cooperationContractModel = &models.CooperationContract{
|
|
|
|
598
|
+ CooperationContractId: cooperationContract.CooperationContractId,
|
|
|
|
599
|
+ CooperationContractDescription: cooperationContract.CooperationContractDescription,
|
|
|
|
600
|
+ CooperationContractName: cooperationContract.CooperationContractName,
|
|
|
|
601
|
+ CooperationContractNumber: cooperationContract.CooperationContractNumber,
|
|
|
|
602
|
+ CooperationProjectNumber: cooperationContract.CooperationProjectNumber,
|
|
|
|
603
|
+ CooperationContractUndertakerTypes: cooperationContract.CooperationContractUndertakerTypes,
|
|
|
|
604
|
+ CooperationContractSponsor: cooperationContract.CooperationContractSponsor,
|
|
|
|
605
|
+ CooperationModeNumber: cooperationContract.CooperationMode.CooperationModeNumber,
|
|
|
|
606
|
+ Status: cooperationContract.Status,
|
|
|
|
607
|
+ Org: cooperationContract.Org,
|
|
|
|
608
|
+ Company: cooperationContract.Company,
|
|
|
|
609
|
+ Operator: cooperationContract.Operator,
|
|
|
|
610
|
+ OperateTime: cooperationContract.OperateTime,
|
|
|
|
611
|
+ CreatedAt: cooperationContract.CreatedAt,
|
|
|
|
612
|
+ DeletedAt: cooperationContract.DeletedAt,
|
|
|
|
613
|
+ UpdatedAt: time.Now(),
|
|
|
|
614
|
+ }
|
|
|
|
615
|
+ if _, err := tx.Model(cooperationContractModel).WherePK().Update(); err != nil {
|
|
|
|
616
|
+ return nil, err
|
|
|
|
617
|
+ }
|
|
|
|
618
|
+ return cooperationContract, nil
|
|
|
|
619
|
+}
|
|
|
|
620
|
+
|
|
594
|
func (repository *CooperationContractRepository) UpdateMany(cooperationContracts []*domain.CooperationContract) ([]*domain.CooperationContract, error) {
|
621
|
func (repository *CooperationContractRepository) UpdateMany(cooperationContracts []*domain.CooperationContract) ([]*domain.CooperationContract, error) {
|
|
595
|
tx := repository.transactionContext.PgTx
|
622
|
tx := repository.transactionContext.PgTx
|
|
596
|
var cooperationContractModels []*models.CooperationContract
|
623
|
var cooperationContractModels []*models.CooperationContract
|