|
@@ -6,7 +6,7 @@ import org.example.join.model.query.column.QueryColumn;
|
|
import org.example.join.model.query.column.QueryColumnField;
|
|
import org.example.join.model.query.column.QueryColumnField;
|
|
import org.example.join.model.query.column.QueryColumnFields;
|
|
import org.example.join.model.query.column.QueryColumnFields;
|
|
import org.example.join.model.table.Table;
|
|
import org.example.join.model.table.Table;
|
|
-import org.example.join.model.table.ChildTable;
|
|
|
|
|
|
+import org.example.join.model.table.SubqueryTable;
|
|
import org.example.join.sql.Sql;
|
|
import org.example.join.sql.Sql;
|
|
import org.junit.Test;
|
|
import org.junit.Test;
|
|
import org.junit.runner.RunWith;
|
|
import org.junit.runner.RunWith;
|
|
@@ -37,7 +37,7 @@ public class MySpringBootTest implements DefaultFunction {
|
|
@Test
|
|
@Test
|
|
public void testCache() {
|
|
public void testCache() {
|
|
|
|
|
|
- ChildTable childTable = Sql.create()
|
|
|
|
|
|
+ SubqueryTable subqueryTable = Sql.create()
|
|
.select(
|
|
.select(
|
|
sysDeptAll,
|
|
sysDeptAll,
|
|
status
|
|
status
|
|
@@ -50,13 +50,13 @@ public class MySpringBootTest implements DefaultFunction {
|
|
//.distinct()
|
|
//.distinct()
|
|
.select(
|
|
.select(
|
|
dept_id.as(TestEntity::getAaa),
|
|
dept_id.as(TestEntity::getAaa),
|
|
- childTable.field(tenant_id).as(TestEntity::getBbb),
|
|
|
|
- childTable.field("status").as("ccc"),
|
|
|
|
|
|
+ subqueryTable.field(tenant_id).as(TestEntity::getBbb),
|
|
|
|
+ subqueryTable.field("status").as("ccc"),
|
|
Sql.create().select(groupConcat(new QueryColumn("{0} order by {0} asc", dept_id))).from(sys_dept).as("ddd"),
|
|
Sql.create().select(groupConcat(new QueryColumn("{0} order by {0} asc", dept_id))).from(sys_dept).as("ddd"),
|
|
concat("ssss", 333).as("eee")
|
|
concat("ssss", 333).as("eee")
|
|
)
|
|
)
|
|
- .from(childTable)
|
|
|
|
- .leftJoin(sys_user).on(childTable.field(dept_id).eq(user_id))
|
|
|
|
|
|
+ .from(subqueryTable)
|
|
|
|
+ .leftJoin(sys_user).on(subqueryTable.field(dept_id).eq(user_id))
|
|
.where(
|
|
.where(
|
|
dept_id.in(Sql.create().select(dept_id).from(sys_dept)),
|
|
dept_id.in(Sql.create().select(dept_id).from(sys_dept)),
|
|
Sql.create().select(dept_id).from(sys_dept).limit(1).eq(100)
|
|
Sql.create().select(dept_id).from(sys_dept).limit(1).eq(100)
|