From 1314667ee2e33420a9a74f30081c2f49a7c519b5 Mon Sep 17 00:00:00 2001
From: Suomm <1474983351@qq.com>
Date: Sat, 22 Jul 2023 13:59:35 +0800
Subject: [PATCH] =?UTF-8?q?test:=20=E6=B5=8B=E8=AF=95=E9=93=BE=E5=BC=8F?=
=?UTF-8?q?=E6=9F=A5=E8=AF=A2=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../mybatisflex/coretest/QueryChainTest.java | 17 -------
.../test/service/ArticleService.java | 28 +++++++++++
.../test/service/impl/ArticleServiceImpl.java | 32 +++++++++++++
.../src/main/resources/application.yml | 2 +-
.../test/service/ArticleServiceTest.java | 46 +++++++++++++++++++
5 files changed, 107 insertions(+), 18 deletions(-)
delete mode 100644 mybatis-flex-core/src/test/java/com/mybatisflex/coretest/QueryChainTest.java
create mode 100644 mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/java/com/mybatisflex/test/service/ArticleService.java
create mode 100644 mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/java/com/mybatisflex/test/service/impl/ArticleServiceImpl.java
create mode 100644 mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/service/ArticleServiceTest.java
diff --git a/mybatis-flex-core/src/test/java/com/mybatisflex/coretest/QueryChainTest.java b/mybatis-flex-core/src/test/java/com/mybatisflex/coretest/QueryChainTest.java
deleted file mode 100644
index 9db00253..00000000
--- a/mybatis-flex-core/src/test/java/com/mybatisflex/coretest/QueryChainTest.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.mybatisflex.coretest;
-
-import com.mybatisflex.core.query.QueryChain;
-import org.junit.Test;
-
-public class QueryChainTest {
-
- @Test
- public void test() {
- QueryChain queryChain = new QueryChain();
- queryChain.from("aaa")
- .leftJoin("bbb").on("aaa.id = bbb.x")
- .where(Account::getId).ge(100);
-
- System.out.println(queryChain.toSQL());
- }
-}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/java/com/mybatisflex/test/service/ArticleService.java b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/java/com/mybatisflex/test/service/ArticleService.java
new file mode 100644
index 00000000..bd2f2473
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/java/com/mybatisflex/test/service/ArticleService.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.mybatisflex.test.service;
+
+import com.mybatisflex.core.service.IService;
+import com.mybatisflex.test.model.Article;
+
+/**
+ * @author 王帅
+ * @since 2023-07-22
+ */
+public interface ArticleService extends IService {
+
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/java/com/mybatisflex/test/service/impl/ArticleServiceImpl.java b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/java/com/mybatisflex/test/service/impl/ArticleServiceImpl.java
new file mode 100644
index 00000000..85b7af60
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/java/com/mybatisflex/test/service/impl/ArticleServiceImpl.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.mybatisflex.test.service.impl;
+
+import com.mybatisflex.spring.service.impl.ServiceImpl;
+import com.mybatisflex.test.mapper.ArticleMapper;
+import com.mybatisflex.test.model.Article;
+import com.mybatisflex.test.service.ArticleService;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author 王帅
+ * @since 2023-07-22
+ */
+@Service
+public class ArticleServiceImpl extends ServiceImpl implements ArticleService {
+
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/resources/application.yml b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/resources/application.yml
index 36c7ddb6..92988471 100644
--- a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/resources/application.yml
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/main/resources/application.yml
@@ -7,7 +7,7 @@ spring:
# driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/flex_test
username: root
- password: 123456
+ password: 12345678
# driver-class-name:
# datasource:
# driver-class-name: org.h2.Driver
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/service/ArticleServiceTest.java b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/service/ArticleServiceTest.java
new file mode 100644
index 00000000..439278c4
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-test/src/test/java/com/mybatisflex/test/service/ArticleServiceTest.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.mybatisflex.test.service;
+
+import com.mybatisflex.test.model.Article;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import static com.mybatisflex.test.model.table.ArticleTableDef.ARTICLE;
+
+/**
+ * @author 王帅
+ * @since 2023-07-22
+ */
+@SpringBootTest
+class ArticleServiceTest {
+
+ @Autowired
+ ArticleService articleService;
+
+ @Test
+ void testChain() {
+ articleService.queryChain()
+ .select(ARTICLE.ALL_COLUMNS)
+ .from(ARTICLE)
+ .where(Article::getAccountId).eq(1)
+ .list()
+ .forEach(System.out::println);
+ }
+
+}