当前位置:网站首页>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
边栏推荐
- Tensorflow & pytorch common error reporting
- China creates vast research infrastructure to support ambitious climate goals
- Jenkins construction and use
- Express middleware ③ (custom Middleware)
- Basic SQL query and learning
- Go语言 RPC通讯
- 多线程 @Async 线程池
- SSM project deployed in Alibaba cloud
- Technologie zéro copie
- Business case | how to promote the activity of sports and health app users? It is enough to do these points well
猜你喜欢
Multithreading
Business case | how to promote the activity of sports and health app users? It is enough to do these points well
Basic SQL query and learning
联想产品经理林林:天津当地网络运营商网络故障 ZUI系统后台服务器暂时无法正常工作
第一章 电商秒杀商品回顾
JS brain burning interview question reward
JMeter pressure test tool
SSM project deployed in Alibaba cloud
专题测试05·二重积分【李艳芳全程班】
Choreographer full resolution
随机推荐
Choreographer full resolution
Solution of discarding evaluate function in surprise Library
Move blog to CSDN
生产环境——
Multithreading
【vmware】vmware tools 地址
Function executes only the once function for the first time
淘宝发布宝贝提示“您的消保保证金额度不足,已启动到期保障”
Neuron and neural network
第十五章 软件工程新技术
Building MySQL environment under Ubuntu & getting to know SQL
Choreographer全解析
联想产品经理林林:天津当地网络运营商网络故障 ZUI系统后台服务器暂时无法正常工作
freeCodeCamp----arithmetic_ Arranger exercise
Special test 05 · double integral [Li Yanfang's whole class]
JMeter pressure test tool
快捷键(多行)
Basic knowledge learning record
Interesting talk about network protocol
Yarn online dynamic resource tuning