示例:

接口方法

[java] view plain copy
 
  1. public List<Teacher> selectTeacher(@Param(value="id") String id,@Param(value="sex") String sex);  


XML文件

[html] view plain copy
 
  1. <select id="selectTeacher"  resultType="com.myapp.domain.Teacher">  
  2.     select * from Teacher where c_id=#{id} and sex=#{sex}  
  3. </select>  

  #{}里面的id 和 sex 必须和接口方法里面的 value 值是相同的


测试代码

[java] view plain copy
 
  1. List<Teacher> tList = teacherMapper.selectTeacher("2","男");    
  2. for (Teacher entityTemp : tList) {    
  3.     System.out.println(entityTemp.toString());   


 

 

相关文章:

  • 2021-08-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-01
  • 2022-12-23
  • 2022-12-23
  • 2021-10-09
  • 2022-12-23
  • 2021-09-09
相关资源
相似解决方案