one

  useGeneratedKeys="true" keyProperty="userId"
Copy the code

Then you just need to get it through the inserted entity class

two

<selectKey keyProperty="userId" order="AFTER" resultType="java.lang.Integer">
            SELECT 0
        </selectKey>
Copy the code