File tree Expand file tree Collapse file tree 1 file changed +26
-10
lines changed
src/main/java/org/apache/ibatis/annotations Expand file tree Collapse file tree 1 file changed +26
-10
lines changed Original file line number Diff line number Diff line change 26
26
* The annotation that specify an SQL for retrieving record(s).
27
27
* <p>
28
28
* <b>How to use:</b>
29
- *
30
- * <pre>
31
- * public interface UserMapper {
32
- * @Select("SELECT id, name FROM users WHERE id = #{id}")
33
- * User selectById(int id);
34
- * }
35
- * </pre>
29
+ * <br/>
30
+ * <ul>
31
+ * <li>
32
+ * Simple:
33
+ * <pre>
34
+ * public interface UserMapper {
35
+ * @Select("SELECT id, name FROM users WHERE id = #{id}")
36
+ * User selectById(int id);
37
+ * }
38
+ * </pre>
39
+ * </li>
40
+ * <li>
41
+ * Dynamic SQL:
42
+ * <pre>
43
+ * public interface UserMapper {
44
+ * @Select({"<script>",
45
+ * "select * from users",
46
+ * "where name = #{name}",
47
+ * "<if test=\"age != null\"> age = #{age} </if>",
48
+ * "</script>"})
49
+ * User select(@NotNull String name, @Nullable Intger age);
50
+ * }
51
+ * </pre>
52
+ * </li>
53
+ * </ul>
36
54
*
37
55
* @author Clinton Begin
56
+ * @see <a href="https://mybatis.org/mybatis-3/dynamic-sql.html">How to use Dynamic SQL</a>
38
57
*/
39
58
@ Documented
40
59
@ Retention (RetentionPolicy .RUNTIME )
50
69
51
70
/**
52
71
* @return A database id that correspond this statement
53
- *
54
72
* @since 3.5.5
55
73
*/
56
74
String databaseId () default "" ;
60
78
* e.g. RETURNING of PostgreSQL or OUTPUT of MS SQL Server.
61
79
*
62
80
* @return {@code true} if this select affects DB data; {@code false} if otherwise
63
- *
64
81
* @since 3.5.12
65
82
*/
66
83
boolean affectData () default false ;
69
86
* The container annotation for {@link Select}.
70
87
*
71
88
* @author Kazuki Shimizu
72
- *
73
89
* @since 3.5.5
74
90
*/
75
91
@ Documented
You can’t perform that action at this time.
0 commit comments