|
|
@@ -32,19 +32,31 @@ public class StandardServiceImpl extends BaseMybatisDao<StandardDocumentMapper>
|
|
|
Long id = Long.valueOf(in.getId());
|
|
|
StandardDocument use = standardDocumentMapper.selectByPrimaryKey(id);
|
|
|
if (StringUtils.isNotEmpty(in.getUrl())){
|
|
|
- String filePath = uploadPath + "/" + use.getUrl();
|
|
|
- com.goafanti.common.utils.excel.FileUtils.deleteFile(filePath);
|
|
|
+ deleteFile(use.getUrl());
|
|
|
}
|
|
|
return standardDocumentMapper.deleteByPrimaryKey(id);
|
|
|
}
|
|
|
|
|
|
+ private void deleteFile( String url) {
|
|
|
+ if (url.contains(",")){
|
|
|
+ String[] split = url.split(",");
|
|
|
+ for (String s : split) {
|
|
|
+ String filePath = uploadPath + "/" + s;
|
|
|
+ com.goafanti.common.utils.excel.FileUtils.deleteFile(filePath);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ String filePath = uploadPath + "/" + url;
|
|
|
+ com.goafanti.common.utils.excel.FileUtils.deleteFile(filePath);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Object update(StandardDocument in) {
|
|
|
Long id = Long.valueOf(in.getId());
|
|
|
StandardDocument use = standardDocumentMapper.selectByPrimaryKey(id);
|
|
|
if (in.getUrl().equals(use.getUrl())&& StringUtils.isNotEmpty(in.getUrl())){
|
|
|
- String filePath = uploadPath + "/" + use.getUrl();
|
|
|
- com.goafanti.common.utils.excel.FileUtils.deleteFile(filePath);
|
|
|
+ deleteFile(use.getUrl());
|
|
|
}
|
|
|
return standardDocumentMapper.updateByPrimaryKeySelective(in);
|
|
|
}
|