|
@@ -9,9 +9,7 @@ import main.java.com.UpYun;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
-import org.springframework.data.domain.Example;
|
|
|
-import org.springframework.data.domain.Page;
|
|
|
-import org.springframework.data.domain.PageRequest;
|
|
|
+import org.springframework.data.domain.*;
|
|
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
|
|
import org.springframework.data.mongodb.core.query.Criteria;
|
|
|
import org.springframework.data.mongodb.core.query.Query;
|
|
@@ -90,8 +88,22 @@ public class ExportStructureServiceImpl implements ExportStructureService {
|
|
|
|
|
|
@Override
|
|
|
public Page<ExportStructure> findPageByExportStructure(ExportStructure exportStructure, int curPage, int pageSize) {
|
|
|
- Page<ExportStructure> list = exportStructureRepo.findAll(Example.of(exportStructure), new PageRequest(curPage - 1, pageSize));
|
|
|
- return list;
|
|
|
+ Query query = new Query();
|
|
|
+ query.addCriteria(Criteria.where("orgId").is(exportStructure.getOrgId()));
|
|
|
+ if(exportStructure.getExamType() != null){
|
|
|
+ query.addCriteria(Criteria.where("examType").is(exportStructure.getExamType()));
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(exportStructure.getExamId())){
|
|
|
+ query.addCriteria(Criteria.where("examId").is(exportStructure.getExamId()));
|
|
|
+ }
|
|
|
+ if(exportStructure.getExportType() != null){
|
|
|
+ query.addCriteria(Criteria.where("exportType").is(exportStructure.getExportType()));
|
|
|
+ }
|
|
|
+ long count = this.mongoTemplate.count(query, ExportStructure.class);
|
|
|
+ query.limit(pageSize);
|
|
|
+ query.skip((curPage - 1) * pageSize);
|
|
|
+ List<ExportStructure> list = this.mongoTemplate.find(query, ExportStructure.class);
|
|
|
+ return new PageImpl<ExportStructure>(list, new PageRequest(curPage - 1, pageSize), count);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -142,8 +154,8 @@ public class ExportStructureServiceImpl implements ExportStructureService {
|
|
|
}
|
|
|
//2.然后修改ExtractConfig表 根据 examId 和 orgId
|
|
|
Query query = new Query();
|
|
|
- query.addCriteria(Criteria.where("examId").is(Long.valueOf(exportStructure.getExamId())));
|
|
|
query.addCriteria(Criteria.where("orgId").is(exportStructure.getOrgId()));
|
|
|
+ query.addCriteria(Criteria.where("examId").is(Long.valueOf(exportStructure.getExamId())));
|
|
|
Update update = new Update();
|
|
|
update.set("ifFinish", 0);
|
|
|
update.unset("finishedPaperIdMap");
|