fix:材料表ID异常

This commit is contained in:
sugus 2025-07-20 15:14:17 +08:00
parent 682922ae6e
commit b72fbd3b55
4 changed files with 5 additions and 2 deletions

View File

@ -65,6 +65,7 @@ public class AircraftDeviceServiceImpl extends ServiceImpl<AircraftDeviceMapper,
.map(deviceImage -> {
AttachmentMaterial attachmentMaterial = new AttachmentMaterial();
BeanUtils.copyProperties(deviceImage, attachmentMaterial);
attachmentMaterial.setId(null);
attachmentMaterial.setBusinessId(aircraftDevice.getId());
attachmentMaterial.setBusinessType(BUSINESS_TYPE);
return attachmentMaterial;

View File

@ -55,6 +55,7 @@ public class AircraftInsuranceServiceImpl extends ServiceImpl<AircraftInsuranceM
.map(InsuranceImage -> {
AttachmentMaterial attachmentMaterial = new AttachmentMaterial();
BeanUtils.copyProperties(InsuranceImage, attachmentMaterial);
attachmentMaterial.setId(null);
attachmentMaterial.setBusinessId(aircraftInsurance.getId());
attachmentMaterial.setBusinessType(BUSINESS_TYPE);
return attachmentMaterial;

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.aircraft.base.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -25,7 +26,7 @@ public class AttachmentMaterial extends BaseEntity {
/**
* 主键ID
*/
@TableId(value = "id", type = IdType.AUTO)
@ApiModelProperty(value = "主键id")
private Long id;
/**

View File

@ -83,7 +83,7 @@ public class LocalStorageController {
if(!FileUtil.IMAGE.equals(FileUtil.getFileType(suffix))){
throw new BadRequestException("只能上传图片");
}
LocalStorage localStorage = localStorageService.create(file.getName(), file);
LocalStorage localStorage = localStorageService.create(file.getOriginalFilename(), file);
LocalAttachmentMaterialDTO localAttachmentMaterialDTO = new LocalAttachmentMaterialDTO();
localAttachmentMaterialDTO.setFileType(localStorage.getSuffix());
localAttachmentMaterialDTO.setFileSize(file.getSize());