示例
java类
@Service
public class CustomerService {
@Resource
private CustoemrMapper customerMapper;
public Customer getCustomerById(Long id) {
return customerMapper.selectById(id); // 假设这里是103行
}
}
sql日志
2021-09-18 15:48:51.344 LogHelper.log:19 - CustomerService:getCustomerById:selectById:103 cost 49 select `id`, `name`, `sex`, `age` from customer where id = 3 2021-09-18 15:48:51.344 LogHelper.log:19 - CustomerService:getCustomerById:selectById:103 cost 49 select `id`, `name`, `sex`, `age` from customer where id = 3 2021-09-18 15:48:51.344 LogHelper.log:19 - CustomerService:getCustomerById:selectById:103 cost 49 select `id`, `name`, `sex`, `age` from customer where id = 3 2021-09-18 15:48:51.344 LogHelper.log:19 - CustomerService:getCustomerById:selectById:103 cost 49 select `id`, `name`, `sex`, `age` from customer where id = 3 2021-09-18 15:48:51.344 LogHelper.log:19 - CustomerService:getCustomerById:selectById:103 cost 49 select `id`, `name`, `sex`, `age` from customer where id = 3 2021-09-18 15:48:51.344 LogHelper.log:19 - CustomerService:getCustomerById:selectById:103 cost 49 select `id`, `name`, `sex`, `age` from customer where id = 3
日志解读
在 CustomerService 中的 getCustomerById 方法中,调用mapper的 selectById 方法进行查询,执行时位于 103 行, 执行的sql是?select `id`, `name`, `sex`, `age` from customer where id = 3
|