myBatis +mysql自动生成uuid主键

  1. <insert id="insert" parameterType="com.mawulou.model.Functions" >

  2.  
  3. <selectKey keyProperty="pkGlobalId" resultType="String" order="BEFORE">

  4. select replace(uuid(),'-','') from dual

  5. </selectKey>

  6.  
  7. insert into tbl_function (pk_global_id, name, parent_id,

  8. sort, url)

  9. values (#{pkGlobalId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{parentId,jdbcType=VARCHAR},

  10. #{sort,jdbcType=INTEGER}, #{url,jdbcType=VARCHAR})

  11. </insert>

  12. myBatis +mysql自动生成uuid主键