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;
}

猜你喜欢

转载自www.cnblogs.com/fenghuaxiao/p/9167717.html