elAdmin- 2020-09-18 15:39:43 [http-nio-8000-exec-3] INFO jdbc.sqlonly - select d.id, b.contract_date as contractDate, d.contract_no, d.brand_code as brandCode, d.num,
(SELECT COALESCE(sum(num1), 0) FROM tc_order_record WHERE tc_order_record.contract_no = d.contract_no)
orderSumNum, (SELECT (COALESCE(d.num, 0) - COALESCE(sum(num1), 0)) FROM tc_order_record WHERE
tc_order_record.contract_no = d.contract_no ) avai from tc_contract_detail as d left join tc_contract_base
b on d.contract_no = b.contract_no where b.data_transfer_flag = '3' and if(''!='',d.contract_no='',1=1)
and if(''!='', d.brand_code ='',1=1) and if(NULL!='', b.contract_date >=NULL,1=1) and if(NULL!='',
b.contract_date <=NULL,1=1) order by b.contract_date desc, d.id desc limit 10
elAdmin- 2020-09-18 15:39:43 [http-nio-8000-exec-3] ERROR c.a.druid.filter.stat.StatFilter - merge sql error, dbType com.alibaba.druid.pool.DruidDataSource, druid-1.1.24, sql : select count(WHERE) FROM tc_order_record WHERE tc_order_record.contract_no = d.contract_no) orderSumNum, (SELECT (COALESCE(d.num, 0) - COALESCE(sum(num1), 0)) FROM tc_order_record WHERE tc_order_record.contract_no = d.contract_no ) avai from tc_contract_detail as d left join tc_contract_base b on d.contract_no = b.contract_no where b.data_transfer_flag = '3' and if(?!='',d.contract_no=?,1=1) and if(?!='', d.brand_code =?,1=1) and if(?!='', b.contract_date >=?,1=1) and if(?!='', b.contract_date <=?,1=1)
com.alibaba.druid.sql.parser.ParserException: ERROR. pos 18, line 1, column 14, token WHERE
druid-1.1.24,
SQL能正常运行
select
d.id,
b.contract_date as contractDate,
d.contract_no,
d.brand_code as brandCode,
d.num,
(SELECT COALESCE(sum(num1), 0) FROM tc_order_record WHERE tc_order_record.contract_no = d.contract_no) orderSumNum,
(SELECT (COALESCE(d.num, 0) - COALESCE(sum(num1), 0)) FROM tc_order_record WHERE tc_order_record.contract_no = d.contract_no) avai
from tc_contract_detail as d left join tc_contract_base b on d.contract_no = b.contract_no
where b.data_transfer_flag = '3' and if('' != '', d.contract_no = '', 1 = 1)
and if('' != '', d.brand_code = '', 1 = 1) and if(NULL != '', b.contract_date >= NULL, 1 = 1) and if(NULL != '', b.contract_date <= NULL, 1 = 1)
order by b.contract_date desc, d.id desc
limit 10
错误信息
druid-1.1.24, SQL能正常运行
请问 是哪里 出了问题呢