mybatis 主键自增 insert后返回主键 :
<insert id="insertStudentAutoKey" parameterType="StudentEntity"> <selectKey keyProperty="studentID" resultType="String" order="BEFORE"> select nextval('student') </selectKey> INSERT INTO STUDENT_TBL (STUDENT_ID, STUDENT_NAME, STUDENT_SEX, STUDENT_BIRTHDAY, CLASS_ID) VALUES (#{studentID}, #{studentName}, #{studentSex}, #{studentBirthday}, #{classEntity.classID}) </insert>