|
方法一:直接给每个参数指定参数名
Mapper:
public List listNewTask(@Param("userId")String userId,@Param("taskType") Integer type);
xml: 不要加 parameterType 因为这里有String 和 Integer两个类型,这里指定不了
test:
@Test
public void listNewTask(){
System.out.println(userTaskMapper.listNewTask("22341",2).size());
}
?
方法二:将多个参数丢到一个Map中,传递Map
Mapper:
public List listNewTask(Map map);
xml:parameterType="map"
test:
public void listNewTask(){
Map map = new HashMap();
map.put("userId", "22341");
map.put("taskType", 2);
System.out.println(userTaskMapper.listNewTask(map).size());
}
?
|