Skip to content
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条件不一致 #112

Open
yangzhibo478496017 opened this issue May 17, 2023 · 13 comments
Open

控制台和插件转换sql条件不一致 #112

yangzhibo478496017 opened this issue May 17, 2023 · 13 comments

Comments

@yangzhibo478496017
Copy link

插件版本:5.0.7.7
控制台:
Preparing: SELECT id, create_by, create_time, update_by, update_time, rel_tenant_ids, del_flag, vannum, vantype, vanlength, fueltype, vancolortype, maxloadcapacity, vanweight, framenum, enginenum, emission, roadpermitpic, roadpermit, roadpermitdate, drilicensepic, drilicense, drilicensedate, belong, beidoustate, state, ownvehicle, auditpersonid, audit_time, remarks, cheduiid, changjia, insure_company, buy_time, insure_begin_time, insure_finish_time FROM vms_van WHERE (del_flag = ? AND cheduiid = ?) AND rel_tenant_ids = '402'
==> Parameters: 0(Integer), 853c548c60c9266453886c9894422c10(String)

插件:
org.jeecg.modules.vms.vmsvan.mapper.VmsVanMapper.selectList
> SELECT id,create_by,create_time,update_by,update_time,rel_tenant_ids,del_flag,vannum,vantype,vanlength,fueltype,vancolortype,maxloadcapacity,vanweight,framenum,enginenum,emission,roadpermitpic,roadpermit,roadpermitdate,drilicensepic,drilicense,drilicensedate,belong,beidoustate,state,ownvehicle,auditpersonid,audit_time,remarks,cheduiid,changjia,insure_company,buy_time,insure_begin_time,insure_finish_time FROM vms_van WHERE (del_flag = 0 AND cheduiid = '853c548c60c9266453886c9894422c10')
> [{"ew.paramNameValuePairs.MPGENVAL1":"0"},{"ew.paramNameValuePairs.MPGENVAL2":"'853c548c60c9266453886c9894422c10'"}]
> total:6

@Link-Kou
Copy link
Owner

@yangzhibo478496017 提供一下XML。我复现一下。

@yangzhibo478496017
Copy link
Author

因为有租户逻辑 所以加了判断是否向sql中注入租户id条件的判断
mybatisconfig.txt
xml.txt

@yangzhibo478496017
Copy link
Author

@Link-Kou

@Link-Kou
Copy link
Owner

@yangzhibo478496017 收到

@Link-Kou
Copy link
Owner

@yangzhibo478496017
问题我定位到了。由于我的插件优先你的插件执行导致的问题。
我调整一下插件执行顺序。待我修改好代码

@Link-Kou
Copy link
Owner

@yangzhibo478496017 现在5.0.8试试看。

@yangzhibo478496017
Copy link
Author

@Link-Kou 好的

@yangzhibo478496017
Copy link
Author

@Link-Kou 已经更新插件了还是不行
插件:
select vv.id as vanId, vv.vannum as vanNum, a.MESSAGE_CONTENT as messageContent, a.CREATE_TIME as CREATE_TIME, svm.ORIGINAL_VAN_ID as ORIGINAL_VAN_ID from vms_van vv left join (select sm.VAN_ID, SUBSTRING_INDEX(GROUP_CONCAT(sm.MESSAGE_CONTENT ORDER BY sm.CREATE_TIME DESC), ',', 1) as MESSAGE_CONTENT, SUBSTRING_INDEX(GROUP_CONCAT(sm.CAR_CAPTAIN_ID ORDER BY sm.CREATE_TIME DESC), ',', 1) as CAR_CAPTAIN_ID, SUBSTRING_INDEX(GROUP_CONCAT(sm.CREATE_TIME ORDER BY sm.CREATE_TIME DESC), ',', 1) as CREATE_TIME from safe_message sm where sm.DEL_FLAG = '0' group by sm.VAN_ID) a on a.VAN_ID = vv.id and a.CAR_CAPTAIN_ID = '342ef9d04054107d3a208729b6c75af1' left join safe_van_mapping svm on svm.VAN_ID = vv.id and svm.DEL_FLAG = '0' WHERE vv.DEL_FLAG = '0' AND vv.cheduiid = '853c548c60c9266453886c9894422c10'

控制台:
SELECT vv.id AS vanId, vv.vannum AS vanNum, a.MESSAGE_CONTENT AS messageContent, a.CREATE_TIME AS CREATE_TIME, svm.ORIGINAL_VAN_ID AS ORIGINAL_VAN_ID FROM vms_van vv LEFT JOIN (SELECT sm.VAN_ID, SUBSTRING_INDEX(GROUP_CONCAT(sm.MESSAGE_CONTENT ORDER BY sm.CREATE_TIME DESC), ',', 1) AS MESSAGE_CONTENT, SUBSTRING_INDEX(GROUP_CONCAT(sm.CAR_CAPTAIN_ID ORDER BY sm.CREATE_TIME DESC), ',', 1) AS CAR_CAPTAIN_ID, SUBSTRING_INDEX(GROUP_CONCAT(sm.CREATE_TIME ORDER BY sm.CREATE_TIME DESC), ',', 1) AS CREATE_TIME FROM safe_message sm WHERE sm.DEL_FLAG = '0' AND sm.rel_tenant_ids = '402' GROUP BY sm.VAN_ID) a ON a.VAN_ID = vv.id AND a.CAR_CAPTAIN_ID = ? LEFT JOIN safe_van_mapping svm ON svm.VAN_ID = vv.id AND svm.DEL_FLAG = '0' WHERE vv.DEL_FLAG = '0' AND vv.cheduiid = ? AND vv.rel_tenant_ids = '402' LIMIT ?

@Link-Kou
Copy link
Owner

@yangzhibo478496017 看样子,还要在细细研究一下

@Link-Kou
Copy link
Owner

@yangzhibo478496017 我发布了新版本,麻烦在试一下

@yangzhibo478496017
Copy link
Author

@Link-Kou 好的

@yangzhibo478496017
Copy link
Author

@Link-Kou 还是不行

@Link-Kou
Copy link
Owner

@yangzhibo478496017 最近找到了新的办法。我在下个大版本迭代中添加解决

@github-staff github-staff deleted a comment from naudachu May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@Link-Kou @yangzhibo478496017 and others