|
|
@@ -4206,13 +4206,12 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
where.append(" and pr_create_time < '").append(new java.sql.Date(endTime.getTime() + IntegerConstant.ONE_DAY_MILLISECONDS)).append("' ");
|
|
|
}
|
|
|
StringBuffer group = new StringBuffer("group by pr_kind, pr_kindid");
|
|
|
- StringBuffer countSql = new StringBuffer("select count(pr_id) ").append(where);
|
|
|
- long l = System.currentTimeMillis();
|
|
|
- Integer totalRowCount = commonDao.queryForObject(countSql.toString(), Integer.class);
|
|
|
- long l1 = System.currentTimeMillis();
|
|
|
- logger.info("统计需要导出的数据耗时:" + (l1 - l));
|
|
|
|
|
|
- StringBuffer sql = new StringBuffer("select pr_kind as thirdKind, pr_kindid as kindId, count(1) as count").append(where).append(group).append(" order by count desc limit %d, %d");
|
|
|
+ StringBuffer sql = new StringBuffer("create temporary table temp_kind select pr_kind as thirdKind, pr_kindid as kindId, count(1) as count").append(where).append(group);
|
|
|
+ jdbcTemplate.execute(sql.toString());
|
|
|
+ Integer totalRowCount = commonDao.queryForObject("select count(*) from temp_kind", Integer.class);
|
|
|
+
|
|
|
+ String querySQL = "select * from temp_kind order by count desc limit %d, %d";
|
|
|
|
|
|
String[] titles = {"一级类目", "二级类目", "三级类目", "产品数(条)"};
|
|
|
|
|
|
@@ -4223,7 +4222,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
public void writeExcelData(Sheet eachSheet, Integer startRowCount, Integer endRowCount, Integer currentPage, Integer pageSize) throws Exception {
|
|
|
Integer startNumber = (currentPage - 1) * ExcelConstant.PER_WRITE_ROW_COUNT;
|
|
|
long l2 = System.currentTimeMillis();
|
|
|
- List<KindHierarchicalCount> kindHierarchicals = jdbcTemplate.query(String.format(sql.toString(), startNumber, pageSize), new BeanPropertyRowMapper<>(KindHierarchicalCount.class));
|
|
|
+ List<KindHierarchicalCount> kindHierarchicals = jdbcTemplate.query(String.format(querySQL, startNumber, pageSize), new BeanPropertyRowMapper<>(KindHierarchicalCount.class));
|
|
|
long l3 = System.currentTimeMillis();
|
|
|
logger.info("获取KindHierarchicalCount需要多少时间:" + (l3 - l2));
|
|
|
List<Long> ids = new ArrayList<>();
|
|
|
@@ -4272,7 +4271,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
}
|
|
|
}
|
|
|
long l5 = System.currentTimeMillis();
|
|
|
- logger.info("需要消耗的时间是:" + (l5 - l4));
|
|
|
+ logger.info("获取父级类目的时间:" + (l5 - l4));
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(kindHierarchicals)) {
|
|
|
for (int i = startRowCount; i <= endRowCount; i++) {
|