INSERT INTO tb_uiws_schedule
(sche_type, title, sche_gubun_cd, importance_cd, start_dt, end_dt, content,
owner_id, dept_id, charger_id, created_by, created_at)
VALUES
(#{scheType}, #{title}, #{scheGubunCd}, #{importanceCd}, #{startDt}, #{endDt}, #{content},
#{ownerId}, #{deptId}, #{chargerId}, #{createdBy}, #{createdAt})
UPDATE tb_uiws_schedule SET
sche_type = #{scheType}, title = #{title}, sche_gubun_cd = #{scheGubunCd},
importance_cd = #{importanceCd}, start_dt = #{startDt}, end_dt = #{endDt},
content = #{content}, dept_id = #{deptId}, charger_id = #{chargerId},
updated_by = #{updatedBy}, updated_at = #{updatedAt}
WHERE schedule_id = #{scheduleId}
DELETE FROM tb_uiws_schedule WHERE schedule_id = #{scheduleId}
WHERE start_dt < #{to}
AND end_dt >= #{from}
AND sche_type = #{scheType}
AND owner_id IN
#{oid}
INSERT INTO tb_uiws_diary
(title, content, schedule_id, writer_id, diary_date, created_by, created_at)
VALUES
(#{title}, #{content}, #{scheduleId}, #{writerId}, #{diaryDate}, #{createdBy}, #{createdAt})
UPDATE tb_uiws_diary SET
title = #{title}, content = #{content}, schedule_id = #{scheduleId}, diary_date = #{diaryDate},
updated_by = #{updatedBy}, updated_at = #{updatedAt}
WHERE diary_id = #{diaryId}
DELETE FROM tb_uiws_diary WHERE diary_id = #{diaryId}
INSERT INTO tb_uiws_attach
(ref_type, ref_id, file_nm, file_path, file_size, created_by, created_at)
VALUES
(#{refType}, #{refId}, #{fileNm}, #{filePath}, #{fileSize}, #{createdBy}, #{createdAt})
UPDATE tb_uiws_attach
SET ref_type = #{refType}, ref_id = #{refId}, updated_by = #{actor}, updated_at = now()
WHERE attach_id = #{attachId}
DELETE FROM tb_uiws_attach WHERE attach_id = #{attachId}
DELETE FROM tb_uiws_attach WHERE ref_type = #{refType} AND ref_id = #{refId}