1.在使用mybatis批量删除、修改数据时,mapper.xml代码和controller参数接收方式
controller
@RequestMapping(value = "/deletePapersExpire", method = RequestMethod.GET)
public ResultInfo<Boolean> deletePapersExpire(Integer[] keyIdList,String updateBy) {
return new ResultInfo<>().succeed(taskPapersExpireService.deletePapersExpire(keyIdList,updateBy));
}
mapper
Boolean deletePapersExpire(@Param("list") Integer[] keyIdList,String updateBy);
mapper.xml
因为我项目中所使用的是逻辑删除,所以使用update改变状态码
<update id="deletePapersExpire">
update task_papers_expire
set
task_statecode='DELETE',task_update_on=now(),task_update_by=#{updateBy,jdbcType=VARCHAR}
where key_id in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</update>