|
@@ -31,6 +31,7 @@ import com.ruoyi.user.domain.User;
|
|
|
import com.ruoyi.user.service.IUserService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.Collection;
|
|
@@ -162,6 +163,7 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
* @param bo 订单
|
|
|
* @return 结果
|
|
|
*/
|
|
|
+ @Transactional
|
|
|
@Override
|
|
|
public Boolean insertByBo(OrderBo bo) {
|
|
|
Order add = BeanUtil.toBean(bo, Order.class);
|
|
@@ -177,6 +179,8 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|
|
if (flag) {
|
|
|
bo.setId(add.getId());
|
|
|
+ //更新订单数
|
|
|
+ userService.addNum(add.getUserId());
|
|
|
}
|
|
|
return flag;
|
|
|
}
|