|
@@ -1,11 +1,15 @@
|
|
|
package com.dragon.tj.portal.service.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.dragon.tj.portal.auth.model.LoginUser;
|
|
|
import com.dragon.tj.portal.auth.util.SecurityUtils;
|
|
|
import com.dragon.tj.portal.common.util.UploadUtils;
|
|
|
import com.dragon.tj.portal.entity.FileInfo;
|
|
|
+import com.dragon.tj.portal.entity.PageParam;
|
|
|
import com.dragon.tj.portal.mapper.FileManageMapper;
|
|
|
import com.dragon.tj.portal.service.FileManageService;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.context.ApplicationContext;
|
|
@@ -16,8 +20,7 @@ import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.net.InetAddress;
|
|
|
import java.net.UnknownHostException;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
@Service
|
|
|
public class FileManageServiceImpl implements FileManageService {
|
|
@@ -77,4 +80,35 @@ public class FileManageServiceImpl implements FileManageService {
|
|
|
|
|
|
return fileInfo;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Page<FileInfo> search(PageParam<FileInfo> pageParam) {
|
|
|
+ FileInfo fileParam = pageParam.getParams();
|
|
|
+ Page<FileInfo> rowPage = new Page(pageParam.getPage(), pageParam.getSize());
|
|
|
+
|
|
|
+ LambdaQueryWrapper<FileInfo> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+
|
|
|
+ //文件分类category(办公常用、系统工具)
|
|
|
+ queryWrapper.eq(fileParam.getType() != null,FileInfo::getType, fileParam.getType());
|
|
|
+ queryWrapper.eq(FileInfo::getDelFlag, 0);
|
|
|
+
|
|
|
+ //文件名称
|
|
|
+ queryWrapper.like(StringUtils.isNotEmpty(fileParam.getFileName()), FileInfo::getFileName, fileParam.getFileName());
|
|
|
+ //文件拓展名
|
|
|
+ queryWrapper.like(StringUtils.isNotEmpty(fileParam.getExtension()), FileInfo::getExtension, fileParam.getExtension());
|
|
|
+ //ContentType
|
|
|
+ queryWrapper.like(StringUtils.isNotEmpty(fileParam.getContentType()), FileInfo::getContentType, fileParam.getContentType());
|
|
|
+
|
|
|
+
|
|
|
+ //下载量排序
|
|
|
+ queryWrapper.orderByDesc(FileInfo::getDownloads);
|
|
|
+
|
|
|
+ return fileManageMapper.selectPage(rowPage, queryWrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<FileInfo> top(String type, Integer num) {
|
|
|
+ List<String> list = Arrays.asList(type.split(","));
|
|
|
+ return fileManageMapper.getTop(list,num);
|
|
|
+ }
|
|
|
}
|