显式更新预约图片快照字段
This commit is contained in:
+6
-2
@@ -2,6 +2,7 @@ package com.xiaowang.jayucloud.core.modules.planning.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.xiaowang.jayucloud.core.modules.planning.dto.PlanningAppointmentCreateDTO;
|
||||
import com.xiaowang.jayucloud.core.modules.planning.dto.PlanningAppointmentImageDTO;
|
||||
import com.xiaowang.jayucloud.core.modules.planning.dto.PlanningAppointmentMoveDTO;
|
||||
@@ -368,8 +369,11 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
}
|
||||
OrderDO order = requireAccessibleOrder(currentUser, item.getOrderId());
|
||||
requireEditableAppointment(order);
|
||||
item.setAppointmentProductImageFileIds(normalizeUpdatedImageFileIds(dto.getImageFileIds()));
|
||||
orderItemMapper.updateById(item);
|
||||
String imageFileIds = normalizeUpdatedImageFileIds(dto.getImageFileIds());
|
||||
item.setAppointmentProductImageFileIds(imageFileIds);
|
||||
orderItemMapper.update(null, new UpdateWrapper<OrderItemDO>()
|
||||
.eq("id", item.getId())
|
||||
.set("appointment_product_image_file_ids", imageFileIds));
|
||||
return getAppointment(currentUser, item.getId());
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -554,7 +554,7 @@ class PlanningServiceImplTest {
|
||||
var appointment = planningService.updateAppointmentImages(manager, 300L, dto);
|
||||
|
||||
assertThat(item.getAppointmentProductImageFileIds()).isEqualTo("601,602");
|
||||
org.mockito.Mockito.verify(orderItemMapper).updateById(item);
|
||||
org.mockito.Mockito.verify(orderItemMapper).update(org.mockito.ArgumentMatchers.isNull(), any());
|
||||
assertThat(appointment.getProductTitle()).isEqualTo("手绘款");
|
||||
assertThat(appointment.getProductImageFileIds()).isEqualTo("601,602");
|
||||
assertThat(appointment.getProductImageUrls()).containsExactly("https://img.example/601.jpg", "https://img.example/602.jpg");
|
||||
@@ -594,7 +594,7 @@ class PlanningServiceImplTest {
|
||||
var appointment = planningService.updateAppointmentImages(manager, 300L, dto);
|
||||
|
||||
assertThat(item.getAppointmentProductImageFileIds()).isEmpty();
|
||||
org.mockito.Mockito.verify(orderItemMapper).updateById(item);
|
||||
org.mockito.Mockito.verify(orderItemMapper).update(org.mockito.ArgumentMatchers.isNull(), any());
|
||||
assertThat(appointment.getProductImageFileIds()).isEmpty();
|
||||
assertThat(appointment.getProductImageUrls()).isEmpty();
|
||||
org.mockito.Mockito.verify(objectStorageFileService, org.mockito.Mockito.never()).getObjectStorageFileMapByIds(any());
|
||||
|
||||
Reference in New Issue
Block a user