MERGE INTO employee A1
USING
(
<foreach close="" collection="list" index="index" item="item" open="" separator="union">
select #{item.id} id,#{item.name} name,#{item.deptId} deptId,#{item.deptName} deptName from dual
</foreach>
) A2
ON
(
A1.id = A2.id
)
WHEN MATCHED THEN
UPDATE SET A1.status = 1
WHEN NOT MATCHED THEN
INSERT
(id,name,detp_id,dept_name)
VALUES( A2.id,A2.name,A2.deptId,A2.deptName)
USING
(
<foreach close="" collection="list" index="index" item="item" open="" separator="union">
select #{item.id} id,#{item.name} name,#{item.deptId} deptId,#{item.deptName} deptName from dual
</foreach>
) A2
ON
(
A1.id = A2.id
)
WHEN MATCHED THEN
UPDATE SET A1.status = 1
WHEN NOT MATCHED THEN
INSERT
(id,name,detp_id,dept_name)
VALUES( A2.id,A2.name,A2.deptId,A2.deptName)