ListListDeliveryCommandItemDetail itemDetailLists; for ListDeliveryCommandItemDetail item itemDetailLists boolean bol = deliveryCommandItemDetailServicesaveBatchitem; if
是的,当前代码可能会导致一些数据无法保存到数据库。
在循环中,如果deliveryCommandItemDetailService.saveBatch(item)返回false,则会设置result中的"success"为false,"message"为"数据库新增失败!",并立即返回result,导致后续的数据无法保存到数据库。
解决该问题的方法是在循环中记录失败的数据,而不是立即返回。可以将未保存成功的数据存储到一个列表中,然后在循环结束后进行处理,例如将这些数据重新尝试保存或进行其他操作。
原文地址: http://www.cveoy.top/t/topic/i6Bq 著作权归作者所有。请勿转载和采集!