Example 1 Set $A=\left\{(x, y) \mid y=x^{2}+m x+2\right\}, B=\{(x, y) \mid x-y+1=0$ and $0 \leqslant x \leqslant 2\}$. If $A \cap B \neq \varnothing$, find the range of values for $m$.
Analysis We strip off the outer layer of the set and transform it into a problem of functions and equations.
Solution From $\left\{\begin{array}{l}y=x^{2}+m x+2 \\ x-y+1=0\end{array}\right.$ we get $x^{2}+(m-1) x+1=0$, which implies $x \neq 0$, and $m=-x-\frac{1}{x}+1$. When $A \cap B \neq \varnothing$, $x \in(0,2],-x-\frac{1}{x}+1 \leqslant-1$, i.e., $m \leqslant-1$.
Comment This solution employs the idea of function, and the problem can also be solved using the distribution of roots of a quadratic function.