1、oracle
<insert id="insert" parameterType="Report" >
<!-- 自增主键 -->
<selectKey resultType="java.lang.Long" order="BEFORE" keyProperty="rptId">
select SEQ_REPORT.Nextval from dual
</selectKey>
insert into MP_TREPORT (RPT_ID, ....) values (#{rptId,jdbcType=DECIMAL}, ....)
</insert>
2、sql server
<insert id="insert" parameterType="Report" useGeneratedKeys="true" keyProperty="rptId">
insert into MP_TREPORT (RPT_NUMBER, ..)values(.....);
</insert>
SQL server中insert语句与ID无关。