mybatis 兩層list遍歷


 

1.mybatis 寫法

<update id="batchUpdateWPD" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" open=""
close="" separator=";">
UPDATE t_wl_week_plan_detail
<set>
<if test="item.auditDetailId != null and item.auditDetailId!=''">
SALES_DIRECTOR_DETAIL_ID= #{item.auditDetailId}
</if>
</set>
WHERE PLAN_DETAIL_ID IN
<foreach collection="item.planDetailIdList" item="planDetailId" index="index"
open="(" close=")" separator=",">
#{planDetailId}
</foreach>


</foreach>
</update>

2 java語句

ntsmpWlWeekPlanDetailPlusMapper.batchUpdateWPD(wlSalesDirectorAuditDetailNewList);

注:入參wlSalesDirectorAuditDetailNewList  類型為List<WlSalesDirectorAuditDetailNewResult> 

3 入參示例 

public class WlSalesDirectorAuditDetailNewResult {

......
private String planDetailId;
private List<String> planDetailIdList;
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM