mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
贴皮文件上传接口支持只传文件不更新贴皮
This commit is contained in:
+1
-1
@@ -117,7 +117,7 @@ public class VeneerController {
|
|||||||
@PostMapping("/pic")
|
@PostMapping("/pic")
|
||||||
@Operation(summary = "上传贴皮照片")
|
@Operation(summary = "上传贴皮照片")
|
||||||
@OperateLog(logArgs = false, type = CREATE)
|
@OperateLog(logArgs = false, type = CREATE)
|
||||||
public CommonResult<Long> uploadVeneerPic(@RequestParam("id") Long id,
|
public CommonResult<Long> uploadVeneerPic(@RequestParam(value = "id", required = false) Long id,
|
||||||
@RequestPart(value = "file") MultipartFile file) throws IOException {
|
@RequestPart(value = "file") MultipartFile file) throws IOException {
|
||||||
return success(veneerService.uploadPic(id, file));
|
return success(veneerService.uploadPic(id, file));
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-4
@@ -128,7 +128,7 @@ public class VeneerServiceImpl implements VeneerService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long uploadPic(Long id, MultipartFile file) throws IOException {
|
public Long uploadPic(Long id, MultipartFile file) throws IOException {
|
||||||
if (ObjectUtil.isNull(validateExist(id))) {
|
if (ObjectUtil.isNotNull(id) && ObjectUtil.isNull(validateExist(id))) {
|
||||||
throw new ServiceException(VENEER_NOT_EXIST);
|
throw new ServiceException(VENEER_NOT_EXIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,9 +143,11 @@ public class VeneerServiceImpl implements VeneerService {
|
|||||||
organizationDTO = details.getData();
|
organizationDTO = details.getData();
|
||||||
}
|
}
|
||||||
Long fileId = fileApi.createFileAndReturnId(file.getBytes(), String.format("%s-veneer-pic-file-%s.%s", organizationDTO.getName(), LocalDateTimeUtil.format(LocalDateTime.now(), PURE_DATETIME_PATTERN), getFileExtension(file.getOriginalFilename())));
|
Long fileId = fileApi.createFileAndReturnId(file.getBytes(), String.format("%s-veneer-pic-file-%s.%s", organizationDTO.getName(), LocalDateTimeUtil.format(LocalDateTime.now(), PURE_DATETIME_PATTERN), getFileExtension(file.getOriginalFilename())));
|
||||||
veneerMapper.update(new LambdaUpdateWrapper<VeneerDO>()
|
if (ObjectUtil.isNotNull(id)) {
|
||||||
.eq(VeneerDO::getId, id)
|
veneerMapper.update(new LambdaUpdateWrapper<VeneerDO>()
|
||||||
.set(VeneerDO::getFileId, fileId));
|
.eq(VeneerDO::getId, id)
|
||||||
|
.set(VeneerDO::getFileId, fileId));
|
||||||
|
}
|
||||||
return fileId;
|
return fileId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user