-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
再来一个SQL解析异常 #2765
Comments
我将sql贴出来。这个SQL可以验证我提出来的两个issue select a.creatorName,a.fsOutpatientName,a.createDate,a.code,a.patientName,a.docDeptName,
a.docName,GROUP_CONCAT(a.drugName) drugName,sum(a.preferential) preferential,sum(a.realAmount) realAmount,sum(a.nowPay) nowPay,
sum(a.bankPay) bankPay,
sum(a.renderAccount) renderAccount,sum(a.insuranceRenderAccount) insuranceRenderAccount,a.chargeTypeName,a.cardNumber,a.regCode,
a.prCreateDate,a.prCode from (
SELECT bpi.fsOutpatientName,pp.name creatorName,boc.createDate,bi.code,bi.name patientName,
pd.name docDeptName,pp1.name docName,CONCAT(bpi.name,' X ',bpi.num,bpi.unitName) drugName,
boci.preferential,boci.realAmount,boci.nowPay,boci.bankPay,boci.renderAccount,boci.insuranceRenderAccount,
boc.chargeTypeName,ba1.cardNumber,brf.code regCode,bp.createDate prCreateDate,bp.code prCode
FROM b_outpatient_charge_item boci
LEFT JOIN b_outpatient_charge boc ON boc.id=boci.charge_id
LEFT JOIN b_prescription_item bpi ON bpi.id=boci.prescription_item_id
LEFT JOIN b_prescription bp ON bp.id=bpi.prescription_id
LEFT JOIN pl_person pp ON pp.id=boc.creator_id
LEFT JOIN b_invoice bi ON bi.id=boci.invoice_id
LEFT JOIN pl_department pd ON pd.id=bp.doctor_dept_id
LEFT JOIN pl_person pp1 ON pp1.id=bp.doctor_id
LEFT JOIN b_reg_from brf ON brf.id=boc.form_id
LEFT JOIN b_account ba1 ON ba1.id=brf.account_id
WHERE
<#if isNotEmpty(startTime)>
AND boc.createDate >= '${startTime}'
</#if>
<#if isNotEmpty(endTime)>
AND boc.createDate <= '${endTime}'
</#if>
<#if isNotEmpty(doctorId)>
and and pp1.id='${doctorId}'
</#if>
GROUP BY boci.id
) a group by a.prCode,a.fsOutpatientName
union
select a.creatorName,a.fsOutpatientName,a.createDate,a.code,a.patientName,a.docDeptName,
a.docName,GROUP_CONCAT(a.drugName) drugName,sum(a.preferential) preferential,sum(a.realAmount) realAmount,sum(a.nowPay) nowPay,
sum(a.bankPay) bankPay,sum(a.renderAccount) renderAccount,sum(a.insuranceRenderAccount) insuranceRenderAccount,a.chargeTypeName,
a.cardNumber,a.regCode,a.prCreateDate,a.prCode from (
SELECT bpi.fsOutpatientName,pp.name creatorName,boc.createDate,bi.code,bi.name patientName,
pd.name docDeptName,pp1.name docName,CONCAT(bpi.name,' X ',bpi.num,bpi.unitName) drugName,
boci.preferential,boci.realAmount,boci.nowPay,boci.bankPay,boci.renderAccount,boci.insuranceRenderAccount,
boc.chargeTypeName,ba1.cardNumber,brf.code regCode,bp.createDate prCreateDate,bp.code prCode
FROM b_outpatient_charge_item boci
LEFT JOIN b_outpatient_charge boc ON boc.id=boci.charge_id
LEFT JOIN b_prescription_item bpi ON bpi.id=boci.prescription_item_id
LEFT JOIN b_prescription bp ON bp.id=bpi.prescription_id
LEFT JOIN pl_person pp ON pp.id=boc.creator_id
LEFT JOIN b_invoice bi ON bi.id=boci.invoice_id
LEFT JOIN pl_department pd ON pd.id=bp.doctor_dept_id
LEFT JOIN pl_person pp1 ON pp1.id=bp.doctor_id
LEFT JOIN b_reg_from brf ON brf.id=boc.form_id
LEFT JOIN b_account ba1 ON ba1.id=brf.account_id
WHERE
<#if isNotEmpty(startTime)>
AND boc.createDate >= '${startTime}'
</#if>
<#if isNotEmpty(endTime)>
AND boc.createDate <= '${endTime}'
</#if>
<#if isNotEmpty(doctorId)>
and oci.bill_person_id='${doctorId}'
</#if>
<#if isNotEmpty(doctorId)>
and and pp1.id='${doctorId}'
</#if>
) a group by a.prCode,a.fsOutpatientName
|
你用的是那种模式? |
已修复,待新版本发布。后续需要你自行填写1=1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
版本号:
1.7.6
问题描述:
当sql中存在两个查询用union进行结果拼接时,sql解析出来的效果不一致,前面一个sql的where条件后没有自动生成1=1,而第二个sql的where条件后出现了1=1。两个解析结果不一致
错误日志&截图:
原始sql
解析后的sql
重现步骤:
友情提示(为了提高issue处理效率):
The text was updated successfully, but these errors were encountered: