Mapper
Mapper copied to clipboard
Build incorrect SQL with Example when Sqls parameter is empty
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)