|
1 | 1 | /* |
2 | | - * Copyright 2009-2023 the original author or authors. |
| 2 | + * Copyright 2009-2024 the original author or authors. |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
|
26 | 26 | * The annotation that specify an SQL for retrieving record(s). |
27 | 27 | * <p> |
28 | 28 | * <b>How to use:</b> |
29 | | - * <br/> |
| 29 | + * <p> |
30 | 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> |
| 31 | + * <li>Simple: |
| 32 | + * |
| 33 | + * <pre>{@code |
| 34 | + * public interface UserMapper { |
| 35 | + * @Select("SELECT id, name FROM users WHERE id = #{id}") |
| 36 | + * User selectById(int id); |
| 37 | + * } |
| 38 | + * }</pre> |
| 39 | + * |
| 40 | + * </li> |
| 41 | + * <li>Dynamic SQL: |
| 42 | + * |
| 43 | + * <pre>{@code |
| 44 | + * public interface UserMapper { |
| 45 | + * @Select({ "<script>", "select * from users", "where name = #{name}", |
| 46 | + * "<if test=\"age != null\"> age = #{age} </if>", "</script>" }) |
| 47 | + * User select(@NotNull String name, @Nullable Intger age); |
| 48 | + * } |
| 49 | + * }</pre> |
| 50 | + * |
| 51 | + * </li> |
53 | 52 | * </ul> |
54 | 53 | * |
55 | 54 | * @author Clinton Begin |
| 55 | + * |
56 | 56 | * @see <a href="https://mybatis.org/mybatis-3/dynamic-sql.html">How to use Dynamic SQL</a> |
57 | 57 | */ |
58 | 58 | @Documented |
|
69 | 69 |
|
70 | 70 | /** |
71 | 71 | * @return A database id that correspond this statement |
| 72 | + * |
72 | 73 | * @since 3.5.5 |
73 | 74 | */ |
74 | 75 | String databaseId() default ""; |
|
78 | 79 | * e.g. RETURNING of PostgreSQL or OUTPUT of MS SQL Server. |
79 | 80 | * |
80 | 81 | * @return {@code true} if this select affects DB data; {@code false} if otherwise |
| 82 | + * |
81 | 83 | * @since 3.5.12 |
82 | 84 | */ |
83 | 85 | boolean affectData() default false; |
|
86 | 88 | * The container annotation for {@link Select}. |
87 | 89 | * |
88 | 90 | * @author Kazuki Shimizu |
| 91 | + * |
89 | 92 | * @since 3.5.5 |
90 | 93 | */ |
91 | 94 | @Documented |
|
0 commit comments