<insert id="save" parameterType="dao.ImageInfoEntity" useGeneratedKeys="true" >
<!--selectKey-->
<selectKey resultType="int" keyProperty="id" order="BEFORE">
select "SCOTT"."s".nextVal as id
from dual
</selectKey>
INSERT INTO IMAGEINFORMATION(id,name,disksize,type,scene,time,location,url) VALUES (#{id},#{name},#{size},#{type},#{scene},#{date},#{location},#{url})
</insert>
为解决问题:当删除某些记录时,序列记录的记录还是原来记录的值得递增