mybatis 插入时返回刚插入记录的主键值 (Oracle作为数据库)
程序员文章站
2022-06-08 07:53:28
...
<insert id="insert" parameterType="cn.***.beans.LogObject" > <selectKey resultType="java.lang.Integer" order="BEFORE" keyProperty="id"> SELECT LOGS_SEQ.nextval AS ID FROM DUAL </selectKey> INSERT INTO S_T_LOGS ( ID, USER_ID, USER_NAME, USER_IP, OPERATION_TIME, DESCRIPTION, RESOURCE_ID) VALUES ( #{id}, #{userId}, #{userName}, #{userIp}, #{operationTime}, #{description}, #{resourceId}) </insert>
下一篇: 关于Session入库的问题