View Javadoc
1   /*
2    *    Copyright 2018-2022 the original author or authors.
3    *
4    *    Licensed under the Apache License, Version 2.0 (the "License");
5    *    you may not use this file except in compliance with the License.
6    *    You may obtain a copy of the License at
7    *
8    *       https://www.apache.org/licenses/LICENSE-2.0
9    *
10   *    Unless required by applicable law or agreed to in writing, software
11   *    distributed under the License is distributed on an "AS IS" BASIS,
12   *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *    See the License for the specific language governing permissions and
14   *    limitations under the License.
15   */
16  package org.mybatis.scripting.thymeleaf.integrationtest.mapper;
17  
18  import java.util.List;
19  
20  import org.apache.ibatis.annotations.*;
21  import org.mybatis.scripting.thymeleaf.integrationtest.domain.Name;
22  
23  public interface NameMapper {
24  
25    @Options(useGeneratedKeys = true, keyProperty = "id")
26    @Insert("sql/NameMapper/insert.sql")
27    void insert(Name name);
28  
29    @Options(useGeneratedKeys = true, keyProperty = "id")
30    @Insert("sql/NameMapper/insertByBulk.sql")
31    void insertByBulk(List<Name> names);
32  
33    @Update("sql/NameMapper/update.sql")
34    void update(Name name);
35  
36    @Delete("sql/NameMapper/delete.sql")
37    void delete(Name name);
38  
39    @Select("SELECT * FROM names")
40    List<Name> getAllNames();
41  
42    @Select("sql/NameMapper/findByIds.sql")
43    List<Name> findByIds(@Param("ids") int... ids);
44  
45    @Select("sql/NameMapper/findByFirstNames.sql")
46    List<Name> findByFirstNames(@Param("firstNames") List<String> firstNames);
47  
48    @Select("sql/NameMapper/findByFirstNames.sql")
49    Name findByFirstNamesWithNotCollectionType(@Param("firstNames") String firstNames);
50  
51    @Select("sql/NameMapper/findByIdsWithoutParamAnnotation.sql")
52    List<Name> findByIdsWithoutParamAnnotation(List<Integer> ids);
53  
54    @Select("sql/NameMapper/findById.sql")
55    List<Name> findById(@Param("id") Integer id);
56  
57    @Select("sql/NameMapper/findByIdWithoutParamAnnotation.sql")
58    List<Name> findByIdWithoutParamAnnotation(Integer id);
59  
60    @Select("sql/NameMapper/findByIdWithNestedParam.sql")
61    List<Name> findByIdWithNestedParam(@Param("p") NameParam param);
62  
63    @Select({ "SELECT * FROM names", "/*[# th:insert=\"~{sql/NameMapper/findByIdWhere.sql}\" /]*/" })
64    List<Name> findUsingScript(NameParam nameParam);
65  
66    @Select("sql/NameMapper/findById.sql")
67    List<Name> findUsingTemplateFile(NameParam nameParam);
68  
69    @Select("sql/NameMapper/findByName.sql")
70    List<Name> findByName(NameParam param);
71  
72    @Select("sql/NameMapper/findByIdsWithinParam.sql")
73    List<Name> findByIdsWithinParam(NameParam param);
74  
75  }