id, org_no, org_name, channel_slug, dept_name, manager_name, manager_title, manager_phone, manager_email, channel_id_mj, channel_id_law insert into organization (org_no, org_name, channel_slug, dept_name, manager_name, manager_title, manager_phone, manager_email) values (#{orgNo}, #{orgName}, #{channelSlug}, #{deptName}, #{managerName}, #{managerTitle}, #{managerPhone}, #{managerEmail}) on conflict (org_no, org_name) do update set channel_slug = excluded.channel_slug, dept_name = coalesce(organization.dept_name, excluded.dept_name), manager_name = coalesce(organization.manager_name, excluded.manager_name), manager_title = coalesce(organization.manager_title, excluded.manager_title), manager_phone = coalesce(organization.manager_phone, excluded.manager_phone), manager_email = coalesce(organization.manager_email, excluded.manager_email), updated_at = now() update organization set dept_name = #{deptName}, manager_name = #{managerName}, manager_title = #{managerTitle}, manager_phone = #{managerPhone}, manager_email = #{managerEmail}, updated_at = now() where id = #{id} update organization set channel_id_mj = #{channelId}, channel_id_law = #{channelId}, updated_at = now() where id = #{id}