|
@@ -39,6 +39,7 @@ import java.util.Date;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
+import java.util.concurrent.ExecutionException;
|
|
import java.util.concurrent.Future;
|
|
import java.util.concurrent.Future;
|
|
import java.util.concurrent.ThreadPoolExecutor;
|
|
import java.util.concurrent.ThreadPoolExecutor;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
@@ -138,8 +139,7 @@ public class FileService {
|
|
|
|
|
|
public Mapped listUploaded(FileListInput fileListInput) {
|
|
public Mapped listUploaded(FileListInput fileListInput) {
|
|
String modelId = fileListInput.getModelId();
|
|
String modelId = fileListInput.getModelId();
|
|
- //查询总量
|
|
|
|
- long total = mongoTemplate.count(new Query(), LogicalFile.class);
|
|
|
|
|
|
+ Future<Long> longFuture = countTotalByModelId(modelId);
|
|
int page = fileListInput.getPage();
|
|
int page = fileListInput.getPage();
|
|
int pageSize = fileListInput.getPageSize();
|
|
int pageSize = fileListInput.getPageSize();
|
|
int skip = (page - 1) * pageSize;
|
|
int skip = (page - 1) * pageSize;
|
|
@@ -147,6 +147,12 @@ public class FileService {
|
|
List<LogicalFile> resultList = mongoTemplate.find(
|
|
List<LogicalFile> resultList = mongoTemplate.find(
|
|
query.skip(skip).limit(pageSize),
|
|
query.skip(skip).limit(pageSize),
|
|
LogicalFile.class);
|
|
LogicalFile.class);
|
|
|
|
+ Long total = null;
|
|
|
|
+ try {
|
|
|
|
+ total = longFuture.get();
|
|
|
|
+ } catch (InterruptedException | ExecutionException e) {
|
|
|
|
+ return Mapped.ERROR("查询出错");
|
|
|
|
+ }
|
|
Mapped res = Mapped.OK();
|
|
Mapped res = Mapped.OK();
|
|
res.put("code", 200);
|
|
res.put("code", 200);
|
|
res.put("result", resultList);
|
|
res.put("result", resultList);
|