<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="com.dxhy.admin.sys.dao.SysTabulateDao">
    <update id="updateTabulateMenuIdTran">
        <!--<foreach collection="menuIdModels" item="item" index="index">
            update sys_tabulate
            set menu_id=#{item.menuId}
            where menu_id=#{item.modelMenuId};
        </foreach>-->
        update sys_tabulate set menu_id =
        <foreach collection="menuIdModels" item="item" index="index"
                 separator=" " open="case menu_id" close="end">
            when #{item.modelMenuId} then #{item.menuId}
        </foreach>
        where menu_id in
        <foreach collection="menuIdModels" index="index" item="item"
                 separator="," open="(" close=")">
            #{item.modelMenuId}
        </foreach>
    </update>

    <update id="updateTabulateDeptMenuIdTran">
        <!--<foreach collection="menuIdModels" item="item" index="index">
            update sys_tabulate_dept
            set menu_id=#{item.menuId}
            where menu_id=#{item.modelMenuId};
        </foreach>-->
        update sys_tabulate_dept set menu_id =
        <foreach collection="menuIdModels" item="item" index="index"
                 separator=" " open="case menu_id" close="end">
            when #{item.modelMenuId} then #{item.menuId}
        </foreach>
        where menu_id in
        <foreach collection="menuIdModels" index="index" item="item"
                 separator="," open="(" close=")">
            #{item.modelMenuId}
        </foreach>
    </update>
</mapper>
