/***
* 生成随机唯一主键
* 格式:时间 + 随机数
*/
public class KeyUtil {
public static synchronized String genUniqueKey(){
Random random = new Random();
Integer number = random.nextInt(900000)+100000;
return System.currentTimeMillis() + String.valueOf(number);
}
随机生成唯一主键
最新推荐文章于 2024-08-28 17:24:04 发布
1280

被折叠的 条评论
为什么被折叠?



