|
@@ -57,14 +57,15 @@ public class MaterialPriceRecordService extends ServiceImpl<MaterialPriceRecordM
|
|
|
private RedisUtils redisUtils;
|
|
private RedisUtils redisUtils;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 分页查询。排序固定为「数据日期倒序 + 采集时间倒序」,最新的数据排在最前。
|
|
|
|
|
|
|
+ * 分页查询。排序为「数据日期倒序 → 是否含税 」
|
|
|
|
|
+ * 同一天内含税在前、不含税其次、未声明最后。
|
|
|
*
|
|
*
|
|
|
* 无任何筛选条件时总数走缓存:这种查询每次都要统计全表 60 多万行,
|
|
* 无任何筛选条件时总数走缓存:这种查询每次都要统计全表 60 多万行,
|
|
|
* 而数据一天只变几次,没必要每翻一页都统计一遍。
|
|
* 而数据一天只变几次,没必要每翻一页都统计一遍。
|
|
|
*/
|
|
*/
|
|
|
public IPage<MaterialPriceRecord> pageQuery(Page<MaterialPriceRecord> page, MaterialPriceQueryDTO query) {
|
|
public IPage<MaterialPriceRecord> pageQuery(Page<MaterialPriceRecord> page, MaterialPriceQueryDTO query) {
|
|
|
QueryWrapper<MaterialPriceRecord> wrapper = buildWrapper(query, true);
|
|
QueryWrapper<MaterialPriceRecord> wrapper = buildWrapper(query, true);
|
|
|
- wrapper.orderByDesc("price_date").orderByDesc("scraped_at");
|
|
|
|
|
|
|
+ wrapper.orderByDesc("price_date").orderByDesc("tax_included").orderByDesc("id");
|
|
|
if (!isFiltered(query)) {
|
|
if (!isFiltered(query)) {
|
|
|
page.setSearchCount(false);
|
|
page.setSearchCount(false);
|
|
|
IPage<MaterialPriceRecord> result = this.page(page, wrapper);
|
|
IPage<MaterialPriceRecord> result = this.page(page, wrapper);
|