s.scim_uuid as scimUserUuid,
s.user_uuid as userUuid
,
u.external_id as userName
insert into scim_users (
scim_uuid,
user_uuid
) values (
#{scimUserDto.scimUserUuid,jdbcType=VARCHAR},
#{scimUserDto.userUuid,jdbcType=VARCHAR}
)
from scim_users s
inner join users u on u.uuid=s.user_uuid
left join groups_users gu on gu.user_uuid = u.uuid
where 1=1
and lower(u.external_id) like lower(#{query.userName,jdbcType=VARCHAR}) escape '/'
and s.scim_uuid in
#{scimUserUuid, jdbcType=VARCHAR}
and s.user_uuid in
#{userUuid, jdbcType=VARCHAR}
and gu.group_uuid = #{query.groupUuid, jdbcType=VARCHAR}
delete from scim_users where user_uuid = #{userUuid, jdbcType=VARCHAR}
delete from scim_users where scim_uuid = #{scimUuid, jdbcType=VARCHAR}
delete from scim_users