创建模块时候要勾选MyBatis framework 和MYSQL Driver 这俩个技术。
@Mapper@Repositorypublic interface BookDao { @Select("select * from tbl_book where id = #{id}") public Book getById(Integer id);}
@Datapublic class Book { private Integer id; private String type; private String name; private String description;}
@SpringBootTestclass Springboot05MybatisApplicationTests { @Autowired private BookDao bookDao; @Test void contextLoads() { System.out.println(bookDao.getById(1)); }}