根据官方文档
useActualParamName | 允许使用方法签名中的名称作为语句参数名称。 为了使用该特性,你的项目必须采用 Java 8 编译,并且加上 -parameters 选项。(新增于 3.4.1) | true | false | true |
<setting name="useActualParamName" value="true"></setting>
Emp selectByIdAndName(Integer id, String name);
<select id="selectByIdAndName" resultMap="empResultMap">
select * from tb_emp where id =#{id} and ename = #{name}
</select>
@Test
public void test02(){
EmpMapper mapper =
sqlSession.getMapper(EmpMapper.class);
Emp emp = mapper.selectByIdAndName(1, "赵敏");
System.out.println(emp);
}
测试结果: