create sequence SEQ_T_PUB_SYZ minvalue 1 maxvalue 9999999999 start with 1 increment by 1 cache 100; CREATE OR REPLACE TRIGGER T_PUB_SYZ_ID BEFORE INSERT ON T_PUB_SYZ FOR EACH ROW BEGIN SELECT SEQ_T_PUB_SYZ.Nextval into :NEW.ID from dual; END; <insert id="insert" parameterType="com.hospital.budget.domain.entity.TestEntity"> <selectKey resultType="java.lang.Long" order="AFTER" keyProperty="XZBH"> SELECT SEQ_TB_XT_ZLXZ.CURRVAL from dual </selectKey> INSERT INTO VIEW1 ( XZBH, XZMC, KSDM, YYBM, YQBH) VALUES ( #{XZBH}, #{XZMC}, #{KSDM}, #{YYBM}, #{YQBH}) </insert>