We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mybatis plus (当前版本3.5.2)在遇到字段设置为空的需求时,所提供的三个解决方案都存在缺陷。
通过调整FieldStrategy策略粒度太大,会影响全局。
通过mapper(entity, warpper) 方式通过entity和一个LambdaUpdateWrapper进行组合方式达到更新字段为null的目的
但是为什么不给LambadUpdateChainWrapper直接提供一个setNull()方法来直接设置字段为null呢。
并且我使用mapper(entity, warpper) 方式在wrapper中手动设置字段为null但是在进行sql 映射执行的时候还是会报错
是否可以增加setNull()方法直接设置字段为null
this.lambdaUpdate() .setNull(PileSendOutPlan::getNextDaySend) .set(PileSendOutPlan::getSendType, pileSendOutPlan.getSendType()) .set(PileSendOutPlan::getSendNow, pileSendOutPlan.getSendNow()) .set(PileSendOutPlan::getPlanSendTime, pileSendOutPlan.getPlanSendTime()) .eq(PileSendOutPlan::getId, pileSendOutPlan.getId()) .update();
The text was updated successfully, but these errors were encountered:
和这种有什么区别?
this.lambdaUpdate() .set(PileSendOutPlan::getNextDaySend,null) .set(PileSendOutPlan::getSendType, pileSendOutPlan.getSendType()) .set(PileSendOutPlan::getSendNow, pileSendOutPlan.getSendNow()) .set(PileSendOutPlan::getPlanSendTime, pileSendOutPlan.getPlanSendTime()) .eq(PileSendOutPlan::getId, pileSendOutPlan.getId()) .update();
Sorry, something went wrong.
你试试能不能更新成null
No branches or pull requests
确认
功能改进
mybatis plus (当前版本3.5.2)在遇到字段设置为空的需求时,所提供的三个解决方案都存在缺陷。
通过调整FieldStrategy策略粒度太大,会影响全局。
通过mapper(entity, warpper) 方式通过entity和一个LambdaUpdateWrapper进行组合方式达到更新字段为null的目的
但是为什么不给LambadUpdateChainWrapper直接提供一个setNull()方法来直接设置字段为null呢。
并且我使用mapper(entity, warpper) 方式在wrapper中手动设置字段为null但是在进行sql 映射执行的时候还是会报错
参考资料
是否可以增加setNull()方法直接设置字段为null
The text was updated successfully, but these errors were encountered: