<insert >

<!-- 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}
)

相关文章:

  • 2021-08-10
  • 2022-12-23
  • 2021-12-01
  • 2021-08-31
  • 2018-01-18
  • 2021-07-28
猜你喜欢
  • 2021-05-15
  • 2021-12-26
  • 2021-11-02
  • 2021-12-01
  • 2022-12-23
相关资源
相似解决方案