|
@@ -41,6 +41,24 @@ public class TCommonfileController extends BaseController
|
|
|
{
|
|
|
if (!file.isEmpty())
|
|
|
{
|
|
|
+ if ("deptinfo-plane".equals(pType) || "deptinfo-welcome".equals(pType) || "deptinfo-video".equals(pType)) {
|
|
|
+ // 查询文件列表
|
|
|
+ TCommonfile commonfile = new TCommonfile();
|
|
|
+ commonfile.setpType(pType);
|
|
|
+ commonfile.setpId(Long.parseLong(pId));
|
|
|
+ List<TCommonfile> tCommonfiles = tCommonfileService.selectTCommonfileList(commonfile);
|
|
|
+ // 遍历判断是否重名
|
|
|
+ boolean isNameRepeat = false;
|
|
|
+ for (TCommonfile tCommonfile : tCommonfiles) {
|
|
|
+ if (file.getOriginalFilename().equals(tCommonfile.getFileName())) {
|
|
|
+ isNameRepeat = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 重名不上传
|
|
|
+ if (isNameRepeat) {
|
|
|
+ return AjaxResult.error("上传失败,存在重名文件");
|
|
|
+ }
|
|
|
+ }
|
|
|
String url = FileUploadUtils.upload(RuoYiConfig.getFilePath("/"+ pType), file);
|
|
|
long size = file.getSize()/1024;
|
|
|
TCommonfile tCommonfile = new TCommonfile();
|