Skip to content

Commit 42cead8

Browse files
committed
Update MapperMethod.java
1 parent a14caf6 commit 42cead8

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/main/java/org/apache/ibatis/binding/MapperMethod.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,23 @@ public MapperMethod(Class<?> mapperInterface, Method method, Configuration confi
5050
}
5151

5252
public Object execute(SqlSession sqlSession, Object[] args) {
53-
Object result, param;
53+
Object result;
5454
switch (command.getType()) {
55-
case INSERT:
56-
param = method.convertArgsToSqlCommandParam(args);
55+
case INSERT: {
56+
Object param = method.convertArgsToSqlCommandParam(args);
5757
result = rowCountResult(sqlSession.insert(command.getName(), param));
5858
break;
59-
case UPDATE:
60-
param = method.convertArgsToSqlCommandParam(args);
59+
}
60+
case UPDATE: {
61+
Object param = method.convertArgsToSqlCommandParam(args);
6162
result = rowCountResult(sqlSession.update(command.getName(), param));
6263
break;
63-
case DELETE:
64-
param = method.convertArgsToSqlCommandParam(args);
64+
}
65+
case DELETE: {
66+
Object param = method.convertArgsToSqlCommandParam(args);
6567
result = rowCountResult(sqlSession.delete(command.getName(), param));
6668
break;
69+
}
6770
case SELECT:
6871
if (method.returnsVoid() && method.hasResultHandler()) {
6972
executeWithResultHandler(sqlSession, args);
@@ -75,7 +78,7 @@ public Object execute(SqlSession sqlSession, Object[] args) {
7578
} else if (method.returnsCursor()) {
7679
result = executeForCursor(sqlSession, args);
7780
} else {
78-
param = method.convertArgsToSqlCommandParam(args);
81+
Object param = method.convertArgsToSqlCommandParam(args);
7982
result = sqlSession.selectOne(command.getName(), param);
8083
}
8184
break;

0 commit comments

Comments
 (0)