方法一:
//如果订单合同信息为空时,更新订单相关数据 crmOrderService.update(new NeoCrmOrder(), new UpdateWrapper<NeoCrmOrder>().eq("id", dto.getOrderId()).set("upload_contract_time", null).set("upload_contract_status", CrmOrderConstant.NOT_UPLOAD));
方法二:直接原生sql方法
错误方法
NeoCrmOrder crmOrder = new NeoCrmOrder(); crmOrder.setUploadContractTime(null); crmOrder.setUploadContractStatus(CrmOrderConstant.NOT_UPLOAD); crmOrderService.update(crmOrder, new UpdateWrapper<NeoCrmOrder>().eq("id", dto.getOrderId()));
使用实体类更新,mybatis-plus直接忽略了tUploadContractTime的null的值