1.mybatis 分页的几种方式
//https://blog.csdn.net/u012045045/article/details/88616259
//查询全部数据
List<Student> students = studentMapper.queryStudentsByArray();
//从第几条数据开始
int firstIndex = (currPage - 1) * pageSize;
//到第几条数据结束
int lastIndex = currPage * pageSize;
1.students.subList(firstIndex, lastIndex); //直接在list中截取
2.select * from student limit #{currIndex} , #{pageSize} //SQL分页
2.mybatis 整合Spring 实现主从库读写分离
https://zhuanlan.zhihu.com/p/64565964
3. mybatis中 #{} 与${} 的区别
使用#{}意味着使用的预编译的语句,即在使用jdbc时的preparedStatement,sql语句中如果存在参数则会使用?作占位符,这种 方式可以防止sql注入,并且在使用#{}时形成的sql语句,已经带有引号。使用${}时的sql不会当做字符串处理,是什么就是什么,也 不带引号,如果我们在查询时需要使用将select * from ${tablename} 表明作为参数 可以使用 $ 因为# 带引号就不对了。