_011_SpringBoot_集成MyBatis
--------------------------------
application.properties文件
server.port=8080 server.servlet.context-path=/_014 mybatis.mapper-locations=classpath:org/lfz/springboot/mapper/*.xml #一定要注意编码问题,如果项目采用的是UTF-8编码,那么Editor采用的编码就是UTF-8编码,否则会遇到意想不到的异常 spring.datasource.username=root spring.datasource.password=123456123 spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.url=jdbc:mysql://localhost:3306/db_springboot?useUnicode=true&characterEncoding=utf8&useSSL=false
--------------------------------
Mapper接口
@Mapper public interface StudentMapper { int deleteByPrimaryKey(Integer id); int insert(Student record); int insertSelective(Student record); Student selectByPrimaryKey(Integer id); int updateByPrimaryKeySelective(Student record); int updateByPrimaryKey(Student record); List<Student> selectAllStudents(); }