<insert id="insert" parameterType="com.lls.model.Employee">
<!-- selectKey 标签表示子查询中主键的提取问题
resultType表示返回主键的数据类型
keyProperty表示将属性设置到某个列中 此处为id
order="AFTER表示在插入语句之后执行
resultType="long"表示返回值得类型为long类型
-->
<selectKey resultType="long" order="AFTER" keyProperty="id">
SELECT LAST_INSERT_ID() AS ID
</selectKey>
insert into t_employee (ID, EmployeeName, Position,
Salary, Tel, DepartmentID
)
values (#{id,jdbcType=INTEGER}, #{employeename,jdbcType=VARCHAR}, #{position,jdbcType=VARCHAR},
#{salary,jdbcType=DOUBLE}, #{tel,jdbcType=VARCHAR}, #{departmentid,jdbcType=INTEGER}
)