求各位帮小弟看一下这个问题!
DaoImpl:
public int muiltDelete(List<Long> ids) {
return getSession().update("com.ningpai.web.dao.TraceLogMapper.deleteMultiByLogId", ids);
}
Service:
public int multiDeleteByIds(Long[] ids){
List<Long> list=new ArrayList<Long>();
for(int i=0;i<ids.length;i++){
list.add(ids[i]);
}
return traceLogDao.muiltDelete(list);
}
Controller:
@RequestMapping("/multiDeleteTraceLog")
public ModelAndView multiDelete(HttpServletResponse response,Long[] Id){
PrintWriter pr=null;
try {
response.setContentType(Constant.REQ_SETCONTENT);
pr=response.getWriter();
pr.print(traceLogService.multiDeleteByIds(Id));
} catch (
IOException e) {
return new ModelAndView(Constant.REQ_VIEW);
}finally{
if(pr!=null){
pr.close();
}
}
return null;
}
SQL语句:
<update id="deleteMultiByLogId">
UPDATE trace_log SET delete_flag='1' WHERE
<foreach collection="list" separator="or" item="mid" index="index" >
(id = #{mid,jdbcType=BIGINT})
</foreach>
</update>
运行批量删除后报错:
Resolving exception from handler [com.ningpai.web.productrecord.controller.TraceLogController@335578c5]:
org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'java.lang.Long[]'; nested exception is
java.lang.NumberFormatException: For input string: "undefined"
求各位大神帮小弟看一下,是哪儿错了,拜谢!