之前用的uuid都是32位的varchar类型,这次要求插入的uuid为20位bigint类型
之前的uuid生成方式
@SelectKey(keyProperty = "id",resultType = String.class, before = true,
statement = "select replace(uuid(), '-', '')")
@Options(keyProperty = "ID", useGeneratedKeys = true)
https://blog.csdn.net/zhongkelee/article/details/52289163
public BigInteger(String val) 将一个字符串变成BigInteger类型的数据
MySQL的uuid()函数好像是字符串的吧?你可以用雪花算法生成long类型的ID,正好兼容MySQL的bigint,可参考我的这篇文章,代码copy下来直接调用就好:
https://blog.csdn.net/wzy18210825916/article/details/89382028
int 类型的 uuid 没有现成的算法了,可以自己生成一个函数,结合时间戳和随机函数。
参考这个:https://bbs.csdn.net/topics/391879360