要根据id批量跟新name,age,modifiedDate,mapper.xml文件如下
<update id=
"batchUpdate"
>
update direct_bank_sys_param
<trim prefix=
"set"
suffixOverrides=
","
>
<trim prefix="
name=case"
suffix=
"end,"
>
<foreach collection=
"list"
item=
"i"
index=
"index"
>
<
if
test="i.
name!=null">
when id=#{i.id} then #{i.
name}
</
if
>
</foreach>
</trim>
<trim prefix="
age=case"
suffix=
"end,"
>
<foreach collection=
"list"
item=
"i"
index=
"index"
>
<
if
test="i.
age!=null">
when id=#{i.id} then #{i.
age}
</
if
>
</foreach>
</trim>
<trim prefix=
" modifier =case"
suffix=
"end,"
>
<foreach collection=
"list"
item=
"i"
index=
"index"
>
<
if
test=
"i.modifier!=null"
>
when id=#{i.id} then #{i.modifier}
</
if
>
</foreach>
</trim>
</trim>
where
<foreach collection=
"list"
separator=
"or"
item=
"i"
index=
"index"
>
id=#{i.id}
</foreach>
</update>