码迷,mamicode.com
首页 > 数据库 > 详细

mybatis+MySQL UUID主键生成策略

时间:2017-06-03 23:28:06      阅读:1468      评论:0      收藏:0      [点我收藏+]

标签:mybatis mysql uuid主键生成

<insert id="insert" parameterType="com.gzwb.wbspm.model.SpmInvoice" >

  <selectKey keyProperty="invoiceId" //主键列名 resultType="string" //主键类型 order="BEFORE" //执行insert语句之前先得到主键>

  SELECT REPLACE(UUID(),‘-‘,‘‘) FROM DUAL

  </selectKey>

    insert into spm_invoice (invoiceId, invoiceNum, invoiceItem, 

      invoiceDate, invoiceMoney, clientId, 

      clientDepId, linkMan, invoiceStatusId, 

      uploadFileName, uploadFilePath, uploadFileDate, 

      remark)

    values (#{invoiceid,jdbcType=VARCHAR}, #{invoicenum,jdbcType=VARCHAR}, #{invoiceitem,jdbcType=VARCHAR}, 

      #{invoicedate,jdbcType=DATE}, #{invoicemoney,jdbcType=DOUBLE}, #{clientid,jdbcType=INTEGER}, 

      #{clientdepid,jdbcType=INTEGER}, #{linkman,jdbcType=VARCHAR}, #{invoicestatusid,jdbcType=VARCHAR}, 

      #{uploadfilename,jdbcType=VARCHAR}, #{uploadfilepath,jdbcType=VARCHAR}, #{uploadfiledate,jdbcType=TIMESTAMP}, 

      #{remark,jdbcType=LONGVARCHAR})

  </insert>


mybatis+MySQL UUID主键生成策略

标签:mybatis mysql uuid主键生成

原文地址:http://skieshawk.blog.51cto.com/4683228/1931992

(1)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!