示例:
接口方法
- public List<Teacher> selectTeacher(@Param(value="id") String id,@Param(value="sex") String sex);
XML文件
- <select id="selectTeacher" resultType="com.myapp.domain.Teacher">
- select * from Teacher where c_id=#{id} and sex=#{sex}
- </select>
#{}里面的id 和 sex 必须和接口方法里面的 value 值是相同的
测试代码
- List<Teacher> tList = teacherMapper.selectTeacher("2","男");
- for (Teacher entityTemp : tList) {
- System.out.println(entityTemp.toString());