...
|
...
|
@@ -591,6 +591,36 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai |
|
|
return cooperationContract, nil
|
|
|
}
|
|
|
|
|
|
func (repository *CooperationContractRepository) UpdateMany(cooperationContracts []*domain.CooperationContract) ([]*domain.CooperationContract, error) {
|
|
|
tx := repository.transactionContext.PgTx
|
|
|
var cooperationContractModels []*models.CooperationContract
|
|
|
cooperationContractQuery := tx.Model(&cooperationContractModels)
|
|
|
for _, cooperationContract := range cooperationContracts {
|
|
|
cooperationContractModels = append(cooperationContractModels, &models.CooperationContract{
|
|
|
CooperationContractId: cooperationContract.CooperationContractId,
|
|
|
CooperationContractDescription: cooperationContract.CooperationContractDescription,
|
|
|
CooperationContractName: cooperationContract.CooperationContractName,
|
|
|
CooperationContractNumber: cooperationContract.CooperationContractNumber,
|
|
|
CooperationProjectNumber: cooperationContract.CooperationProjectNumber,
|
|
|
CooperationContractUndertakerTypes: cooperationContract.CooperationContractUndertakerTypes,
|
|
|
CooperationContractSponsor: cooperationContract.CooperationContractSponsor,
|
|
|
CooperationModeNumber: cooperationContract.CooperationMode.CooperationModeNumber,
|
|
|
Status: cooperationContract.Status,
|
|
|
Org: cooperationContract.Org,
|
|
|
Company: cooperationContract.Company,
|
|
|
Operator: cooperationContract.Operator,
|
|
|
OperateTime: cooperationContract.OperateTime,
|
|
|
CreatedAt: cooperationContract.CreatedAt,
|
|
|
DeletedAt: cooperationContract.DeletedAt,
|
|
|
UpdatedAt: time.Now(),
|
|
|
})
|
|
|
}
|
|
|
if _, err := tx.Model(&cooperationContractQuery).WherePK().Update(); err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
return cooperationContracts, nil
|
|
|
}
|
|
|
|
|
|
func (repository *CooperationContractRepository) Remove(cooperationContract *domain.CooperationContract) (*domain.CooperationContract, error) {
|
|
|
tx := repository.transactionContext.PgTx
|
|
|
cooperationContractModel := new(models.CooperationContract)
|
...
|
...
|
|