|
|
@ -141,19 +141,23 @@ public class SceneTabServiceImpl implements ISceneTabService { |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public ZDResponse updateSceneTab(MultipartFile[] files, SceneTab sceneTab) { |
|
|
public ZDResponse updateSceneTab(MultipartFile[] files, SceneTab sceneTab) { |
|
|
if (ObjectUtil.isEmpty(files) || files.length > 1) { |
|
|
if (files.length > 1) { |
|
|
return ZDResponse.error("文件不能为空且只允许上传一张图片"); |
|
|
return ZDResponse.error("文件只允许上传一张图片"); |
|
|
} |
|
|
} |
|
|
String uploadPath = fileUploadApi.upload(files[0]); |
|
|
String uploadPath = ""; |
|
|
|
|
|
if (ObjectUtil.isNotEmpty(files) && files.length == 1) { |
|
|
|
|
|
uploadPath = fileUploadApi.upload(files[0]); |
|
|
sceneTab.setIconPath(uploadPath); |
|
|
sceneTab.setIconPath(uploadPath); |
|
|
int result = sceneTabMapper.updateSceneTab(sceneTab); |
|
|
} |
|
|
|
|
|
if (sceneTabMapper.updateSceneTab(sceneTab) < 0) { |
|
|
|
|
|
return ZDResponse.error("编辑失败"); |
|
|
|
|
|
} |
|
|
// 上传文件,并在附件表中添加记录
|
|
|
// 上传文件,并在附件表中添加记录
|
|
|
if (result > 0) { |
|
|
if (files.length == 1) { |
|
|
zdxtFileCommonApi.deleteZdxtFileByIds(sceneTab.getGuid()); |
|
|
zdxtFileCommonApi.deleteZdxtFileByIds(sceneTab.getGuid()); |
|
|
zdxtFileCommonApi.insertZdxtFile(files[0], sceneTab.getGuid() + "", uploadPath); |
|
|
zdxtFileCommonApi.insertZdxtFile(files[0], sceneTab.getGuid() + "", uploadPath); |
|
|
return ZDResponse.success(); |
|
|
|
|
|
} |
|
|
} |
|
|
return ZDResponse.error("编辑失败"); |
|
|
return ZDResponse.success(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
|