作者 13655977079

feat:修改更新接口

@@ -261,11 +261,19 @@ func (productMaterialService *ProductMaterialService) UpdateProductMaterial(oper @@ -261,11 +261,19 @@ func (productMaterialService *ProductMaterialService) UpdateProductMaterial(oper
261 defer func() { 261 defer func() {
262 transactionContext.RollbackTransaction() 262 transactionContext.RollbackTransaction()
263 }() 263 }()
264 - productMaterialRepository, productMaterial, err := factory.FastProductMaterial(transactionContext, cmd.ProductMaterialId) 264 +
  265 + var productMaterialRepository domain.ProductMaterialRepository
  266 + if value, err := factory.CreateProductMaterialRepository(map[string]interface{}{
  267 + "transactionContext": transactionContext,
  268 + }); err != nil {
  269 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  270 + } else {
  271 + productMaterialRepository = value
  272 + }
  273 + productMaterial, err := productMaterialRepository.FindOne(map[string]interface{}{"companyId": operateInfo.CompanyId, "productMaterialId": cmd.ProductMaterialId})
265 if err != nil { 274 if err != nil {
266 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 275 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
267 } 276 }
268 -  
269 productMaterial.ProductMaterialGroupId = cmd.ProductMaterialGroupId 277 productMaterial.ProductMaterialGroupId = cmd.ProductMaterialGroupId
270 productMaterial.MaterialName = cmd.MaterialName 278 productMaterial.MaterialName = cmd.MaterialName
271 productMaterial.MaterialAttribute.Attribute = cmd.MaterialAttribute 279 productMaterial.MaterialAttribute.Attribute = cmd.MaterialAttribute