mybatis+mysql自动生成32位uuid主键策略

    <insert id="insert" parameterType="com.bd.pojo.Book" >
      
        <selectKey keyProperty="id" resultType="String" order="BEFORE">
            select  replace(uuid(),'-','')   from dual
        selectKey>
         
        insert into thk_book (id, name)
        values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR})
      insert>

你可能感兴趣的:(DB)