|
@@ -3,6 +3,7 @@ import org.dromara.system.domain.SysDept;
|
|
|
import org.example.DromaraApplication;
|
|
|
import org.example.join.model.QueryColumn;
|
|
|
import org.example.join.model.Table;
|
|
|
+import org.example.join.model.TableSublist;
|
|
|
import org.example.join.sql.Sql;
|
|
|
import org.junit.Test;
|
|
|
import org.junit.runner.RunWith;
|
|
@@ -11,8 +12,6 @@ import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
-import static org.example.join.model.QueryMethod.concat;
|
|
|
-
|
|
|
@RunWith(SpringRunner.class)
|
|
|
@SpringBootTest(classes = DromaraApplication.class)
|
|
|
public class MySpringBootTest {
|
|
@@ -22,6 +21,7 @@ public class MySpringBootTest {
|
|
|
public final QueryColumn tenant_id = new QueryColumn(sys_dept, "tenant_id");
|
|
|
public final QueryColumn parent_id = new QueryColumn(sys_dept, "parent_id");
|
|
|
public final QueryColumn ancestors = new QueryColumn(sys_dept, "ancestors");
|
|
|
+ public final QueryColumn status = new QueryColumn(sys_dept, "status");
|
|
|
|
|
|
public static final Table sys_user = new Table("sys_user");
|
|
|
public final QueryColumn user_id = new QueryColumn(sys_user, "user_id");
|
|
@@ -33,39 +33,21 @@ public class MySpringBootTest {
|
|
|
@Test
|
|
|
public void testCache() {
|
|
|
|
|
|
+ TableSublist childTable = Sql.create().select(dept_id, tenant_id, status).from(sys_dept).asTable(sys_dept);
|
|
|
+
|
|
|
List<SysDept> list = Sql.create()
|
|
|
//.logic()
|
|
|
.select(
|
|
|
- parent_id,
|
|
|
- Sql.create().select(dept_id).from(sys_dept).limit(1).as("ccc"),
|
|
|
dept_id,
|
|
|
- concat(0).as(SysDept::getAncestors)
|
|
|
+ tenant_id,
|
|
|
+ childTable.field(status),
|
|
|
+ childTable.field("status"),
|
|
|
+ Sql.create().select(dept_id).from(sys_dept).limit(1).as("ccc")
|
|
|
)
|
|
|
- .from(Sql.create().select(dept_id, tenant_id, parent_id, ancestors).from(sys_dept).asTable(sys_dept.getName()))
|
|
|
- .leftJoin(sys_user).on(user_id.eq(dept_id))
|
|
|
+ .from(childTable)
|
|
|
+ .leftJoin(sys_user).on(childTable.field(dept_id).eq(user_id))
|
|
|
.where(
|
|
|
- Sql.create().select(dept_id).from(sys_dept).limit(1).eq("sss")
|
|
|
- //dept_id.isNull(),
|
|
|
- //dept_id.eq(100)
|
|
|
- //concat("777", "555").eq(create_by),
|
|
|
- //create_by.eq(concat("777", "555").add(777)).and(concat("777", "555").eq("sss")),
|
|
|
- //create_by.ne(98),
|
|
|
- //create_by.gt(98),
|
|
|
- //create_by.lt(98),
|
|
|
- //create_by.ge(98),
|
|
|
- //create_by.le(98),
|
|
|
- //create_by.between(1, 2),
|
|
|
- //create_by.notBetween(1, 2),
|
|
|
- //create_by.like(1),
|
|
|
- //create_by.notLike(1),
|
|
|
- //create_by.likeLeft(1),
|
|
|
- //create_by.notLikeLeft(1),
|
|
|
- //create_by.likeRight(1),
|
|
|
- //create_by.notLikeRight(1),
|
|
|
- //create_by.isNull(),
|
|
|
- //create_by.isNotNull(),
|
|
|
- //create_by.in(1, 2, 3, 4),
|
|
|
- //create_by.notIn(1, 2, 3, 4)
|
|
|
+ Sql.create().select(dept_id).from(sys_dept).limit(1).eq(100)
|
|
|
)
|
|
|
.list(SysDept.class);
|
|
|
|