Mybatis返回新增数据的id值
oracle数据库写法:
<insert id="addInvestorFileapprove"> <selectKey resultType="int" order="BEFORE" keyProperty="investorApproveId"> select seq_investor_file_approve.nextval as investorApproveId from dual </selectKey> insert into investor_file_approve ( id, user_id, os_flag, version_no ) values ( #{investorApproveId}, #{userId}, #{osFlag}, #{versionNo} ) </insert>
mysql数据库写法:
<insert id="insert" parameterType="Department" useGeneratedKeys="true" keyProperty="id">
insert into department(name,address) values(#{name},#{address})
</insert>