Skip to content

Commit d397169

Browse files
committed
Add common mappers for MyBatis
1 parent adad0fc commit d397169

File tree

4 files changed

+112
-0
lines changed

4 files changed

+112
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2016-2020 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+
* http://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.SelectProvider;
19+
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
20+
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
21+
22+
public interface CommonCountMapper {
23+
@SelectProvider(type = SqlProviderAdapter.class, method = "select")
24+
long count(SelectStatementProvider selectStatement);
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2016-2020 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+
* http://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.DeleteProvider;
19+
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
20+
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
21+
22+
public interface CommonDeleteMapper {
23+
@DeleteProvider(type = SqlProviderAdapter.class, method = "delete")
24+
int delete(DeleteStatementProvider deleteStatement);
25+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright 2016-2020 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+
* http://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.insert.render.InsertStatementProvider;
22+
import org.mybatis.dynamic.sql.insert.render.MultiRowInsertStatementProvider;
23+
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
24+
25+
public interface CommonInsertMapper<T> {
26+
@InsertProvider(type = SqlProviderAdapter.class, method = "insert")
27+
int insert(InsertStatementProvider<T> insertStatement);
28+
29+
@InsertProvider(type = SqlProviderAdapter.class, method = "generalInsert")
30+
int generalInsert(GeneralInsertStatementProvider insertStatement);
31+
32+
@InsertProvider(type = SqlProviderAdapter.class, method = "insertSelect")
33+
int insertSelect(InsertSelectStatementProvider insertSelectStatement);
34+
35+
@InsertProvider(type = SqlProviderAdapter.class, method = "insertMultiple")
36+
int insertMultiple(MultiRowInsertStatementProvider<T> insertStatement);
37+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2016-2020 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+
* http://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.UpdateProvider;
19+
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
20+
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
21+
22+
public interface CommonUpdateMapper {
23+
@UpdateProvider(type = SqlProviderAdapter.class, method = "update")
24+
int update(UpdateStatementProvider updateStatement);
25+
}

0 commit comments

Comments
 (0)