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>

 

posted @ 2018-10-31 15:03  我是小菜啊1  阅读(1995)  评论(0编辑  收藏  举报