SSM+Oracle自动生成uuid作为主键

oracle数据库获取uuid:select rawtohex(sys_guid()) from dual;

mapper.xml实例

 

<insert id="insert" parameterType="net.topcheer.module.entity.TsOperateLog">
    <selectKey resultType="String" keyProperty="id" order="BEFORE">
      select rawtohex(sys_guid()) from dual
    </selectKey>
    insert into TS_OPERATE_LOG (ID, OPERATE_USER_ID, OPERATE_USER_NAME,
                                IP, DEVICE, BROWSER, OPERATE_CONTENT)
    values (#{id,jdbcType=VARCHAR}, #{operateUserId,jdbcType=OTHER}, #{operateUserName,jdbcType=VARCHAR},
      #{ip,jdbcType=VARCHAR}, #{device,jdbcType=VARCHAR},
      #{browser,jdbcType=VARCHAR}, #{operateContent,jdbcType=VARCHAR})
  </insert>

 

posted @ 2020-05-27 19:29  uzxin  阅读(435)  评论(0编辑  收藏  举报