不会出错的一种获取插入自增长id的方法
1、xml中 insert主要添加如下:
SELECT LAST_INSERT_ID() id;
完整如下
SELECT LAST_INSERT_ID() id; insert into spececode, title, create_time#{code}, #{title}, sysdate()
2、在service中使用,插入之后可以直接获取id
speceMapper.insertSpece(spece); Long id =spece.getId();



