|
21 | 21 | import org.apache.ibatis.annotations.DeleteProvider;
|
22 | 22 | import org.apache.ibatis.annotations.InsertProvider;
|
23 | 23 | import org.apache.ibatis.annotations.Result;
|
| 24 | +import org.apache.ibatis.annotations.ResultMap; |
24 | 25 | import org.apache.ibatis.annotations.Results;
|
| 26 | +import org.apache.ibatis.annotations.Select; |
25 | 27 | import org.apache.ibatis.annotations.SelectProvider;
|
26 | 28 | import org.apache.ibatis.annotations.UpdateProvider;
|
27 | 29 | import org.mybatis.dynamic.sql.delete.render.DeleteStatement;
|
|
30 | 32 | import org.mybatis.dynamic.sql.select.render.SelectStatement;
|
31 | 33 | import org.mybatis.dynamic.sql.update.render.UpdateStatement;
|
32 | 34 | import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
|
| 35 | +import org.mybatis.dynamic.sql.where.render.WhereClauseAndParameters; |
33 | 36 |
|
34 | 37 | public interface AnimalDataMapper {
|
35 | 38 |
|
36 | 39 | @SelectProvider(type=SqlProviderAdapter.class, method="select")
|
37 |
| - @Results({ |
| 40 | + @Results(id="AnimalDataResult", value={ |
38 | 41 | @Result(column="id", property="id", id=true),
|
39 | 42 | @Result(column="animal_name", property="animalName"),
|
40 | 43 | @Result(column="brain_weight", property="brainWeight"),
|
@@ -62,4 +65,20 @@ public interface AnimalDataMapper {
|
62 | 65 |
|
63 | 66 | @InsertProvider(type=SqlProviderAdapter.class, method="insertSelect")
|
64 | 67 | int insertSelect(InsertSelectStatement insertSelectStatement);
|
| 68 | + |
| 69 | + @Select({ |
| 70 | + "select id, animal_name, brain_weight, body_weight", |
| 71 | + "from AnimalData", |
| 72 | + "${whereClause}" |
| 73 | + }) |
| 74 | + @ResultMap("AnimalDataResult") |
| 75 | + List<AnimalData> selectByExample(WhereClauseAndParameters whereClause); |
| 76 | + |
| 77 | + @Select({ |
| 78 | + "select a.id, a.animal_name, a.brain_weight, a.body_weight", |
| 79 | + "from AnimalData a", |
| 80 | + "${whereClause}" |
| 81 | + }) |
| 82 | + @ResultMap("AnimalDataResult") |
| 83 | + List<AnimalData> selectByExampleWithAlias(WhereClauseAndParameters whereClause); |
65 | 84 | }
|
0 commit comments