Skip to content

Commit 1b5bcd7

Browse files
committed
Documentation
1 parent c77ba58 commit 1b5bcd7

File tree

5 files changed

+73
-2
lines changed

5 files changed

+73
-2
lines changed

src/main/java/org/mybatis/dynamic/sql/util/mybatis3/CommonCountMapper.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,22 @@
1919
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
2020
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
2121

22+
/**
23+
* This is a general purpose MyBatis mapper for count statements. Count statements are select statements that always
24+
* return a long.
25+
*
26+
* <p>This mapper can be injected as-is into a MyBatis configuration, or it can be extended with existing mappers.
27+
*
28+
* @author Jeff Butler
29+
*/
2230
public interface CommonCountMapper {
31+
/**
32+
* Execute a select statement that returns a long (typically a select(count(*)) statement). This mapper
33+
* assumes the statement returns a single row with a single column that cen be retrieved as a long.
34+
*
35+
* @param selectStatement the select statement
36+
* @return the long value
37+
*/
2338
@SelectProvider(type = SqlProviderAdapter.class, method = "select")
2439
long count(SelectStatementProvider selectStatement);
2540
}

src/main/java/org/mybatis/dynamic/sql/util/mybatis3/CommonDeleteMapper.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,20 @@
1919
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
2020
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
2121

22+
/**
23+
* This is a general purpose MyBatis mapper for delete statements.
24+
*
25+
* <p>This mapper can be injected as-is into a MyBatis configuration, or it can be extended with existing mappers.
26+
*
27+
* @author Jeff Butler
28+
*/
2229
public interface CommonDeleteMapper {
30+
/**
31+
* Execute a delete statement.
32+
*
33+
* @param deleteStatement the delete statement
34+
* @return the number of rows affected
35+
*/
2336
@DeleteProvider(type = SqlProviderAdapter.class, method = "delete")
2437
int delete(DeleteStatementProvider deleteStatement);
2538
}

src/main/java/org/mybatis/dynamic/sql/util/mybatis3/CommonInsertMapper.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,46 @@
2222
import org.mybatis.dynamic.sql.insert.render.MultiRowInsertStatementProvider;
2323
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
2424

25+
/**
26+
* This is a general purpose mapper for executing various types of insert statement.
27+
*
28+
* @param <T> the type of record associated with this mapper
29+
*/
2530
public interface CommonInsertMapper<T> {
31+
/**
32+
* Execute an insert statement with input fields mapped to values in a POJO.
33+
*
34+
* @param insertStatement the insert statement
35+
* @return the number of rows affected
36+
*/
2637
@InsertProvider(type = SqlProviderAdapter.class, method = "insert")
2738
int insert(InsertStatementProvider<T> insertStatement);
2839

40+
/**
41+
* Execute an insert statement with input fields supplied directly.
42+
*
43+
* @param insertStatement the insert statement
44+
* @return the number of rows affected
45+
*/
2946
@InsertProvider(type = SqlProviderAdapter.class, method = "generalInsert")
3047
int generalInsert(GeneralInsertStatementProvider insertStatement);
3148

49+
/**
50+
* Execute an insert statement with input fields supplied by a select statement.
51+
*
52+
* @param insertSelectStatement the insert statement
53+
* @return the number of rows affected
54+
*/
3255
@InsertProvider(type = SqlProviderAdapter.class, method = "insertSelect")
3356
int insertSelect(InsertSelectStatementProvider insertSelectStatement);
3457

58+
/**
59+
* Execute an insert statement that inserts multiple rows. The row values are supplied by mapping
60+
* to values in a List of POJOs.
61+
*
62+
* @param insertStatement the insert statement
63+
* @return the number of rows affected
64+
*/
3565
@InsertProvider(type = SqlProviderAdapter.class, method = "insertMultiple")
3666
int insertMultiple(MultiRowInsertStatementProvider<T> insertStatement);
3767
}

src/main/java/org/mybatis/dynamic/sql/util/mybatis3/CommonSelectMapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
2828

2929
/**
30-
* This is a general purpose MyBatis mapper. It allows you to execute select statements without having to
31-
* write a custom {@link org.apache.ibatis.annotations.ResultMap} for each statement.
30+
* This is a general purpose MyBatis mapper for select statements. It allows you to execute select statements without
31+
* having to write a custom {@link org.apache.ibatis.annotations.ResultMap} for each statement.
3232
*
3333
* <p>This mapper contains three types of methods:
3434
* <ul>

src/main/java/org/mybatis/dynamic/sql/util/mybatis3/CommonUpdateMapper.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,20 @@
1919
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
2020
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
2121

22+
/**
23+
* This is a general purpose MyBatis mapper for update statements.
24+
*
25+
* <p>This mapper can be injected as-is into a MyBatis configuration, or it can be extended with existing mappers.
26+
*
27+
* @author Jeff Butler
28+
*/
2229
public interface CommonUpdateMapper {
30+
/**
31+
* Execute an update statement.
32+
*
33+
* @param updateStatement the update statement
34+
* @return the number of rows affected
35+
*/
2336
@UpdateProvider(type = SqlProviderAdapter.class, method = "update")
2437
int update(UpdateStatementProvider updateStatement);
2538
}

0 commit comments

Comments
 (0)