1 /*
2 * Copyright 2016-2025 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.dynamic.sql.util.mybatis3;
17
18 import org.apache.ibatis.annotations.InsertProvider;
19 import org.mybatis.dynamic.sql.insert.render.GeneralInsertStatementProvider;
20 import org.mybatis.dynamic.sql.insert.render.InsertSelectStatementProvider;
21 import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
22
23 /**
24 * This is a general purpose mapper for executing various non-typed insert statements (general inserts and insert
25 * selects). This mapper is appropriate for insert statements that do NOT expect generated keys.
26 */
27 public interface CommonGeneralInsertMapper {
28 /**
29 * Execute an insert statement with input fields supplied directly.
30 *
31 * @param insertStatement
32 * the insert statement
33 *
34 * @return the number of rows affected
35 */
36 @InsertProvider(type = SqlProviderAdapter.class, method = "generalInsert")
37 int generalInsert(GeneralInsertStatementProvider insertStatement);
38
39 /**
40 * Execute an insert statement with input fields supplied by a select statement.
41 *
42 * @param insertSelectStatement
43 * the insert statement
44 *
45 * @return the number of rows affected
46 */
47 @InsertProvider(type = SqlProviderAdapter.class, method = "insertSelect")
48 int insertSelect(InsertSelectStatementProvider insertSelectStatement);
49 }