MyBatis总结(十九)--映射文件_select_返回List

本文内容来自上硅谷

如果dao如下

public List<Employee> getEmpsByLastNameLike(String lastName);

则xml配置如下

<!--resultType:如果返回的是一个集合,要写集合中元素的类型  -->
<select id="getEmpsByLastNameLike" resultType="com.atguigu.mybatis.bean.Employee">
   select * from tbl_employee where last_name like #{lastName}
</select>

猜你喜欢

转载自blog.csdn.net/lsx2017/article/details/82631175