今天学弟发qq给我说,参数为数组的删除不会。我整理一下,然后顺便写个博客随便粘贴。 service:
public boolean deleteEmpById(String ids
) {
String
[] split
= ids
.split(",");
return empMapper
.deleteEmpById(split
) == split
.length
;
}
mapper接口:
int deleteEmpById(@Param("ids") String
[] ids
);
mapper.xml
<delete id
="deleteEmpById">
DELETE FROM employee WHERE id IN
<foreach collection
="ids" separator
="," open
="(" close
=")" item
="id">
#
{id
}
</foreach
>
</delete
>