1. 程式人生 > >mybatis 之 selectkey

mybatis 之 selectkey

再附上實際操作中個人用到的案例

<insert id="insertUser" parameterClass="java.util.HashMap">
<selectKey resultClass="java.lang.String" keyProperty="RID">
SELECT SYS_GUID() as RID from dual
    </selectKey>
INSERT INTO PT_USERS(USER_ID, USER_PASSWORD,USER_SFZX, USER_SSDW_DM,USER_SSDW, USER_LXFS, USER_JH, USER_XM,USER_SFZH,USER_ZCRQ)
VALUES
(#RID#,#USER_PASSWORD#,'0',#USER_SSDW_DM#,#USER_SSDW#,#USER_LXFS#,#USER_JH#,

#USER_XM#,#USER_SFZH#,SYSDATE)

</insert>