select a.id, CONVERT(varchar(7),a.salesDate,120) as 流向日期, a.salesDate as 销售日期, a.salesAmount as 销售数量, a.createTime as 导入日期, a.batchNumber as 批次号, b.customername as 上游商业客户, d.customername as 下游商业客户, c.id as 产品ID, c.requirementname as 品名品规, a.entId as 上游商业客户ID, a.endentId as 下游商业客户ID from yd_import_main_data a,yd_customer b,yd_product c,yd_customer dwhere a.entId = b.id and a.endentId = d.id and a.productId = c.id--and a.flowMonth between '${begindate}' and '${enddate}'${if(len(customerid)=0,""," and a.entid = '"+customerid+"'")}${if(len(productid)=0,""," and a.productid = '"+productid+"'")}${if(len(begindate)=0,""," and a.salesDate >= '"+begindate+"'")}${if(len(enddate)=0,""," and a.salesDate <= '"+enddate+"'")}${if(len(createTime)=0,""," and a.createTime = '"+createTime+"'")}