diff --git a/docs/spring/csf5cca9fe-de98-11ee-954e-acde48001122.java b/docs/spring/csf5cca9fe-de98-11ee-954e-acde48001122.java
new file mode 100644
index 00000000..1669d2d9
--- /dev/null
+++ b/docs/spring/csf5cca9fe-de98-11ee-954e-acde48001122.java
@@ -0,0 +1,51 @@
+/**
+ * Copyright 2009-2019 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ibatis.type;
+
+import java.sql.CallableStatement;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.time.OffsetDateTime;
+
+/**
+ * @since 3.4.5
+ * @author Tomas Rohovsky
+ */
+public class OffsetDateTimeTypeHandler extends BaseTypeHandler {
+
+ @Override
+ public void setNonNullParameter(PreparedStatement ps, int i, OffsetDateTime parameter, JdbcType jdbcType)
+ throws SQLException {
+ ps.setObject(i, parameter);
+ }
+
+ @Override
+ public OffsetDateTime getNullableResult(ResultSet rs, String columnName) throws SQLException {
+ return rs.getObject(columnName, OffsetDateTime.class);
+ }
+
+ @Override
+ public OffsetDateTime getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
+ return rs.getObject(columnIndex, OffsetDateTime.class);
+ }
+
+ @Override
+ public OffsetDateTime getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
+ return cs.getObject(columnIndex, OffsetDateTime.class);
+ }
+
+}
diff --git a/docs/spring/csf603f738-de98-11ee-954e-acde48001122.java b/docs/spring/csf603f738-de98-11ee-954e-acde48001122.java
new file mode 100644
index 00000000..006fcf76
--- /dev/null
+++ b/docs/spring/csf603f738-de98-11ee-954e-acde48001122.java
@@ -0,0 +1,27 @@
+/**
+ * Copyright 2009-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ibatis.submitted.duplicate_statements;
+
+import org.apache.ibatis.session.RowBounds;
+
+import java.util.List;
+
+public interface Mapper {
+
+ List getAllUsers();
+
+ List getAllUsers(RowBounds rowBounds);
+}
diff --git a/docs/spring/csf63d76a2-de98-11ee-954e-acde48001122.java b/docs/spring/csf63d76a2-de98-11ee-954e-acde48001122.java
new file mode 100644
index 00000000..3729be55
--- /dev/null
+++ b/docs/spring/csf63d76a2-de98-11ee-954e-acde48001122.java
@@ -0,0 +1,56 @@
+/**
+ * Copyright 2009-2015 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ibatis.submitted.typehandler;
+
+public class User {
+
+ private Integer id;
+ private String name;
+ private String city;
+ private String state;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+}
diff --git a/docs/spring/csf67af4b4-de98-11ee-954e-acde48001122.java b/docs/spring/csf67af4b4-de98-11ee-954e-acde48001122.java
new file mode 100644
index 00000000..bfad400c
--- /dev/null
+++ b/docs/spring/csf67af4b4-de98-11ee-954e-acde48001122.java
@@ -0,0 +1,63 @@
+/**
+ * Copyright 2009-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ibatis.submitted.keygen;
+
+/**
+ * @author liuzh
+ */
+public class Country {
+ private Integer id;
+ private String countryname;
+ private String countrycode;
+
+ public Country() {
+ }
+
+ public Country(String countryname, String countrycode) {
+ this.countryname = countryname;
+ this.countrycode = countrycode;
+ }
+
+ public Country(Integer id, String countryname, String countrycode) {
+ this.id = id;
+ this.countryname = countryname;
+ this.countrycode = countrycode;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getCountryname() {
+ return countryname;
+ }
+
+ public void setCountryname(String countryname) {
+ this.countryname = countryname;
+ }
+
+ public String getCountrycode() {
+ return countrycode;
+ }
+
+ public void setCountrycode(String countrycode) {
+ this.countrycode = countrycode;
+ }
+}
diff --git a/docs/spring/csf6b173d6-de98-11ee-954e-acde48001122.java b/docs/spring/csf6b173d6-de98-11ee-954e-acde48001122.java
new file mode 100644
index 00000000..1715f564
--- /dev/null
+++ b/docs/spring/csf6b173d6-de98-11ee-954e-acde48001122.java
@@ -0,0 +1,30 @@
+package com.huifer.aop.advisor;
+
+import org.springframework.aop.ClassFilter;
+
+/**
+ * 描述:
+ * 类过滤器
+ *
+ * @author huifer
+ * @date 2019-03-03
+ */
+public class MyClassFilter implements ClassFilter {
+ /***
+ * 判断当前实现类是否是我们的织入所相关的类
+ * 本次案例中 男性上厕所不需要带纸巾,女性上厕所需要带纸巾,
+ * 那么BaseAopPointCut接口应该要对女性进行判断,完成此步骤后还需要一个方法匹配器 ,
+ * 再次我们只要对上厕所匹配 吃饭不需要匹配
+ *
+ * @param aClass 当前被拦截的类
+ * @return boolean
+ */
+ @Override
+ public boolean matches(Class> aClass) {
+ if (aClass == WoMan.class) {
+
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/docs/spring/csf6e3653a-de98-11ee-954e-acde48001122.java b/docs/spring/csf6e3653a-de98-11ee-954e-acde48001122.java
new file mode 100644
index 00000000..412ce6c5
--- /dev/null
+++ b/docs/spring/csf6e3653a-de98-11ee-954e-acde48001122.java
@@ -0,0 +1,24 @@
+package com.huifer.hystrix;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.netflix.hystrix.EnableHystrix;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+
+/**
+ *
Title : HystrixApp
+ * Description :
+ *
+ * @author huifer
+ * @date 2019-05-30
+ */
+@SpringBootApplication
+@EnableHystrix
+@EnableAspectJAutoProxy(proxyTargetClass = true)
+public class HystrixApp {
+
+ public static void main(String[] args) {
+ SpringApplication.run(HystrixApp.class, args);
+ }
+
+}
diff --git a/docs/spring/csf716ba66-de98-11ee-954e-acde48001122.java b/docs/spring/csf716ba66-de98-11ee-954e-acde48001122.java
new file mode 100644
index 00000000..af9cbed3
--- /dev/null
+++ b/docs/spring/csf716ba66-de98-11ee-954e-acde48001122.java
@@ -0,0 +1,344 @@
+/**
+ * Copyright 2009-2019 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ibatis.submitted.selectkey;
+
+import org.apache.ibatis.BaseDataTest;
+import org.apache.ibatis.exceptions.PersistenceException;
+import org.apache.ibatis.io.Resources;
+import org.apache.ibatis.session.SqlSession;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.apache.ibatis.session.SqlSessionFactoryBuilder;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
+import java.io.Reader;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+class SelectKeyTest {
+
+ protected static SqlSessionFactory sqlSessionFactory;
+
+ @BeforeEach
+ void setUp() throws Exception {
+ try (Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/selectkey/MapperConfig.xml")) {
+ sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
+ sqlSessionFactory.getConfiguration().addMapper(AnnotatedMapper.class);
+ }
+
+ BaseDataTest.runScript(sqlSessionFactory.getConfiguration().getEnvironment().getDataSource(),
+ "org/apache/ibatis/submitted/selectkey/CreateDB.sql");
+ }
+
+ @Test
+ void testSelectKey() throws Exception {
+ // this test checks to make sure that we can have select keys with the same
+ // insert id in different namespaces
+ String resource = "org/apache/ibatis/submitted/selectkey/MapperConfig.xml";
+ Reader reader = Resources.getResourceAsReader(resource);
+ SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
+ SqlSessionFactory sqlMapper = builder.build(reader);
+ assertNotNull(sqlMapper);
+ }
+
+ @Test
+ void testInsertTable1() {
+ try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
+ Map parms = new HashMap<>();
+ parms.put("name", "Fred");
+ int rows = sqlSession.insert("org.apache.ibatis.submitted.selectkey.Table1.insert", parms);
+ assertEquals(1, rows);
+ assertEquals(11, parms.get("id"));
+ }
+ }
+
+ @Test
+ void testInsertTable2() {
+ try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
+ Map parms = new HashMap<>();
+ parms.put("name", "Fred");
+ int rows = sqlSession.insert("org.apache.ibatis.submitted.selectkey.Table2.insert", parms);
+ assertEquals(1, rows);
+ assertEquals(22, parms.get("id"));
+ }
+ }
+
+ @Test
+ void testSeleckKeyReturnsNoData() {
+ try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
+ Map parms = new HashMap<>();
+ parms.put("name", "Fred");
+ Assertions.assertThrows(PersistenceException.class,
+ () -> sqlSession.insert("org.apache.ibatis.submitted.selectkey.Table2.insertNoValuesInSelectKey", parms));
+ }
+ }
+
+ @Test
+ void testSeleckKeyReturnsTooManyData() {
+ try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
+ Map parms = new HashMap<>();
+ parms.put("name", "Fred");
+ sqlSession.insert("org.apache.ibatis.submitted.selectkey.Table2.insertTooManyValuesInSelectKey", parms);
+ Assertions.assertThrows(PersistenceException.class,
+ () -> sqlSession.insert("org.apache.ibatis.submitted.selectkey.Table2.insertTooManyValuesInSelectKey", parms));
+ }
+ }
+
+ @Test
+ void testAnnotatedInsertTable2() {
+ try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
+ Name name = new Name();
+ name.setName("barney");
+ AnnotatedMapper mapper = sqlSession.getMapper(AnnotatedMapper.class);
+ int rows = mapper.insertTable2(name);
+ assertEquals(1, rows);
+ assertEquals(22, name.getNameId());
+ }
+ }
+
+ @Test
+ void testAnnotatedInsertTable2WithGeneratedKey() {
+ try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
+ Name name = new Name();
+ name.setName("barney");
+ AnnotatedMapper mapper = sqlSession.getMapper(AnnotatedMapper.class);
+ int rows = mapper.insertTable2WithGeneratedKey(name);
+ assertEquals(1, rows);
+ assertEquals(22, name.getNameId());
+ assertEquals("barney_fred", name.getGeneratedName());
+ }
+ }
+
+ @Test
+ @Disabled("HSQLDB is not returning the generated column after the update")
+ void testAnnotatedUpdateTable2WithGeneratedKey() {
+ try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
+ Name name = new Name();
+ name.setName("barney");
+ AnnotatedMapper mapper = sqlSession.getMapper(AnnotatedMapper.class);
+ int rows = mapper.insertTable2WithGeneratedKey(name);
+ assertEquals(1, rows);
+ assertEquals(22, name.getNameId());
+ assertEquals("barney_fred", name.getGeneratedName());
+
+ name.setName("Wilma");
+ rows = mapper.updateTable2WithGeneratedKey(name);
+ assertEquals(1, rows);
+ assertEquals(22, name.getNameId());
+ assertEquals("Wilma_fred", name.getGeneratedName());
+ }
+ }
+
+ @Test
+ @Disabled("HSQLDB is not returning the generated column after the update")
+ void testAnnotatedUpdateTable2WithGeneratedKeyXml() {
+ try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
+ Name name = new Name();
+ name.setName("barney");
+ AnnotatedMapper mapper = sqlSession.getMapper(AnnotatedMapper.class);
+ int rows = mapper.insertTable2WithGeneratedKeyXml(name);
+ assertEquals(1, rows);
+ assertEquals(22, name.getNameId());
+ assertEquals("barney_fred", name.getGeneratedName());
+
+ name.setName("Wilma");
+ rows = mapper.updateTable2WithGeneratedKeyXml(name);
+ assertEquals(1, rows);
+ assertEquals(22, name.getNameId());
+ assertEquals("Wilma_fred", name.getGeneratedName());
+ }
+ }
+
+ @Test
+ void testAnnotatedInsertTable2WithGeneratedKeyXml() {
+ try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
+ Name name = new Name();
+ name.setName("barney");
+ AnnotatedMapper mapper = sqlSession.getMapper(AnnotatedMapper.class);
+ int rows = mapper.insertTable2WithGeneratedKeyXml(name);
+ assertEquals(1, rows);
+ assertEquals(22, name.getNameId());
+ assertEquals("barney_fred", name.getGeneratedName());
+ }
+ }
+
+ @Test
+ void testAnnotatedInsertTable2WithSelectKeyWithKeyMap() {
+ try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
+ Name name = new Name();
+ name.setName("barney");
+ AnnotatedMapper mapper = sqlSession.getMapper(AnnotatedMapper.class);
+ int rows = mapper.insertTable2WithSelectKeyWithKeyMap(name);
+ assertEquals(1, rows);
+ assertEquals(22, name.getNameId());
+ assertEquals("barney_fred", name.getGeneratedName());
+ }
+ }
+
+ @Test
+ void testAnnotatedUpdateTable2WithSelectKeyWithKeyMap() {
+ try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
+ Name name = new Name();
+ name.setName("barney");
+ AnnotatedMapper mapper = sqlSession.getMapper(AnnotatedMapper.class);
+ int rows = mapper.insertTable2WithSelectKeyWithKeyMap(name);
+ assertEquals(1, rows);
+ assertEquals(22, name.getNameId());
+ assertEquals("barney_fred", name.getGeneratedName());
+
+ name.setName("Wilma");
+ rows = mapper.updateTable2WithSelectKeyWithKeyMap(name);
+ assertEquals(1, rows);
+ assertEquals(22, name.getNameId());
+ assertEquals("Wilma_fred", name.getGeneratedName());
+ }
+ }
+
+ @Test
+ void testAnnotatedInsertTable2WithSelectKeyWithKeyMapXml() {
+ try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
+ Name name = new Name();
+ name.setName("barney");
+ AnnotatedMapper mapper = sqlSession.getMapper(AnnotatedMapper.class);
+ int rows = mapper.insertTable2WithSelectKeyWithKeyMapXml(name);
+ assertEquals(1, rows);
+ assertEquals(22, name.getNameId());
+ assertEquals("barney_fred", name.getGeneratedName());
+ }
+ }
+
+ @Test
+ void testAnnotatedUpdateTable2WithSelectKeyWithKeyMapXml() {
+ try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
+ Name name = new Name();
+ name.setName("barney");
+ AnnotatedMapper mapper = sqlSession.getMapper(AnnotatedMapper.class);
+ int rows = mapper.insertTable2WithSelectKeyWithKeyMapXml(name);
+ assertEquals(1, rows);
+ assertEquals(22, name.getNameId());
+ assertEquals("barney_fred", name.getGeneratedName());
+
+ name.setName("Wilma");
+ rows = mapper.updateTable2WithSelectKeyWithKeyMapXml(name);
+ assertEquals(1, rows);
+ assertEquals(22, name.getNameId());
+ assertEquals("Wilma_fred", name.getGeneratedName());
+ }
+ }
+
+ @Test
+ void testAnnotatedInsertTable2WithSelectKeyWithKeyObject() {
+ try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
+ Name name = new Name();
+ name.setName("barney");
+ AnnotatedMapper mapper = sqlSession.getMapper(AnnotatedMapper.class);
+ int rows = mapper.insertTable2WithSelectKeyWithKeyObject(name);
+ assertEquals(1, rows);
+ assertEquals(22, name.getNameId());
+ assertEquals("barney_fred", name.getGeneratedName());
+ }
+ }
+
+ @Test
+ void testAnnotatedUpdateTable2WithSelectKeyWithKeyObject() {
+ try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
+ Name name = new Name();
+ name.setName("barney");
+ AnnotatedMapper mapper = sqlSession.getMapper(AnnotatedMapper.class);
+ int rows = mapper.insertTable2WithSelectKeyWithKeyObject(name);
+ assertEquals(1, rows);
+ assertEquals(22, name.getNameId());
+ assertEquals("barney_fred", name.getGeneratedName());
+
+ name.setName("Wilma");
+ rows = mapper.updateTable2WithSelectKeyWithKeyObject(name);
+ assertEquals(1, rows);
+ assertEquals(22, name.getNameId());
+ assertEquals("Wilma_fred", name.getGeneratedName());
+ }
+ }
+
+ @Test
+ void testAnnotatedUpdateTable2WithSelectKeyWithKeyObjectXml() {
+ try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
+ Name name = new Name();
+ name.setName("barney");
+ AnnotatedMapper mapper = sqlSession.getMapper(AnnotatedMapper.class);
+ int rows = mapper.insertTable2WithSelectKeyWithKeyObjectXml(name);
+ assertEquals(1, rows);
+ assertEquals(22, name.getNameId());
+ assertEquals("barney_fred", name.getGeneratedName());
+
+ name.setName("Wilma");
+ rows = mapper.updateTable2WithSelectKeyWithKeyObjectXml(name);
+ assertEquals(1, rows);
+ assertEquals(22, name.getNameId());
+ assertEquals("Wilma_fred", name.getGeneratedName());
+ }
+ }
+
+ @Test
+ void testAnnotatedInsertTable2WithSelectKeyWithKeyObjectXml() {
+ try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
+ Name name = new Name();
+ name.setName("barney");
+ AnnotatedMapper mapper = sqlSession.getMapper(AnnotatedMapper.class);
+ int rows = mapper.insertTable2WithSelectKeyWithKeyObjectXml(name);
+ assertEquals(1, rows);
+ assertEquals(22, name.getNameId());
+ assertEquals("barney_fred", name.getGeneratedName());
+ }
+ }
+
+ @Test
+ void testAnnotatedInsertTable3() {
+ try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
+ Name name = new Name();
+ name.setName("barney");
+ AnnotatedMapper mapper = sqlSession.getMapper(AnnotatedMapper.class);
+ int rows = mapper.insertTable3(name);
+ assertEquals(1, rows);
+ assertEquals(33, name.getNameId());
+ }
+ }
+
+ @Test
+ void testAnnotatedInsertTable3_2() {
+ try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
+ Name name = new Name();
+ name.setName("barney");
+ AnnotatedMapper mapper = sqlSession.getMapper(AnnotatedMapper.class);
+ int rows = mapper.insertTable3_2(name);
+ assertEquals(1, rows);
+ assertEquals(33, name.getNameId());
+ }
+ }
+
+ @Test
+ void testSeleckKeyWithWrongKeyProperty() {
+ try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
+ Name name = new Name();
+ name.setName("Kyoto");
+ Assertions.assertThrows(PersistenceException.class,
+ () -> sqlSession.insert("org.apache.ibatis.submitted.selectkey.Table2.insertWrongKeyProperty", name));
+ }
+ }
+}