或许这样?但是这样就要求必须要从地区开始选取
select ${if(len(area)==0,"","地区,")}
${if(len(销售员参数)==0,"","销售员,")}
${if(len(产品类型参数)==0,"","产品类型,")}
${if(len(产品参数)==0,"","产品,")}
sum(销量) as 合计
from 表
where.....
group by ${if(len(area)==0,"","地区")}
${if(len(销售员参数)==0,"",",销售员")}
${if(len(产品类型参数)==0,"",",产品类型")}
${if(len(产品参数)==0,"",",产品")}