uuid springmvc保存时候如果表的主键是字符类型则需要添加uuid String uuid = UUID.randomUUID().toString().replace("-", ""); 对象.setId(uuid);