select 产品类型,sum(销量) as 销量 from 表名称
where 1=1
${if(colType="订单支付时间","and 订单时间>='"+start_date+"'","")}
${if(colType="订单支付时间","and 订单时间<='"+end_date+"'","")}
${if(colType="发货时间","and 发货时间>='"+start_date+"'","")}
${if(colType="发货时间","and 发货时间<='"+end_date+"'","")}
group by 产品类型
colType 就是传的参数名 , 后面两个时间参数 不用参数面板配置,直接写数据集的那 ,下面用公式去生成
DATEDELTA(today(),DAY(today()) -1) 这个是当前月第一天 today() 这个是当前日期