文档拆分-bug59381: 解决加载过长问题

This commit is contained in:
liyawei
2022-09-08 18:32:34 +08:00
parent d8666bdd2d
commit 58b461d213
2 changed files with 25 additions and 8 deletions
@@ -63,7 +63,10 @@ public interface BussDocumentLibraryEOMapper extends BaseMapper<BussDocumentLibr
* @param condition
* @return
*/
IPage ocrPageInfo(@Param("page") IPage page,
// IPage ocrPageInfo(@Param("page") IPage page,
// @Param("field") String field,
// @Param("condition") String condition);
List<Map<String, Object>> ocrPageInfo(
@Param("field") String field,
@Param("condition") String condition);
@@ -3473,6 +3473,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
//查询字段
StringBuilder fieldSb = new StringBuilder();
StringBuilder osfSql = new StringBuilder();
StringBuilder join = new StringBuilder();
int i = 1;
if (ObjectUtils.isNotEmpty(fileFieldList)) {
@@ -3480,16 +3481,26 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
fieldSb.append("bdl." + fileField + ",");
if (i == 1) {
join.append(" on osf.connect_id = bdl." + fileField);
osfSql.append("(select id, file_name, connect_id from oss_file where connect_id in (select ").append(fileField).append(" from buss_document_library where ").append(fileField).append(" is not null)");
i++;
continue;
} else if (i == fileFieldList.size()) {
join.append(" or osf.connect_id = bdl." + fileField);
osfSql.append(" UNION select id, file_name, connect_id from oss_file where connect_id in (select ").append(fileField).append(" from buss_document_library where ").append(fileField).append(" is not null))");
continue;
}
join.append(" or osf.connect_id = bdl." + fileField);
osfSql.append(" UNION select id, file_name, connect_id from oss_file where connect_id in (select ").append(fileField).append(" from buss_document_library where ").append(fileField).append(" is not null)");
i++;
}
}
String fieldStr = fieldSb.substring(0, fieldSb.length() - 1);
String field = " osf.id,bdl.id as \"buss_document_library_id\",bdl.serial_number,bdl.title,bdl.title_en,bdl.state,osf.file_name,osf.connect_id," + fieldStr
+ " from oss_file osf join buss_document_library bdl" + join.toString();
+ " from " + osfSql.toString() + " osf join buss_document_library bdl" + join.toString();
//查询条件
StringBuilder conditionSb = new StringBuilder("where 1 = 1");
@@ -3535,14 +3546,15 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
int pageNo = Integer.parseInt(parameter.get("pageNo").toString());
int pageSize = Integer.parseInt(parameter.get("pageSize").toString());
IPage page = new Page(pageNo, pageSize);
IPage infoPage = bussDocumentLibraryEOMapper.ocrPageInfo(page, field, conditionSb.toString());
List records = infoPage.getRecords();
// IPage infoPage = bussDocumentLibraryEOMapper.ocrPageInfo(page, field, conditionSb.toString());
// List records = infoPage.getRecords();
List records = bussDocumentLibraryEOMapper.ocrPageInfo(field, conditionSb.toString());
page.setTotal(records.size());
records = records.subList(pageNo * pageSize - pageSize, pageNo * pageSize);
//数据字典
List<SysDictItem> sysDictItems = sysDictItemServiceImpl.selectItemsAll();
//下拉选处理数据字典
for (Object record : records) {
Map<String, Object> record1 = (Map) record;
String key = "";
@@ -3580,7 +3592,9 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
record1.put("text_info", onlCgformFieldList.get(0).getDbFieldEnName());
}
}
return infoPage;
page.setRecords(records);
return page;
}
public IPage getInfoPage(Map<String, Object> parameter) {
@@ -3683,7 +3697,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
String cut = (String) parameter.get("cut");
String flag = String.valueOf(parameter.get("flag"));
//查询条件
StringBuilder conditionSb = new StringBuilder("where 1 = 1");
StringBuilder conditionSb = new StringBuilder("where 1 = 1 and osf.connect_id is not null");
//过滤查询条件字段类型使用
List<Map<String, Object>> mapList = queryCondition("1", cut, null);