org.apache.ibatis.jdbc.SQL it is good to have possibility to add AND criteria after JOIN with parameter, so code will look like
SQL sql = new SQL()
.SELECT()
.FROM("message AS msg")
.JOIN("user AS usr ON msg.user_id=usr.id")
.AND("usr.is_active")
OR("") - this also have a sense to have
Comment From: kazuki43zoo
@vyemialyanchyk Could you provide full java code and an expected full SQL instead of Java code snippets?
Comment From: vyemialyanchyk
here result sql expected as:
SELECT *
FROM message AS msg
JOIN user AS usr ON msg.user_id=usr.id
AND usr.is_active
Comment From: harawata
Hello @vyemialyanchyk ,
I think you should just write JOIN("user AS usr ON msg.user_id=usr.id AND usr.is_active")
.
The built-in SQL
class is for relatively simple usages.
For advanced SQLs, we recommend https://github.com/mybatis/mybatis-dynamic-sql
Comment From: harawata
See my previous comment. Closing as won't fix.