在第八章 springboot + mybatis + 多数据源代码的基础上,做两点修改
1、ShopDao
1 package com.xxx.firstboot.dao; 2 3 import org.springframework.beans.factory.annotation.Autowired; 4 import org.springframework.stereotype.Repository; 5 6 import com.xxx.firstboot.domain.Shop; 7 import com.xxx.firstboot.mapper.ShopMapper; 8 9 @Repository 10 public class ShopDao { 11 @Autowired 12 private ShopMapper mapper; 13 14 /** 15 * 获取shop 16 */ 17 public Shop getShop(int id) { 18 return mapper.getShop(id); 19 } 20 }