StudnetMapper.xml
<delete id="delete" parameterClass="java.util.Map">
delete from Student
where
num = #num# and name = #name#
</delete>
dao
public void del(String num, String name)
{
Map<String, Object> param = new HashMap<String, Object>();
param.put("num", num);
param.put("name", name);
baseDao.deleteObject("StudentMapper.delete", param);
}
ibatis自动将Map中的num和name解析出来,这样就相当于传递了多个参数了。
当然,还可以用dto将这两个字段封装一下,作为dto来传,大家可以试一试。
时间: 2024-09-23 06:53:46