Skip to content

Commit d65269e

Browse files
author
Stephen.lin
committed
优化代码 ,添加非支持的方法异常
1 parent 88621aa commit d65269e

File tree

4 files changed

+8
-59
lines changed

4 files changed

+8
-59
lines changed

src/main/java/com/zuicoding/platform/App.java

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/main/java/com/zuicoding/platform/mybatis/dialect/IDialect.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,23 @@ public String buildCountSql(String sql) {
3333
ORACLE {
3434
@Override
3535
public String buildPaginationSql(String sql, int offset, int limit) {
36-
return null;
36+
throw new UnsupportedOperationException();
3737
}
3838

3939
@Override
4040
public String buildCountSql(String sql) {
41-
return null;
41+
throw new UnsupportedOperationException();
4242
}
4343
},
4444
SQLSERVER{
4545
@Override
4646
public String buildPaginationSql(String sql, int offset, int limit) {
47-
return null;
47+
throw new UnsupportedOperationException();
4848
}
4949

5050
@Override
5151
public String buildCountSql(String sql) {
52-
return null;
52+
throw new UnsupportedOperationException();
5353
}
5454
};
5555
}

src/main/java/com/zuicoding/platform/mybatis/pagination/PaginationHandler.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class PaginationHandler implements Interceptor {
3333

3434
private IDialect dialect = IDialect.DefaultDialect.MYSQL;
3535

36-
private static final List<ResultMap> COUNT_RESULTMAPS = new ArrayList<>(1);
36+
private static final List<ResultMap> COUNT_RESULT_MAPS = new ArrayList<>(1);
3737

3838
private static final String COUNT_SQL_SUFFIX = "-SELECT-COUNT";
3939

@@ -91,8 +91,8 @@ public Object intercept(Invocation invocation) throws Throwable {
9191
//有些查询不需要查询总数
9292
if (countSql != null && !"".equals(countSql.trim())){
9393

94-
if (COUNT_RESULTMAPS.size() == 0){
95-
COUNT_RESULTMAPS.add(new ResultMap.Builder(ms.getConfiguration(),
94+
if (COUNT_RESULT_MAPS.size() == 0){
95+
COUNT_RESULT_MAPS.add(new ResultMap.Builder(ms.getConfiguration(),
9696
ms.getId()+COUNT_SQL_SUFFIX,Integer.class,
9797
Collections.<ResultMapping>emptyList()).build());
9898
}
@@ -164,7 +164,7 @@ private MappedStatement reBuildMappedStatement(MappedStatement ms,
164164
builder.resultMaps(ms.getResultMaps());
165165
//如果是构建 count mappedStatement,将 查询 count result map 设置进去
166166
if (isCount){
167-
builder.resultMaps(COUNT_RESULTMAPS);
167+
builder.resultMaps(COUNT_RESULT_MAPS);
168168

169169
}
170170

src/test/java/com/zuicoding/platform/AppTest.java

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)