diff --git a/src/main/java/cn/lihongjie/coal/coalWashingDailyAnalysis/service/CoalWashingDailyAnalysisService.java b/src/main/java/cn/lihongjie/coal/coalWashingDailyAnalysis/service/CoalWashingDailyAnalysisService.java index c32cc186..bff7d0ad 100644 --- a/src/main/java/cn/lihongjie/coal/coalWashingDailyAnalysis/service/CoalWashingDailyAnalysisService.java +++ b/src/main/java/cn/lihongjie/coal/coalWashingDailyAnalysis/service/CoalWashingDailyAnalysisService.java @@ -157,19 +157,17 @@ public class CoalWashingDailyAnalysisService """ - select to_char(date_trunc('${timeDimension}', a.end_time), 'YYYY-MM-DD') as time + select to_char(date_trunc('${timeDimension}', date), 'YYYY-MM-DD') as time <#list reportFields as field> - <#if field?is_first> , - <#if field == 'coalInfoId'>, d.id as coal_info_id, d.code as coal_info_code, d.name as coal_info_name - <#if field == 'productId'>, p.id as product_id, p.code as product_code, p.name as product_name + <#if field == 'coalInfoId'>, d.id as coal_info_id, max(d.code) as coal_info_code, max(d.name) as coal_info_name + <#if field == 'productId'>, p.id as product_id, max(p.code) as product_code, max(p.name) as product_name - <#if field?has_next>, , sum(d.amount) as amount @@ -180,23 +178,21 @@ public class CoalWashingDailyAnalysisService where 1=1 - <#if startTime??> and a.end_time >= :startTime - <#if endTime??> and a.end_time <= :endTime - <#if productIds??> and a.product_id in (:productIds) - <#if coalInfoIds??> and d.id in (:coalInfoIds) + <#if startTime??> and date >= :startTime + <#if endTime??> and date <= :endTime + <#if productIds?? && productIds?has_content > and a.product_id in :productIds + <#if coalInfoIds?? && coalInfoIds?has_content> and d.id in :coalInfoIds - group by 1, date_trunc('${timeDimension}', a.end_time) + group by 1, date_trunc('${timeDimension}', date) <#list reportFields as field> - <#if field?is_first> , <#if field == 'coalInfoId'>, d.id <#if field == 'productId'>, p.id - <#if field?has_next>,