mybatis 更新的时候字段不更新

1、vue3 前端非必填字段后端不更新

 processMaintApplyOutsideMapper.updateById(processMaintApply); 
前端传的空字符串,后端接收的时候会转成null,用上面的写法不会进行数据的更新

//当d字段为空时也更新该字段--字段为空时将字段值置空
processMaintApplyOutsideMapper.update(processMaintApply,new UpdateWrapper<ProcessMaintApplyOutside>().lambda()
.set(ProcessMaintApplyOutside::getDriverId, processMaintApply.getDriverId())
.set(ProcessMaintApplyOutside::getRemark, processMaintApply.getRemark())
.set(ProcessMaintApplyOutside::getTotalPrice, processMaintApply.getTotalPrice())
.eq(ProcessMaintApplyOutside::getId,processMaintApply.getId()));
posted @ 2025-02-13 10:01  flyComeOn  阅读(129)  评论(0)    收藏  举报