举例如下:
select部门
if(是否选中==是,' ,科室 ',' ')
if(是否选中==是,' ,销售人员 ',' ')
sum(金额) 销售总金额
from 销售表
group by 部门
根据 参数面板,不同选择的情况,进行数据不同纬度的汇总。
select 部门,
${if(是否选中='是'," 科室,"," 销售人员")} as 层级 ,
sum(金额)
from 表
group by
部门,${if(是否选中='是'," 科室,"," 销售人员")}