|
|
@@ -338,32 +338,29 @@ public class StoreApplyServiceImpl implements StoreApplyService {
|
|
|
@Override
|
|
|
public com.uas.sso.support.Page<StoreInfoAndProdExport> getStoreInfoAndProdCount(Pageable pageable, Date startTime, Date endTime) {
|
|
|
if (pageable == null) {
|
|
|
- return null;
|
|
|
+ return new com.uas.sso.support.Page<>();
|
|
|
}
|
|
|
// 统计数据
|
|
|
- StringBuilder sql = new StringBuilder("select a.apply_create_time applyTime, a.apply_store_name storeName, "
|
|
|
- + "a.apply_store_enuu enuu,a.apply_auth_time agreeTime, a.apply_auth_person_name agreeName, "
|
|
|
- + "ifnull(p.count, 0) count from `store$apply` a left join (select pr_enuu, count(1) count from products where 1=1");
|
|
|
+ StringBuilder dataSql = new StringBuilder("select a.apply_create_time applyTime, a.apply_store_name storeName, "
|
|
|
+ + "a.apply_store_enuu enuu,a.apply_auth_time agreeTime, a.apply_auth_person_name agreeName, "
|
|
|
+ + "ifnull(p.count, 0) count ");
|
|
|
+ // 统计总数
|
|
|
+ StringBuilder countSql = new StringBuilder("select count(1) ");
|
|
|
+ StringBuilder sql = new StringBuilder("from `store$apply` a left join (select pr_enuu, count(1) count from products where 1=1 ");
|
|
|
+ // 时间过滤
|
|
|
if (!StringUtils.isEmpty(startTime)) {
|
|
|
sql.append(" and pr_create_time >= '" + new java.sql.Date(startTime.getTime()) + "'");
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(endTime)) {
|
|
|
sql.append(" and pr_create_time < '" + new java.sql.Date(endTime.getTime() + IntegerConstant.ONE_DAY_MILLISECONDS) + "' ");
|
|
|
}
|
|
|
- sql.append(" group by pr_enuu) p on p.pr_enuu = a.apply_store_enuu where a.apply_status='PASS' and count > 0 "
|
|
|
- + "order by a.apply_create_time limit " + (pageable.getPageNumber() - 1) * pageable.getPageSize() + ","
|
|
|
- + pageable.getPageSize());
|
|
|
- // 统计总数
|
|
|
- StringBuilder totalSql = new StringBuilder("select count(1) from `store$apply` a left join (select pr_enuu, count(1) count from products where 1=1");
|
|
|
- if (!StringUtils.isEmpty(startTime)) {
|
|
|
- totalSql.append(" and pr_create_time >= '" + new java.sql.Date(startTime.getTime()) + "'");
|
|
|
- }
|
|
|
- if (!StringUtils.isEmpty(endTime)) {
|
|
|
- sql.append(" and pr_create_time < '" + new java.sql.Date(endTime.getTime() + IntegerConstant.ONE_DAY_MILLISECONDS) + "' ");
|
|
|
- }
|
|
|
- totalSql.append(" group by pr_enuu) p on p.pr_enuu = a.apply_store_enuu where a.apply_status='PASS' and count > 0 ");
|
|
|
- Integer total = commonDao.queryForObject(totalSql.toString(), Integer.class);
|
|
|
- List<StoreInfoAndProdExport> exports = commonDao.query(sql.toString(), StoreInfoAndProdExport.class);
|
|
|
+ sql.append(" group by pr_enuu) p on p.pr_enuu = a.apply_store_enuu where a.apply_status='PASS' and count > 0 ");
|
|
|
+ // 数据查询增加分页筛选
|
|
|
+ dataSql.append(sql).append("order by a.apply_create_time limit " + (pageable.getPageNumber() - 1) * pageable.getPageSize() + ","
|
|
|
+ + pageable.getPageSize());
|
|
|
+ countSql.append(sql);
|
|
|
+ Integer total = commonDao.queryForObject(countSql.toString(), Integer.class);
|
|
|
+ List<StoreInfoAndProdExport> exports = commonDao.query(dataSql.toString(), StoreInfoAndProdExport.class);
|
|
|
return new com.uas.sso.support.Page<>(pageable.getPageNumber(), pageable.getPageSize(), exports, total);
|
|
|
}
|
|
|
|