Ver Fonte

fix:事务范围

xdd há 1 semana atrás
pai
commit
7f404199fb

+ 3 - 2
fs-service-system/src/main/java/com/fs/company/service/impl/CompanyServiceImpl.java

@@ -26,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import com.fs.company.service.ICompanyService;
+import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
 /**
@@ -240,7 +241,7 @@ public class CompanyServiceImpl implements ICompanyService
     }
 
     @Override
-    @Transactional
+    @Transactional(rollbackFor = Throwable.class,propagation = Propagation.REQUIRED)
     public void addCompanyMoney(FsStoreOrder order) {
         if(order.getCompanyId()>0){
             Company company=companyMapper.selectCompanyByIdForUpdate(order.getCompanyId());
@@ -272,7 +273,7 @@ public class CompanyServiceImpl implements ICompanyService
     }
 
     @Override
-    @Transactional
+    @Transactional(rollbackFor = Throwable.class,propagation = Propagation.REQUIRED)
     public void subCompanyMoney(FsStoreOrder order) {
         if(order.getCompanyId()>0){
             Company company=companyMapper.selectCompanyByIdForUpdate(order.getCompanyId());