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