基于MybatisPlus报错:Could not set property ‘id‘ of ‘class xxxxxxx with value ‘xxxxxxxxxxxxxxxxxxxxxx‘

MybatisPlus执行"添加"操作的时候遇到问题:

Could not set property ‘id’ of 'class xxxxxxx with value ‘xxxxxxxxxxxxxxxxxxxxxx’ Cause:
在这里插入图片描述

分析: 报错意思是说无法在这个实体类中设置mybatisplus给我们自动生成的id在这里插入图片描述,我们知道mybatisplus在插入数据时候会自动生成一个UUID所以添加时候就不需要我们手动来添加id了,突然想起来数据库没有设置自增,又去数据库把自增打✓在这里插入图片描述并保存,然后又运行了一次还是这个错误,仔细想想mybatisplus是实体映射数据表,映射的是它的字段名称和类型,然而自增并不能给映射到。
得到结果: 数据表中是自增的,但是实体映射不到数据表中是否自增。

解决方案: 给实体中id列设置自增

	@TableId(value = "id",type = IdType.AUTO)

  • 8
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
引用\[1\]:这个报错是因为在升级pip时找不到满足要求的版本。\[1\]引用\[2\]:解决这个问题的方法是在命令的最后加上镜像源,例如使用以下命令:python -m pip install -U --force-reinstall pip -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com。\[2\]引用\[3\]:另外,如果在运行PyTorch代码时报错,提示找不到PIL的版本,可以通过下载Pillow的离线安装包来解决。可以在https://www.lfd.uci.edu/~gohlke/pythonlibs/#pillow下载离线安装包。然后在命令行中使用pip install命令安装离线安装包,例如:pip install Pillow-xxxxxxxxxxxxxxxxxxxxxx.whl。如果提示没有权限,可以加上参数--user,例如:pip install Pillow-xxxxxxxxxxxxxxxxxxxxxx.whl --user。\[3\]此外,还可以考虑升级pip的版本,可以使用命令'C:\Users\Lenovo\Documents\mindplus-py\environment\Python3.8.5-64\python.exe -m pip install --upgrade pip'来升级pip。 #### 引用[.reference_title] - *1* *2* [【Bug】ERROR: Could not find a version that satisfies the requirement pip (from versions: none)](https://blog.csdn.net/m0_63636799/article/details/130023320)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [ERROR: Could not find a version that satisfies the requirement PIL (from versions: none) ERROR: No](https://blog.csdn.net/sdnuwjw/article/details/111727398)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

'Beyond'

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值