Skip to content

Commit 17f0bb2

Browse files
authored
Merge branch 'mybatis:master' into optimize
2 parents c2b57a4 + 27d644b commit 17f0bb2

File tree

16 files changed

+247
-20
lines changed

16 files changed

+247
-20
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ jobs:
1818
name: Test JDK ${{ matrix.java }}, ${{ matrix.os }}
1919

2020
steps:
21-
- uses: actions/checkout@v4
21+
- uses: actions/checkout@v5
2222
- name: Set up JDK ${{ matrix.java }} ${{ matrix.distribution }}
23-
uses: actions/setup-java@v4
23+
uses: actions/setup-java@v5
2424
with:
2525
cache: ${{ matrix.cache }}
2626
distribution: ${{ matrix.distribution }}

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ jobs:
2525

2626
steps:
2727
- name: Checkout
28-
uses: actions/checkout@v4
28+
uses: actions/checkout@v5
2929

3030
- name: Setup Java
31-
uses: actions/setup-java@v4
31+
uses: actions/setup-java@v5
3232
with:
3333
cache: maven
3434
distribution: 'temurin'

.github/workflows/coveralls.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ jobs:
99
if: github.repository_owner == 'mybatis'
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v4
12+
- uses: actions/checkout@v5
1313
- name: Set up JDK
14-
uses: actions/setup-java@v4
14+
uses: actions/setup-java@v5
1515
with:
1616
cache: maven
1717
distribution: temurin

.github/workflows/site.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ jobs:
1313
if: github.repository_owner == 'mybatis' && contains(toJSON(github.event.head_commit.message), '[maven-release-plugin] prepare release')
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v5
1717
- name: Set up JDK
18-
uses: actions/setup-java@v4
18+
uses: actions/setup-java@v5
1919
with:
2020
cache: maven
2121
distribution: temurin

.github/workflows/sonar.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ jobs:
1212
if: github.repository_owner == 'mybatis'
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v5
1616
with:
1717
# Disabling shallow clone is recommended for improving relevancy of reporting
1818
fetch-depth: 0
1919
- name: Set up JDK
20-
uses: actions/setup-java@v4
20+
uses: actions/setup-java@v5
2121
with:
2222
cache: maven
2323
distribution: temurin

.github/workflows/sonatype.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ jobs:
1212
if: github.repository_owner == 'mybatis' && ! contains(toJSON(github.event.head_commit.message), '[maven-release-plugin]')
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v5
1616
- name: Set up JDK
17-
uses: actions/setup-java@v4
17+
uses: actions/setup-java@v5
1818
with:
1919
cache: maven
2020
distribution: temurin

pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@
7272

7373
<clirr.comparisonVersion>3.4.6</clirr.comparisonVersion>
7474

75-
<byte-buddy.version>1.17.6</byte-buddy.version>
75+
<byte-buddy.version>1.17.7</byte-buddy.version>
7676
<derby.version>10.17.1.0</derby.version>
7777
<log4j.version>2.25.1</log4j.version>
78-
<mockito.version>5.18.0</mockito.version>
79-
<mssql-jdbc.version>12.10.1.jre11</mssql-jdbc.version>
78+
<mockito.version>5.19.0</mockito.version>
79+
<mssql-jdbc.version>13.2.0.jre11</mssql-jdbc.version>
8080
<testcontainers.version>1.21.3</testcontainers.version>
81-
<git-build-hook.version>3.5.0</git-build-hook.version>
81+
<git-build-hook.version>3.6.0</git-build-hook.version>
8282

8383
<!-- Add slow test groups here and annotate classes similar to @Tag('groupName'). -->
8484
<!-- Excluded groups are ran on github ci, to force here, pass -d"excludedGroups=" -->
@@ -214,7 +214,7 @@
214214
<dependency>
215215
<groupId>org.assertj</groupId>
216216
<artifactId>assertj-core</artifactId>
217-
<version>3.27.3</version>
217+
<version>3.27.4</version>
218218
<scope>test</scope>
219219
</dependency>
220220
<dependency>

src/test/java/org/apache/ibatis/plugin/PluginTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2024 the original author or authors.
2+
* Copyright 2009-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright 2009-2025 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.apache.ibatis.submitted.choosewhen;
17+
18+
import java.util.List;
19+
import java.util.Map;
20+
21+
public interface ChooseWhenMapper {
22+
List<User> selectUser(Map<String, Object> param);
23+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Copyright 2009-2025 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.apache.ibatis.submitted.choosewhen;
17+
18+
import static org.junit.jupiter.api.Assertions.assertTrue;
19+
20+
import java.io.Reader;
21+
import java.util.HashMap;
22+
import java.util.List;
23+
import java.util.Map;
24+
25+
import org.apache.ibatis.BaseDataTest;
26+
import org.apache.ibatis.io.Resources;
27+
import org.apache.ibatis.session.SqlSession;
28+
import org.apache.ibatis.session.SqlSessionFactory;
29+
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
30+
import org.junit.jupiter.api.BeforeAll;
31+
import org.junit.jupiter.api.Test;
32+
33+
public class ChooseWhenTest {
34+
35+
private static SqlSessionFactory sqlSessionFactory;
36+
37+
@BeforeAll
38+
static void initDatabase() throws Exception {
39+
try (Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/choosewhen/mybatis-config.xml")) {
40+
sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
41+
sqlSessionFactory.getConfiguration().setLazyLoadingEnabled(true);
42+
sqlSessionFactory.getConfiguration().setAggressiveLazyLoading(false);
43+
}
44+
45+
BaseDataTest.runScript(sqlSessionFactory.getConfiguration().getEnvironment().getDataSource(),
46+
"org/apache/ibatis/submitted/choosewhen/CreateDB.sql");
47+
}
48+
49+
@Test
50+
public void shouldApplyOtherwiseWhenNoParam() {
51+
try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
52+
ChooseWhenMapper mapper = sqlSession.getMapper(ChooseWhenMapper.class);
53+
Map<String, Object> param = new HashMap<>(); // name 없음
54+
List<User> users = mapper.selectUser(param);
55+
assertTrue(users.stream().allMatch(u -> "ACTIVE".equals(u.getStatus())));
56+
}
57+
}
58+
59+
}

0 commit comments

Comments
 (0)