bug: fix gitee I4FP6E, right join bug
@@ -187,14 +187,28 @@ class TenantLineInnerInterceptorTest {
"right join entity1 e1 on e1.id = e.id",
"SELECT * FROM entity e " +
"RIGHT JOIN entity1 e1 ON e1.id = e.id AND e1.tenant_id = 1 " +
- "WHERE e.tenant_id = 1");
+ "WHERE e.tenant_id = 1 AND e1.tenant_id = 1");
+
+ assertSql("SELECT * FROM with_as_1 e " +
+ "right join entity1 e1 on e1.id = e.id",
+ "SELECT * FROM with_as_1 e " +
+ "RIGHT JOIN entity1 e1 ON e1.id = e.id AND e1.tenant_id = 1 " +
+ "WHERE e1.tenant_id = 1");
assertSql("SELECT * FROM entity e " +
"right join entity1 e1 on e1.id = e.id " +
"WHERE e.id = ? OR e.name = ?",
"SELECT * FROM entity e " +
"RIGHT JOIN entity1 e1 ON e1.id = e.id AND e1.tenant_id = 1 " +
- "WHERE (e.id = ? OR e.name = ?) AND e.tenant_id = 1");
+ "WHERE (e.id = ? OR e.name = ?) AND e.tenant_id = 1 AND e1.tenant_id = 1");
+
+ assertSql("SELECT * FROM entity e " +
+ "right join entity1 e1 on e1.id = e.id " +
+ "right join entity2 e2 on e1.id = e2.id ",
+ "SELECT * FROM entity e " +
+ "RIGHT JOIN entity1 e1 ON e1.id = e.id AND e1.tenant_id = 1 " +
+ "RIGHT JOIN entity2 e2 ON e1.id = e2.id AND e2.tenant_id = 1 " +
+ "WHERE e.tenant_id = 1 AND e1.tenant_id = 1 AND e2.tenant_id = 1");
}
@Test
