1. 程式人生 > >mybatis+mysql自動生成32位uuid主鍵策略

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
>