public List selectInfo(int userId) { List userInfos = sqlSessionTemplate.selectList("com.ruolan.bean.StudentMapper.selectUser",userId); return userInfos; }复制代码
3、Mapper里面进行参数的取值
复制代码
二、传入多个参数
1、Controller里面的方法
selectUserInfo(@Param("index") int index, @Param("listrow") int listrow)复制代码
2、Dao层的方法,拼接参数成map
public List selectUserInfo(int index,int listrow) { Map parmars = new HashMap<>(); //这里index和listrow 就是mapper里面要取的key值 parmars.put("index", index); parmars.put("listrow", listrow); List userInfos = sqlSessionTemplate.selectList("com.ruolan.bean.StudentMapper.selectUserInfo",parmars); return userInfos; }复制代码