在insert语句中加入
<selectKey resultType="java.lang.Integer" keyProperty="id"> select SEQ_table_ID.CURRVAL from dual </selectKey> table 表名 keyProperty="id" 就是写入时保存对象的id nextval的值是每调用一次就增加一次;currval的值调用时,还是和自身会话的当前值一样
取出id如下:
managefilemapper.insertingle(managefilebo); Integer id = managefilebo.getId();