Mybatis-Plus更新null值写法
mybatis 更新 null 写法 Plus
2023-06-13 09:15:05 时间
有些业务要将某些字段更新位null值,但是又不能影响其它业务,就有了这篇文章。
一、写法
这样写就可以将这些字段置位null值。
@Override
public boolean updateByIdCustome(HouseSpace houseSpace) {
//return houseSpaceMapper.updateByIdCustome(houseSpace);
LambdaUpdateWrapper<HouseSpace> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(HouseSpace::getSpaceId, houseSpace.getSpaceId());
wrapper.set(HouseSpace::getCurrentMoisture, null);
wrapper.set(HouseSpace::getMineral, null);
wrapper.set(HouseSpace::getColorSmell, null);
wrapper.set(HouseSpace::getWholeRiceGrains, null);
wrapper.set(HouseSpace::getYellowGrain, null);
wrapper.set(HouseSpace::getFattyacid, null);
wrapper.set(HouseSpace::getCrudeFattyacid, null);
wrapper.set(HouseSpace::getMucoriferous, null);
wrapper.set(HouseSpace::getMildew, null);
wrapper.set(HouseSpace::getImperfectGrain, null);
wrapper.set(HouseSpace::getCompleteGrain, null);
wrapper.set(HouseSpace::getProteinSolubilization, null);
wrapper.set(HouseSpace::getDamageGrain, null);
wrapper.set(HouseSpace::getGermination, null);
wrapper.set(HouseSpace::getGluten, null);
wrapper.set(HouseSpace::getHardness, null);
wrapper.set(HouseSpace::getGrainHeight, null);
wrapper.set(HouseSpace::getRemark, null);
return this.update(wrapper);
}
记录下笔记。
参考文章
https://blog.csdn.net/qq_43718048/article/details/125979551
相关文章
- mybatis的rowbounds_oracle使用rownum分页
- Spring 全家桶之 Spring Boot 2.6.4(四)- Data Access(Part D MyBatis Plus)
- java mybatis分页查询语句_mybatis分页查询的实现(一)[通俗易懂]
- MyBatis——【第二章】mybatis动态sql(分页)
- mybatis 与 mybatisplus 根据字符串时间进行查询数据
- MyBatis介绍
- MyBatis-Plus 快速开始及详测 SpringBoot 集成Mybatis-Plus
- Mybatis 模糊查询
- maven项目使用mybatis插件Free Mybatis plugin「建议收藏」
- SpringBoot整合Mybatis超详细流程
- mybatis使用in语句,拼接逗号的使用、拼接sql语句实现批量插入、批量更新的案例处理
- Mybatis-Plus批量插入应该怎么用
- Mybatis插件better-mybatis-generator的下载与使用
- mybatis xml文件中用 if 标签判断字符串是否相等详解编程语言
- spring整合mybatis使用时的坑详解编程语言
- MyBatis配置typeAliases(别名)详解
- MyBatis自定义TypeHandler处理枚举
- MyBatis where标签
- Mybatis操作MySQL存储过程实现数据库交互(mybatis调用mysql存储过程)