Skip to content

Commit

Permalink
newCountMappedStatement
Browse files Browse the repository at this point in the history
  • Loading branch information
abel533 committed Jul 1, 2017
1 parent 96934ea commit 133998b
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/main/java/com/github/pagehelper/util/MSUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@ public class MSUtils {
private static final List<ResultMapping> EMPTY_RESULTMAPPING = new ArrayList<ResultMapping>(0);

/**
* 新建count查询和分页查询的MappedStatement
* 新建count查询的MappedStatement
*
* @param ms
* @param newMsId
* @return
*/
public static MappedStatement newCountMappedStatement(MappedStatement ms) {
MappedStatement.Builder builder = new MappedStatement.Builder(ms.getConfiguration(), ms.getId() + COUNT, ms.getSqlSource(), ms.getSqlCommandType());
public static MappedStatement newCountMappedStatement(MappedStatement ms, String newMsId) {
MappedStatement.Builder builder = new MappedStatement.Builder(ms.getConfiguration(), newMsId, ms.getSqlSource(), ms.getSqlCommandType());
builder.resource(ms.getResource());
builder.fetchSize(ms.getFetchSize());
builder.statementType(ms.getStatementType());
Expand All @@ -74,4 +75,14 @@ public static MappedStatement newCountMappedStatement(MappedStatement ms) {

return builder.build();
}

/**
* 新建count查询的MappedStatement
*
* @param ms
* @return
*/
public static MappedStatement newCountMappedStatement(MappedStatement ms) {
return newCountMappedStatement(ms, ms.getId() + COUNT);
}
}

0 comments on commit 133998b

Please sign in to comment.