select entity.uuid from () entity where entity.uuid in #{element ,jdbcType=VARCHAR} and entity.isPrivate = ${_false} and #{role, jdbcType=VARCHAR} in ('user','codeviewer') select gr.role from group_roles gr inner join () entity on entity.uuid = gr.entity_uuid where entity.uuid = #{entityUuid, jdbcType=VARCHAR} and gr.group_uuid is null