控制台报异常显示Parameter ‘ename’ not found. Available parameters are [0, 1, 2, param3, param1,param2]解决办法
报错原因是因为你传入了多个参数,但没有加注解
解决办法
方法一、在dao层或者mapper层加上@Param注解
例如
mapper层代码
Emp selectEmpByEname(@Param("name") String ename,@Param("type") String empcrettype,@Param("cretid") String empcretid);
注意:name type cretid 别名要与xml里的字段匹配,如下:
<select id="selectEmpByEname" resultType="com.bestvike.framework.develop.model.Person">
select * from Emp where ename = #{name} and empcrettype = #{type} and empcretid = #{cretid}
</select>
方法二、直接将xml里的别名改成0,1,2
<select id="selectEmpByEname" resultType="com.bestvike.framework.develop.model.Person">
select * from Emp where ename = #{0} and empcrettype = #{1} and empcretid = #{2}
</select>