两个控件,开始时间和结束时间,我写了动态参数在单元格中,但是如果我先选择了开始时间和结束事件,那个带有动态参数的单元格就无法显示,参数写死是可以的。 模板是带数据连接的, SELECT * FROM ( SELECT row_.*, ROWNUM rn FROM ( SELECT BD_PSNDOC. NAME, so_saleorder.vdef19, org_orgs.name as org_name, org_orgs.pk_org, SUM (ic_saleout_b.norigmny) norigmny FROM ic_saleout_h ic_saleout_h INNER JOIN ic_saleout_b ic_saleout_b ON ( ic_saleout_h.cgeneralhid = ic_saleout_b.cgeneralhid ) INNER JOIN ic_saleout_e ic_saleout_e ON ( ic_saleout_b.cgeneralbid = ic_saleout_e.cgeneralbid ) INNER JOIN so_saleorder_b so_saleorder_b ON ( ic_saleout_b.cfirstbillbid = so_saleorder_b.csaleorderbid ) INNER JOIN so_saleorder so_saleorder ON ( so_saleorder_b.CSALEORDERID = so_saleorder.CSALEORDERID ) INNER JOIN BD_PSNDOC BD_PSNDOC ON ( so_saleorder.vdef19 = BD_PSNDOC.pk_psndoc ) LEFT OUTER JOIN so_squareout_b so_squareout_b ON ( ic_saleout_b.cgeneralbid = so_squareout_b.csquarebillbid AND so_squareout_b.dr = 0 ) LEFT JOIN org_orgs ON org_orgs.pk_org = ic_saleout_h.PK_ORG WHERE ( ic_saleout_h.pk_group = '0001A1100000000005F2' AND ic_saleout_b.pk_group = '0001A1100000000005F2' AND ic_saleout_h.dr = 0 AND ic_saleout_b.dr = 0 AND so_saleorder_b.pk_group = '0001A1100000000005F2' AND so_saleorder_b.dr = 0 AND so_saleorder.dr = 0 AND so_saleorder.vdef19 IS NOT NULL -- AND ic_saleout_h.PK_ORG=' ' -- 时间 -- AND so_saleorder.creationtime >= '2020-05-01 00:00:00' -- AND so_saleorder.creationtime <= '2020-05-08 23:59:59' ${if(len(type) == 0, "AND so_saleorder.creationtime >= to_char((select trunc(sysdate,'month') from dual),'YYYY-MM-dd hh24:mi:ss') AND so_saleorder.creationtime <= to_char((select last_day(sysdate) from dual),'YYYY-MM-dd hh24:mi:ss')","")} ${if(type=1,"AND so_saleorder.creationtime = to_char((sysdate),'YYYY-MM-dd hh24:mi:ss')","")} ${if(type=30,"AND so_saleorder.creationtime >= to_char((select trunc(sysdate,'month') from dual),'YYYY-MM-dd hh24:mi:ss') AND so_saleorder.creationtime <= to_char((select last_day(sysdate) from dual),'YYYY-MM-dd hh24:mi:ss')","")} ${if(type=90,"AND so_saleorder.creationtime >= to_char((SELECT TRUNC(add_months(SYSDATE,0),'Q') FROM dual),'YYYY-MM-dd hh24:mi:ss') AND so_saleorder.creationtime <= to_char((SELECT add_months(trunc(sysdate, 'Q'), 3) - 1 FROM dual),'YYYY-MM-dd hh24:mi:ss')","")} ${if(type=365, "AND so_saleorder.creationtime >= to_char((select trunc(sysdate, 'yyyy') from dual),'YYYY-MM-dd hh24:mi:ss')","")} ${if(len(starttime)=0,""," and so_saleorder.creationtime >= '"+starttime+"'")} ${if(len(endtime)=0,""," and so_saleorder.creationtime <= '"+endtime+"'")} ${if(len(公司) == 0,"","and org_orgs.name = '" + 公司 + "'")} ) GROUP BY BD_PSNDOC. NAME, so_saleorder.VDEF19, org_orgs.pk_org, org_orgs.name ORDER BY norigmny DESC ) row_)
是sql问题吗 |