Skip to content
This repository has been archived by the owner on Oct 26, 2022. It is now read-only.

convert where issues #4

Closed
boboee opened this issue Apr 1, 2019 · 2 comments
Closed

convert where issues #4

boboee opened this issue Apr 1, 2019 · 2 comments

Comments

@boboee
Copy link

boboee commented Apr 1, 2019

<sql id="Join_Where_List">
    <where>
        yn = 1
        and (inspection_type = 40 or inspection_type = 60)
    </where>
</sql>

<select id="find" resultType="java.lang.Integer" >
    SELECT
    count(*)
    from inspection
    <include refid="Join_Where_List"/>
</select>

这个测试mapper
image

生成的sql:
SELECT
count(*)
from inspection
yn = 1
and (inspection_type = 40 inspection_type = 60)

您的意思应该是:如果最前面有and 或者or 就删掉

但是如果:prefix_overrides='and|or'
生成的sql里面: 后面的 or 就会被删掉

改为:prefix_overrides='(and|or)' 就好了

欢迎校验。对正则不是很了解,可能无解大神的意思。

@hhyo
Copy link
Owner

hhyo commented Apr 1, 2019

是删除最前面的(and|or),否则会出现 where and 这种情况,本来改好了,在改python 3.4支持又少了(),我再更新一版吧,test case现在没有做断言,后续我补上

@hhyo hhyo closed this as completed in 14b0703 Apr 1, 2019
@hhyo
Copy link
Owner

hhyo commented Apr 1, 2019

0.1.7版本麻烦验证一下

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants