当前位置:网站首页>mysql新表,自增id长达20位,原因竟是......
mysql新表,自增id长达20位,原因竟是......
2022-04-23 14:00:00 【白云碎里一蓑舟】
自从mybaitis-plus的出现,俺们习惯于自动生成代码,虽然节省了很多开发时间,但也很容易忽视一些细节。
在某一次业务操作时,俺需要添加表a和表b的数据,表a添加正常,表b就让我开了眼了

俺不明白,遂上网寻求解决方案。
方案一:
TRUNCATE TABLE tablename
哒咩!
方案二:

哒咩!
于是我尝试在数据库中添加一条数据:

由此可见不是数据库的问题,那就是俺的代码!
经同事提点,遂进入实体类查看:

没有问题,再走代码逻辑,发现我表a的实体类没有加
type = IdType.Auto
私心觉得不是这个的问题,因为我表a的数据添加十分正常,不正常的是表b,但俺还是死马当作活马医,抱着试一试的心态重启项目,添加,成功了!

奶思~
ps:如果在定义实体类时没有指定@TableId(type=IdType.AUTO),那么mybatisPlus会将id的类型设为IdType.NONE,使用雪花算法自动帮你设置id呢~
千里之堤,溃于蚁穴,希望大家都不要被小细节打败哦
版权声明
本文为[白云碎里一蓑舟]所创,转载请带上原文链接,感谢
https://blog.csdn.net/m0_49513507/article/details/121336930
边栏推荐
猜你喜欢

Jenkins construction and use

1256:献给阿尔吉侬的花束
![MySQL [acid + isolation level + redo log + undo log]](/img/52/7e04aeeb881c8c000cc9de82032e97.png)
MySQL [acid + isolation level + redo log + undo log]

Basic knowledge learning record

Small case of web login (including verification code login)

Postman reference summary

Port occupied 1

groutine

Crontab timing task output generates a large number of mail and runs out of file system inode problem processing

Technologie zéro copie
随机推荐
Reading notes: meta matrix factorization for federated rating predictions
[code analysis (5)] communication efficient learning of deep networks from decentralized data
Question bank and answer analysis of the 2022 simulated examination of the latest eight members of Jiangxi construction (quality control)
UNIX final exam summary -- for direct Department
Program compilation and debugging learning record
Un modèle universel pour la construction d'un modèle d'apprentissage scikit
Leetcode | 38 appearance array
STM32 learning record 0007 - new project (based on register version)
About note 1
Decentralized Collaborative Learning Framework for Next POI Recommendation
The latest development of fed digital currency
_模_板_
Building MySQL environment under Ubuntu & getting to know SQL
Crontab timing task output generates a large number of mail and runs out of file system inode problem processing
Quartus prime hardware experimental development (de2-115 board) experiment II function adjustable comprehensive timer design
The art of automation
[code analysis (2)] communication efficient learning of deep networks from decentralized data
接口文档yaml
美联储数字货币最新进展
商家案例 | 运动健康APP用户促活怎么做?做好这几点足矣