mybatis-plus将某些字段更新为null

方式1.使用@TableField(updateStrategy = FieldStrategy.IGNORED)

@TableField(updateStrategy = FieldStrategy.IGNORED)
private String callBackLog;

但是@TableField(updateStrategy = FieldStrategy.IGNORED)在高版本中被废弃了。

方式2.使用LambdaUpdateWrapper.set(null)

  MessageLogInfo logInfo = new MessageLogInfo();
        logInfo.setMsgContent(dingMessageDTO.getMsg());
        logInfo.setMsgChannelCode(dingMessageDTO.getMsgChannel());
        logInfo.setMsgChannelValue(msgChannel.toString());
        logInfo.setMsgTypeCode(dingMessageDTO.getMsgType());
        logInfo.setMsgTypeValue(msgType.toString());
 messageLogInfoService.update(logInfo, new LambdaUpdateWrapper<MessageLogInfo>().eq(MessageLogInfo::getMsgOwner, dingMessageDTO.getMsgOwner()).eq(
                    MessageLogInfo::getReqId, dingMessageDTO.getReqId()).set(MessageLogInfo::getCallBackLog, null).set(MessageLogInfo::getJuliLog, null));

其中set(MessageLogInfo::getCallBackLog, null).set(MessageLogInfo::getJuliLog, null)就是将部分字段设置为null