|
@@ -1,10 +1,13 @@
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import org.dromara.system.domain.SysDept;
|
|
|
+import org.dromara.system.service.ISysUserService;
|
|
|
import org.example.DromaraApplication;
|
|
|
import org.example.join.domain.QueryColumn;
|
|
|
import org.example.join.domain.Table;
|
|
|
import org.example.join.sql.Sql;
|
|
|
-import org.junit.jupiter.api.Test;
|
|
|
+import org.junit.Test;
|
|
|
import org.junit.runner.RunWith;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
|
@@ -16,35 +19,38 @@ import java.util.List;
|
|
|
public class MySpringBootTest {
|
|
|
|
|
|
public static final Table sys_dept = new Table("sys_dept");
|
|
|
- public static final Table sys_user = new Table("sys_user");
|
|
|
public final QueryColumn dept_id = new QueryColumn(sys_dept, "dept_id");
|
|
|
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 create_by = new QueryColumn(sys_dept, "create_by");
|
|
|
+
|
|
|
+ public static final Table sys_user = new Table("sys_user");
|
|
|
public final QueryColumn user_id = new QueryColumn(sys_user, "user_id");
|
|
|
public final QueryColumn user_name = new QueryColumn(sys_user, "user_name");
|
|
|
public final QueryColumn nick_name = new QueryColumn(sys_user, "nick_name");
|
|
|
public final QueryColumn sex = new QueryColumn(sys_user, "sex");
|
|
|
+ public final QueryColumn create_by = new QueryColumn(sys_user, "create_by");
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ISysUserService service;
|
|
|
|
|
|
@Test
|
|
|
public void testCache() {
|
|
|
|
|
|
- List<SysDept> list = Sql.create(SysDept.class).select(
|
|
|
+ List<SysDept> list = Sql.create(SysDept.class)
|
|
|
+ .select(
|
|
|
dept_id,
|
|
|
- tenant_id,
|
|
|
- dept_id.add(tenant_id.subtract(parent_id.divide(222)
|
|
|
- .multiply(parent_id).add(1)).add(parent_id)).as(SysDept::getEmail)
|
|
|
+ tenant_id
|
|
|
)
|
|
|
.from(sys_dept)
|
|
|
- .leftJoin(sys_user).on(user_id.eq(dept_id), user_id.eq("8779"))
|
|
|
- .leftJoin(sys_user.as("a")).on(user_id.eq(dept_id), user_id.eq("8779"))
|
|
|
+ .leftJoin(sys_user).on(user_id.eq(dept_id))
|
|
|
.where(
|
|
|
- create_by.eq(user_id)
|
|
|
+ create_by.gt(98),
|
|
|
+ create_by.lt(98)
|
|
|
)
|
|
|
.list();
|
|
|
|
|
|
- System.out.println();
|
|
|
+ System.out.println(JSONObject.toJSONString(list));
|
|
|
|
|
|
}
|
|
|
|