|
21 | 21 | import java.util.List;
|
22 | 22 | import java.util.Optional;
|
23 | 23 |
|
24 |
| -import org.apache.ibatis.annotations.*; |
| 24 | +import org.apache.ibatis.annotations.Arg; |
| 25 | +import org.apache.ibatis.annotations.CacheNamespace; |
| 26 | +import org.apache.ibatis.annotations.SelectProvider; |
25 | 27 | import org.mybatis.dynamic.sql.BasicColumn;
|
26 | 28 | import org.mybatis.dynamic.sql.delete.DeleteDSLCompleter;
|
27 | 29 | import org.mybatis.dynamic.sql.select.SelectDSLCompleter;
|
28 | 30 | import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
29 | 31 | import org.mybatis.dynamic.sql.update.UpdateDSLCompleter;
|
30 | 32 | import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
|
31 |
| -import org.mybatis.dynamic.sql.util.mybatis3.*; |
| 33 | +import org.mybatis.dynamic.sql.util.mybatis3.CommonCountMapper; |
| 34 | +import org.mybatis.dynamic.sql.util.mybatis3.CommonDeleteMapper; |
| 35 | +import org.mybatis.dynamic.sql.util.mybatis3.CommonInsertMapper; |
| 36 | +import org.mybatis.dynamic.sql.util.mybatis3.CommonUpdateMapper; |
| 37 | +import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3Utils; |
32 | 38 |
|
33 | 39 | @CacheNamespace(implementation = ObservableCache.class)
|
34 | 40 | public interface NameTableMapper extends CommonCountMapper, CommonDeleteMapper, CommonInsertMapper<NameRecord>, CommonUpdateMapper {
|
35 | 41 | @SelectProvider(type=SqlProviderAdapter.class, method="select")
|
36 |
| - @Results(id="NameTableResult", value={ |
37 |
| - @Result(column="id", property="id", id=true), |
38 |
| - @Result(column="name", property="name") |
39 |
| - }) |
| 42 | + @Arg(column = "id", javaType = Integer.class, id = true) |
| 43 | + @Arg(column = "name", javaType = String.class) |
40 | 44 | List<NameRecord> selectMany(SelectStatementProvider selectStatement);
|
41 | 45 |
|
42 | 46 | @SelectProvider(type=SqlProviderAdapter.class, method="select")
|
43 |
| - @ResultMap("NameTableResult") |
| 47 | + @Arg(column = "id", javaType = Integer.class, id = true) |
| 48 | + @Arg(column = "name", javaType = String.class) |
44 | 49 | Optional<NameRecord> selectOne(SelectStatementProvider selectStatement);
|
45 | 50 |
|
46 | 51 | BasicColumn[] selectList = BasicColumn.columnList(id, name);
|
@@ -68,8 +73,8 @@ default int update(UpdateDSLCompleter completer) {
|
68 | 73 |
|
69 | 74 | default int updateByPrimaryKey(NameRecord row) {
|
70 | 75 | return update(c ->
|
71 |
| - c.set(name).equalTo(row::getName) |
72 |
| - .where(id, isEqualTo(row::getId)) |
| 76 | + c.set(name).equalTo(row::name) |
| 77 | + .where(id, isEqualTo(row::id)) |
73 | 78 | );
|
74 | 79 | }
|
75 | 80 |
|
|
0 commit comments