不需要自定义sql,可以使用UpdateWrapper
方式更新
Employee employee= new Employee();
employee.setId(1L);
employee.setOssIds(null);
LambdaUpdateWrapper<Employee> lambdaUpdate = Wrappers.lambdaUpdate();
lambdaUpdate.eq(Employee::getId, employee.getId());
if (StringUtils.isEmpty(employee.getOssIds())) {lambdaUpdate.set(Employee::getOssIds, null);
}
employeeService.update(employee, lambdaUpdate);