mybatis如何传递列表,数组等
1个回答
展开全部
<update id="batchUpdate">
update tblsupertitleresult
<trim prefix="set" suffixOverrides=",">
<trim prefix="checkState =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.checkState!=null">
when (userHhCode=#{i.userHhCode} and titleId=#{i.titleId}) then #{i.checkState}
</if>
</foreach>
</trim>
<trim prefix=" correctDate =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.correctDate!=null">
when (userHhCode=#{i.userHhCode} and titleId=#{i.titleId}) then #{i.correctDate}
</if>
</foreach>
</trim>
<trim prefix="result =case" suffix="end," >
<foreach collection="list"item="i" index="index">
<if test="i.result!=null">
when (userHhCode=#{i.userHhCode} and titleId=#{i.titleId}) then #{i.result}
</if>
</foreach>
</trim>
</trim>
where
<foreach collection="list" separator="or"item="i" index="index" >
(userHhCode =#{i.userHhCode} andtitleId=#{i.titleId})
</foreach>
</update>
update tblsupertitleresult
<trim prefix="set" suffixOverrides=",">
<trim prefix="checkState =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.checkState!=null">
when (userHhCode=#{i.userHhCode} and titleId=#{i.titleId}) then #{i.checkState}
</if>
</foreach>
</trim>
<trim prefix=" correctDate =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.correctDate!=null">
when (userHhCode=#{i.userHhCode} and titleId=#{i.titleId}) then #{i.correctDate}
</if>
</foreach>
</trim>
<trim prefix="result =case" suffix="end," >
<foreach collection="list"item="i" index="index">
<if test="i.result!=null">
when (userHhCode=#{i.userHhCode} and titleId=#{i.titleId}) then #{i.result}
</if>
</foreach>
</trim>
</trim>
where
<foreach collection="list" separator="or"item="i" index="index" >
(userHhCode =#{i.userHhCode} andtitleId=#{i.titleId})
</foreach>
</update>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询