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