update 优化 部门修改子元素关系 使用批量更新

This commit is contained in:
疯狂的狮子li
2022-03-04 09:26:26 +08:00
parent 4d0c84bcf5
commit c1d01fb1e1
3 changed files with 8 additions and 24 deletions

View File

@ -37,17 +37,4 @@
order by d.parent_id, d.order_num
</select>
<update id="updateDeptChildren" parameterType="java.util.List">
update sys_dept set ancestors =
<foreach collection="depts" item="item" index="index"
separator=" " open="case dept_id" close="end">
when #{item.deptId} then #{item.ancestors}
</foreach>
where dept_id in
<foreach collection="depts" item="item" index="index"
separator="," open="(" close=")">
#{item.deptId}
</foreach>
</update>
</mapper>