Mybatis中parameterType和resultType

简单记个笔记:

  • parameterType是传递过来的参数类型;
  • resultType是返回数据的类型。

举个栗子:

mapper层的接口方法:

public int selectStudentNum(Integer classId);

xml里:

<!--根据班级id查全校学生表有多少该班级学生-->
<select id="selectStudentNum" parameterType="Integer "  resultType="int"> 
    select COUNT(class_id) from Student where class_id= #{classId}; 
</select>

猜你喜欢

转载自blog.csdn.net/qq_61726905/article/details/126894459