Skip to content

Commit 25580b2

Browse files
authored
Merge pull request #80 from jeffgbutler/master
Update dependencies, code polishing
2 parents 6b16765 + e29ce8f commit 25580b2

File tree

6 files changed

+61
-15
lines changed

6 files changed

+61
-15
lines changed

CHANGELOG.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,38 @@
11
# Change Log
22

3-
## Release 1.1.1 (Unreleased)
3+
This log will detail notable changes to MyBatis Dynamic SQL. Full details are available on the GitHub milestone pages.
4+
5+
## Release 1.1.1
6+
7+
GitHub milestone: [https://github.com/mybatis/mybatis-dynamic-sql/issues?q=milestone%3A1.1.1+](https://github.com/mybatis/mybatis-dynamic-sql/issues?q=milestone%3A1.1.1+)
48

59
### Added
610

711
- Limit and offset support in the select statement
12+
- Utilities for Spring Batch
13+
- All conditions now support conditional rendering with lambdas
14+
- Select * support
15+
- Union all support
16+
17+
### Bugs Fixed
18+
19+
- Fixed self joins
820

921

1022
## Release 1.1.0
23+
24+
GitHub milestone: [https://github.com/mybatis/mybatis-dynamic-sql/issues?q=milestone%3A1.1.0+](https://github.com/mybatis/mybatis-dynamic-sql/issues?q=milestone%3A1.1.0+)
25+
26+
### Added
27+
28+
- Support for optional conditions
29+
- Support for column comparison conditions
30+
- Support for sub-queries in the update statement
31+
- Support for expressions and constants in the select statement
32+
- Support for function in the update statement
33+
34+
### Bugs Fixed
35+
36+
- Support group by after where
37+
38+
## Initial Release - December 17, 2017

pom.xml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@
4242
<java.version>1.8</java.version>
4343
<maven.compiler.source>${java.version}</maven.compiler.source>
4444
<maven.compiler.target>${java.version}</maven.compiler.target>
45-
<junit.jupiter.version>5.4.0</junit.jupiter.version>
46-
<junit.platform.version>1.4.0</junit.platform.version>
45+
<junit.jupiter.version>5.4.1</junit.jupiter.version>
46+
<junit.platform.version>1.4.1</junit.platform.version>
47+
<spring.batch.version>4.1.2.RELEASE</spring.batch.version>
4748
<clirr.comparisonVersion>1.1.0</clirr.comparisonVersion>
4849
<module.name>org.mybatis.dynamic.sql</module.name>
4950
</properties>
@@ -121,19 +122,19 @@
121122
<dependency>
122123
<groupId>org.assertj</groupId>
123124
<artifactId>assertj-core</artifactId>
124-
<version>3.12.1</version>
125+
<version>3.12.2</version>
125126
<scope>test</scope>
126127
</dependency>
127128
<dependency>
128129
<groupId>org.mybatis</groupId>
129130
<artifactId>mybatis</artifactId>
130-
<version>3.5.0</version>
131+
<version>3.5.1</version>
131132
<scope>test</scope>
132133
</dependency>
133134
<dependency>
134135
<groupId>org.mybatis</groupId>
135136
<artifactId>mybatis-spring</artifactId>
136-
<version>2.0.0</version>
137+
<version>2.0.1</version>
137138
<scope>test</scope>
138139
</dependency>
139140
<dependency>
@@ -145,19 +146,19 @@
145146
<dependency>
146147
<groupId>org.springframework</groupId>
147148
<artifactId>spring-jdbc</artifactId>
148-
<version>5.1.5.RELEASE</version>
149+
<version>5.1.6.RELEASE</version>
149150
<scope>test</scope>
150151
</dependency>
151152
<dependency>
152153
<groupId>org.springframework.batch</groupId>
153154
<artifactId>spring-batch-core</artifactId>
154-
<version>4.1.1.RELEASE</version>
155+
<version>${spring.batch.version}</version>
155156
<scope>test</scope>
156157
</dependency>
157158
<dependency>
158159
<groupId>org.springframework.batch</groupId>
159160
<artifactId>spring-batch-test</artifactId>
160-
<version>4.1.1.RELEASE</version>
161+
<version>${spring.batch.version}</version>
161162
<scope>test</scope>
162163
<exclusions>
163164
<exclusion>

src/main/java/org/mybatis/dynamic/sql/render/RenderingStrategy.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,6 @@ public String getFormattedJdbcPlaceholder(String prefix, String parameterName) {
3232
return getFormattedJdbcPlaceholder(Optional.empty(), prefix, parameterName);
3333
}
3434

35-
public abstract String getFormattedJdbcPlaceholder(Optional<BindableColumn<?>> column, String prefix, String parameterName);
35+
public abstract String getFormattedJdbcPlaceholder(Optional<BindableColumn<?>> column, String prefix,
36+
String parameterName);
3637
}

src/main/java/org/mybatis/dynamic/sql/select/render/SelectRenderer.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,15 @@ private String orderByPhrase(SortSpecification column) {
7979
}
8080

8181
private String renderLimit(Map<String, Object> parameters, Long limit) {
82-
String placeholder = renderingStrategy.getFormattedJdbcPlaceholder(RenderingStrategy.DEFAULT_PARAMETER_PREFIX, LIMIT_PARAMETER);
82+
String placeholder = renderingStrategy.getFormattedJdbcPlaceholder(RenderingStrategy.DEFAULT_PARAMETER_PREFIX,
83+
LIMIT_PARAMETER);
8384
parameters.put(LIMIT_PARAMETER, limit);
8485
return "limit " + placeholder; //$NON-NLS-1$
8586
}
8687

8788
private String renderOffset(Map<String, Object> parameters, Long offset) {
88-
String placeholder = renderingStrategy.getFormattedJdbcPlaceholder(RenderingStrategy.DEFAULT_PARAMETER_PREFIX, OFFSET_PARAMETER);
89+
String placeholder = renderingStrategy.getFormattedJdbcPlaceholder(RenderingStrategy.DEFAULT_PARAMETER_PREFIX,
90+
OFFSET_PARAMETER);
8991
parameters.put(OFFSET_PARAMETER, offset);
9092
return "offset " + placeholder; //$NON-NLS-1$
9193
}

src/test/java/examples/springbatch/cursor/SpringBatchCursorTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.springframework.batch.core.ExitStatus;
2929
import org.springframework.batch.core.JobExecution;
3030
import org.springframework.batch.core.StepExecution;
31+
import org.springframework.batch.item.ExecutionContext;
3132
import org.springframework.batch.test.JobLauncherTestUtils;
3233
import org.springframework.batch.test.context.SpringBatchTest;
3334
import org.springframework.beans.factory.annotation.Autowired;
@@ -61,10 +62,14 @@ public void testThatRowsAreTransformedToUpperCase() throws Exception {
6162
private int numberOfRowsProcessed(JobExecution jobExecution) {
6263
return jobExecution.getStepExecutions().stream()
6364
.map(StepExecution::getExecutionContext)
64-
.mapToInt(ec -> ec.getInt("row_count"))
65+
.mapToInt(this::getRowCount)
6566
.sum();
6667
}
6768

69+
private int getRowCount(ExecutionContext executionContext) {
70+
return executionContext.getInt("row_count", 0);
71+
}
72+
6873
private long upperCaseRowCount() throws Exception {
6974
try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
7075
PersonMapper personMapper = sqlSession.getMapper(PersonMapper.class);

src/test/java/examples/springbatch/paging/SpringBatchPagingTest.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.springframework.batch.core.ExitStatus;
2929
import org.springframework.batch.core.JobExecution;
3030
import org.springframework.batch.core.StepExecution;
31+
import org.springframework.batch.item.ExecutionContext;
3132
import org.springframework.batch.test.JobLauncherTestUtils;
3233
import org.springframework.batch.test.context.SpringBatchTest;
3334
import org.springframework.beans.factory.annotation.Autowired;
@@ -62,17 +63,25 @@ public void testThatRowsAreTransformedToUpperCase() throws Exception {
6263
private int numberOfRowsProcessed(JobExecution jobExecution) {
6364
return jobExecution.getStepExecutions().stream()
6465
.map(StepExecution::getExecutionContext)
65-
.mapToInt(ec -> ec.getInt("row_count"))
66+
.mapToInt(this::getRowCount)
6667
.sum();
6768
}
6869

70+
private int getRowCount(ExecutionContext executionContext) {
71+
return executionContext.getInt("row_count", 0);
72+
}
73+
6974
private int numberOfChunks(JobExecution jobExecution) {
7075
return jobExecution.getStepExecutions().stream()
7176
.map(StepExecution::getExecutionContext)
72-
.mapToInt(ec -> ec.getInt("chunk_count"))
77+
.mapToInt(this::getChunkCount)
7378
.sum();
7479
}
7580

81+
private int getChunkCount(ExecutionContext executionContext) {
82+
return executionContext.getInt("chunk_count", 0);
83+
}
84+
7685
private long upperCaseRowCount() throws Exception {
7786
try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
7887
PersonMapper personMapper = sqlSession.getMapper(PersonMapper.class);

0 commit comments

Comments
 (0)