fix: 优化
This commit is contained in:
parent
8b924446ed
commit
31b239c0c8
@ -1,11 +1,14 @@
|
||||
package com.yupi.project.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.yupi.project.mapper.OrderMapper;
|
||||
import com.yupi.project.model.entity.OrderDO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@ -14,19 +17,23 @@ public class OrderService {
|
||||
|
||||
@Autowired
|
||||
private OrderMapper orderMapper;
|
||||
@Autowired
|
||||
private OrderMapper orderMapper1;
|
||||
|
||||
@Transactional
|
||||
public void add(OrderDO order) {
|
||||
// <1.1> 这里先假模假样的读取一下。读取从库
|
||||
OrderDO exists = orderMapper.selectById(1);
|
||||
OrderDO exists1 = orderMapper1.selectById(1);
|
||||
System.out.println(exists);
|
||||
System.out.println(exists1);
|
||||
|
||||
// <1.2> 插入订单
|
||||
orderMapper.insert(order);
|
||||
|
||||
// <1.3> 这里先假模假样的读取一下。读取主库
|
||||
exists = orderMapper.selectById(1);
|
||||
System.out.println(exists);
|
||||
List<OrderDO> orderDOList = orderMapper.selectList(new LambdaQueryWrapper<OrderDO>().eq(OrderDO::getUserId, 10));
|
||||
System.out.println(orderDOList);
|
||||
}
|
||||
|
||||
public OrderDO findById(Integer id) {
|
||||
|
Loading…
Reference in New Issue
Block a user