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

Build incorrect SQL with Example when Sqls parameter is empty #881

Open
sakaman opened this issue Apr 27, 2023 · 0 comments
Open

Build incorrect SQL with Example when Sqls parameter is empty #881

sakaman opened this issue Apr 27, 2023 · 0 comments

Comments

@sakaman
Copy link

sakaman commented Apr 27, 2023

Problem

Example build error SQL when Sqls parameter is empty, due to criterion may be empty sometimes.

Example

mapper.selectByExample(
                        Example.builder(Foo.class)
                                .where(Sqls.custom())
                                .orderByDesc(Foo.CODE)
                                .build()
                )

Generated the below incorrect SQL:

SELECT * FROM foo AND ORDER BY code Desc;

Possible Solution

Determine whether sqls.getCriteria().getCriterions is empty or not when using the where related method in tk.mybatis.mapper.entity.Example.Builder#where(tk.mybatis.mapper.util.Sqls)

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

1 participant