Example 2 Let $A=\left\{a_{1}, a_{2}, a_{3}\right\}, B=\{-1,0,1\}$.
(1) How many different mappings are there from $A$ to $B$?
(2) Determine the number of mappings $f: A \rightarrow B$ that satisfy $f\left(a_{1}\right)>f\left(a_{2}\right) \geqslant f\left(a_{3}\right)$.
(1) Determine the image of $a_{1}$, there are 3 methods; determine the image of $a_{2}$, there are also 3 methods; determine the image of $a_{3}$, there are still 3 methods. Therefore, the number of different mappings from $A$ to $B$ is
$$
3 \times 3 \times 3=27 \text{ (mappings). }
$$
(2) From $f\left(a_{1}\right)>f\left(a_{2}\right) \geqslant f\left(a_{3}\right)$, we know that $f\left(a_{1}\right)=0$ or 1.

If $f\left(a_{1}\right)=0$, then $f\left(a_{2}\right)=f\left(a_{3}\right)=-1$.
If $f\left(a_{1}\right)=1$, then $f\left(a_{2}\right)=f\left(a_{3}\right)=0$, or $f\left(a_{2}\right)=f\left(a_{3}\right)=-1$, or $f\left(a_{2}\right)=0$, $f\left(a_{3}\right)=-1$.
In summary, there are 4 mappings that satisfy the condition.
Definition 1.2 Let $f$ be a mapping from $A$ to $B$. If for any $a_{1}, a_{2} \in A$, when $a_{1} \neq a_{2}$, it must be that $f\left(a_{1}\right) \neq f\left(a_{2}\right)$, then $f$ is called an injection from $A$ to $B$. If for any $b \in B$, there exists $a \in A$ such that $f(a)=b$, then $f$ is called a surjection from $A$ to $B$.
If $A=B$, and $f$ is defined as
$$
f: x \mapsto x \text{ (where } x \in A \text{ ), }
$$

then this mapping is called the identity mapping (or unit mapping) on $A$.