From cacaf8a50883cb868477fd647b42f85d1fd6d7fb Mon Sep 17 00:00:00 2001 From: isea533 Date: Sun, 11 Dec 2016 20:23:01 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E5=88=B0=E6=9C=80?= =?UTF-8?q?=E6=96=B0=E7=89=88=E6=9C=AC=E5=88=86=E9=A1=B5=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 19c7b4e..eea14d6 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ 3.3.1 3.3.6 - 4.1.4 + 4.2.1 5.1.29 4.1.2.RELEASE 1.2.4 From 95a3676cfd046c1ae99f85c8dc958440fa4103f6 Mon Sep 17 00:00:00 2001 From: isea533 Date: Fri, 6 Jan 2017 22:49:48 +0800 Subject: [PATCH 02/12] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=205.0.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 32 +++++++++++++++++++++++ pom.xml | 2 +- src/main/resources/applicationContext.xml | 4 +-- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ca8e7ae..7f96c88 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,38 @@ 项目使用的mysql数据库,根据需要可以切换为其他数据库 +集成分页插件 5.0.0 版本,注意配置变化: +```xml + + + + + classpath:mapper/*.xml + + + + + + + + + + helperDialect=mysql + reasonable=true + supportMethodsArguments=true + params=count=countSql + autoRuntimeDialect=true + + + + + + +``` +- 拦截器 `com.github.pagehelper.PageInterceptor` +- 原来的 `dialect` 变成了 `helperDialect`,这是基于 PageHelper 方式的分页 +- 具体变化看文档 + ##Spring Boot集成MyBatis的基础项目 ###https://github.com/abel533/MyBatis-Spring-Boot diff --git a/pom.xml b/pom.xml index eea14d6..018f3a2 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ 3.3.1 3.3.6 - 4.2.1 + 5.0.0 5.1.29 4.1.2.RELEASE 1.2.4 diff --git a/src/main/resources/applicationContext.xml b/src/main/resources/applicationContext.xml index fbaa2b4..d6f84c4 100644 --- a/src/main/resources/applicationContext.xml +++ b/src/main/resources/applicationContext.xml @@ -73,11 +73,11 @@ - + - dialect=mysql + helperDialect=mysql reasonable=true supportMethodsArguments=true params=count=countSql From 32f0e2a94461dc8085f164d8df905e4d57c8573d Mon Sep 17 00:00:00 2001 From: isea533 Date: Tue, 7 Feb 2017 22:07:55 +0800 Subject: [PATCH 03/12] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=205.0.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7f96c88..25827cb 100644 --- a/README.md +++ b/README.md @@ -64,4 +64,6 @@ - 作者邮箱:abel533@gmail.com -- Mybatis工具群: 211286137 (Mybatis相关工具插件等等) +- Mybatis工具群(推荐): Mybatis工具群(2) + +- Mybatis工具群(2000 人已满): Mybatis工具 From b5532913b4632acd1e048f378d4fc67cb86491c6 Mon Sep 17 00:00:00 2001 From: Santiago Castro Date: Sun, 16 Apr 2017 18:41:58 -0300 Subject: [PATCH 04/12] Fix broken Markdown headings --- README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 25827cb..04c6524 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -#SSM集成的基础项目,项目使用Maven管理 +# SSM集成的基础项目,项目使用Maven管理 -#MyBatis3.3.0 +# MyBatis3.3.0 -#Spring[MVC]4.1.2.RELEASE +# Spring[MVC]4.1.2.RELEASE 项目使用Spring4.1.2.RELEASE + SpringMVC4.1.2.RELEASE + Mybatis3.3.0 @@ -42,23 +42,23 @@ - 原来的 `dialect` 变成了 `helperDialect`,这是基于 PageHelper 方式的分页 - 具体变化看文档 -##Spring Boot集成MyBatis的基础项目 +## Spring Boot集成MyBatis的基础项目 -###https://github.com/abel533/MyBatis-Spring-Boot +### https://github.com/abel533/MyBatis-Spring-Boot -##MyBatis工具 +## MyBatis工具 -###http://www.mybatis.tk +### http://www.mybatis.tk -##推荐使用Mybatis通用Mapper3 +## 推荐使用Mybatis通用Mapper3 -###https://github.com/abel533/Mapper +### https://github.com/abel533/Mapper -##推荐使用Mybatis分页插件PageHelper +## 推荐使用Mybatis分页插件PageHelper -###https://github.com/pagehelper/Mybatis-PageHelper +### https://github.com/pagehelper/Mybatis-PageHelper -##作者信息 +## 作者信息 - 作者博客:http://blog.csdn.net/isea533 From e0fa61be502bee2d2d7f6ec8e569cd064110260c Mon Sep 17 00:00:00 2001 From: isea533 Date: Wed, 28 Jun 2017 06:52:20 +0800 Subject: [PATCH 05/12] update book & qq --- README.md | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 04c6524..a788c74 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# SSM集成的基础项目,项目使用Maven管理 +#SSM集成的基础项目,项目使用Maven管理 -# MyBatis3.3.0 +#MyBatis3.3.0 -# Spring[MVC]4.1.2.RELEASE +#Spring[MVC]4.1.2.RELEASE 项目使用Spring4.1.2.RELEASE + SpringMVC4.1.2.RELEASE + Mybatis3.3.0 @@ -42,28 +42,36 @@ - 原来的 `dialect` 变成了 `helperDialect`,这是基于 PageHelper 方式的分页 - 具体变化看文档 -## Spring Boot集成MyBatis的基础项目 +## 新书《MyBatis 从入门到精通》 -### https://github.com/abel533/MyBatis-Spring-Boot +![MyBatis 从入门到精通](https://github.com/mybatis-book/book/raw/master/book.png) -## MyBatis工具 +预售地址:[京东](https://item.jd.com/12103309.html),[当当](http://product.dangdang.com/25098208.html),[亚马逊](https://www.amazon.cn/MyBatis从入门到精通-刘增辉/dp/B072RC11DM/ref=sr_1_18?ie=UTF8&qid=1498007125&sr=8-18&keywords=mybatis) -### http://www.mybatis.tk +CSDN博客:http://blog.csdn.net/isea533/article/details/73555400 -## 推荐使用Mybatis通用Mapper3 +GitHub项目:https://github.com/mybatis-book/book -### https://github.com/abel533/Mapper +##Spring Boot集成MyBatis的基础项目 -## 推荐使用Mybatis分页插件PageHelper +###https://github.com/abel533/MyBatis-Spring-Boot -### https://github.com/pagehelper/Mybatis-PageHelper +##MyBatis工具 -## 作者信息 +###http://www.mybatis.tk + +##推荐使用Mybatis通用Mapper3 + +###https://github.com/abel533/Mapper + +##推荐使用Mybatis分页插件PageHelper + +###https://github.com/pagehelper/Mybatis-PageHelper + +##作者信息 - 作者博客:http://blog.csdn.net/isea533 - 作者邮箱:abel533@gmail.com -- Mybatis工具群(推荐): Mybatis工具群(2) - -- Mybatis工具群(2000 人已满): Mybatis工具 +- Mybatis工具群: Mybatis工具群 From 36e477e83b384325f22129b94623f2a3caed1e35 Mon Sep 17 00:00:00 2001 From: isea533 Date: Wed, 28 Jun 2017 06:57:18 +0800 Subject: [PATCH 06/12] # --- README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index a788c74..2c47c8f 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -#SSM集成的基础项目,项目使用Maven管理 +# SSM集成的基础项目,项目使用Maven管理 -#MyBatis3.3.0 +# MyBatis3.3.0 -#Spring[MVC]4.1.2.RELEASE +# Spring[MVC]4.1.2.RELEASE 项目使用Spring4.1.2.RELEASE + SpringMVC4.1.2.RELEASE + Mybatis3.3.0 @@ -52,23 +52,23 @@ CSDN博客:http://blog.csdn.net/isea533/article/details/73555400 GitHub项目:https://github.com/mybatis-book/book -##Spring Boot集成MyBatis的基础项目 +## Spring Boot集成MyBatis的基础项目 -###https://github.com/abel533/MyBatis-Spring-Boot +### https://github.com/abel533/MyBatis-Spring-Boot -##MyBatis工具 +## MyBatis工具 -###http://www.mybatis.tk +### http://www.mybatis.tk -##推荐使用Mybatis通用Mapper3 +## 推荐使用Mybatis通用Mapper3 -###https://github.com/abel533/Mapper +### https://github.com/abel533/Mapper -##推荐使用Mybatis分页插件PageHelper +## 推荐使用Mybatis分页插件PageHelper -###https://github.com/pagehelper/Mybatis-PageHelper +### https://github.com/pagehelper/Mybatis-PageHelper -##作者信息 +## 作者信息 - 作者博客:http://blog.csdn.net/isea533 From 545a8a6e99b4c04b4bda4d39f97c4e2f400cc871 Mon Sep 17 00:00:00 2001 From: isea533 Date: Mon, 30 Oct 2017 15:17:47 +0800 Subject: [PATCH 07/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/config.properties | 2 +- .../resources/generator/generatorConfig.xml | 42 ++++++++++--------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/main/resources/config.properties b/src/main/resources/config.properties index 92559c2..4ee316b 100644 --- a/src/main/resources/config.properties +++ b/src/main/resources/config.properties @@ -24,7 +24,7 @@ # \u6570\u636E\u5E93\u914D\u7F6E jdbc.driverClass = com.mysql.jdbc.Driver -jdbc.url = jdbc:mysql://192.168.16.137:3306/test +jdbc.url = jdbc:mysql://localhost:3306/test jdbc.user = root jdbc.password = diff --git a/src/main/resources/generator/generatorConfig.xml b/src/main/resources/generator/generatorConfig.xml index b69ba60..f38f9f3 100644 --- a/src/main/resources/generator/generatorConfig.xml +++ b/src/main/resources/generator/generatorConfig.xml @@ -29,30 +29,32 @@ "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> - + - - - - - - - + + + - - + + + + - + + - + - + - - -
-
+ + + + +
+
\ No newline at end of file From 23659fe7fbecf2dc62fde1f50b3ee4a6fe153a0b Mon Sep 17 00:00:00 2001 From: isea533 Date: Sun, 12 Nov 2017 13:23:01 +0800 Subject: [PATCH 08/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- pom.xml | 2 +- ...erBeanDefinitionRegistryPostProcessor.java | 40 +++++++++++++++++++ .../isea533/mybatis/filter/MapperFilter.java | 34 ++++++++++++++++ src/main/resources/applicationContext.xml | 4 ++ src/main/webapp/WEB-INF/web.xml | 9 +++++ 6 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/isea533/mybatis/filter/MapperBeanDefinitionRegistryPostProcessor.java create mode 100644 src/main/java/com/isea533/mybatis/filter/MapperFilter.java diff --git a/README.md b/README.md index 2c47c8f..d98e028 100644 --- a/README.md +++ b/README.md @@ -74,4 +74,4 @@ GitHub项目:https://github.com/mybatis-book/book - 作者邮箱:abel533@gmail.com -- Mybatis工具群: Mybatis工具群 +- 如需加群,请通过 http://mybatis.tk 首页按钮加群。 \ No newline at end of file diff --git a/pom.xml b/pom.xml index 018f3a2..c7e9339 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ 1.6 3.3.1 - 3.3.6 + 3.4.5-SNAPSHOT 5.0.0 5.1.29 4.1.2.RELEASE diff --git a/src/main/java/com/isea533/mybatis/filter/MapperBeanDefinitionRegistryPostProcessor.java b/src/main/java/com/isea533/mybatis/filter/MapperBeanDefinitionRegistryPostProcessor.java new file mode 100644 index 0000000..ab979fb --- /dev/null +++ b/src/main/java/com/isea533/mybatis/filter/MapperBeanDefinitionRegistryPostProcessor.java @@ -0,0 +1,40 @@ +package com.isea533.mybatis.filter; + +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; +import org.springframework.beans.factory.support.BeanDefinitionRegistry; +import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor; +import org.springframework.core.Ordered; +import tk.mybatis.mapper.common.Mapper; + +/** + * @author liuzh + * @since 2017/11/4. + */ +public class MapperBeanDefinitionRegistryPostProcessor implements BeanDefinitionRegistryPostProcessor, Ordered { + private BeanDefinitionRegistry registry; + + @Override + public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException { + System.out.println("postProcessBeanDefinitionRegistry"); + this.registry = registry; + } + + @Override + public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { + System.out.println("postProcessBeanFactory"); + + String[] names = beanFactory.getBeanNamesForType(Mapper.class); + for (String name : names) { + BeanDefinition beanDefinition = beanFactory.getBeanDefinition(name); + System.out.println(beanDefinition.getBeanClassName()); + } + + } + + @Override + public int getOrder() { + return HIGHEST_PRECEDENCE; + } +} diff --git a/src/main/java/com/isea533/mybatis/filter/MapperFilter.java b/src/main/java/com/isea533/mybatis/filter/MapperFilter.java new file mode 100644 index 0000000..da3e208 --- /dev/null +++ b/src/main/java/com/isea533/mybatis/filter/MapperFilter.java @@ -0,0 +1,34 @@ +package com.isea533.mybatis.filter; + +import com.isea533.mybatis.mapper.CountryMapper; +import com.isea533.mybatis.model.Country; +import org.springframework.beans.factory.annotation.Autowired; + +import javax.servlet.*; +import java.io.IOException; +import java.util.List; + +/** + * @author liuzh + * @since 2017/10/8. + */ +public class MapperFilter implements Filter { + @Autowired + private CountryMapper countryMapper; + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + System.out.println("init"); + } + + @Override + public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { + List countries = countryMapper.selectAll(); + filterChain.doFilter(servletRequest, servletResponse); + } + + @Override + public void destroy() { + System.out.println("destroy"); + } +} diff --git a/src/main/resources/applicationContext.xml b/src/main/resources/applicationContext.xml index d6f84c4..7bdaae0 100644 --- a/src/main/resources/applicationContext.xml +++ b/src/main/resources/applicationContext.xml @@ -125,4 +125,8 @@ + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index b52526b..161ba52 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -71,4 +71,13 @@ SpringEncodingFilter /* + + + mapperFilter + org.springframework.web.filter.DelegatingFilterProxy + + + mapperFilter + /* + From 4a392d32d86b260ac24d70ea6ccbcbbc99772728 Mon Sep 17 00:00:00 2001 From: isea533 Date: Sun, 12 Nov 2017 13:23:28 +0800 Subject: [PATCH 09/12] =?UTF-8?q?=E5=A6=82=E9=9C=80=E5=8A=A0=E7=BE=A4?= =?UTF-8?q?=EF=BC=8C=E8=AF=B7=E9=80=9A=E8=BF=87=20http://mybatis.tk=20?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=8C=89=E9=92=AE=E5=8A=A0=E7=BE=A4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2c47c8f..d98e028 100644 --- a/README.md +++ b/README.md @@ -74,4 +74,4 @@ GitHub项目:https://github.com/mybatis-book/book - 作者邮箱:abel533@gmail.com -- Mybatis工具群: Mybatis工具群 +- 如需加群,请通过 http://mybatis.tk 首页按钮加群。 \ No newline at end of file From cc882b2f2aff213f416641b5c12deaf35ea28cd5 Mon Sep 17 00:00:00 2001 From: isea533 Date: Sat, 24 Mar 2018 12:07:01 +0800 Subject: [PATCH 10/12] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=83=A8=E5=88=86?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E7=89=88=E6=9C=AC=EF=BC=8C=E6=9B=B4=E6=96=B0?= =?UTF-8?q?MBG=E6=8F=92=E4=BB=B6=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 14 ++----- .../isea533/mybatis/mapper/CountryMapper.java | 29 +------------- .../com/isea533/mybatis/model/Country.java | 32 ++------------- src/main/resources/applicationContext.xml | 9 ----- src/main/resources/config.properties | 6 +-- .../resources/generator/generatorConfig.xml | 10 ++--- src/main/resources/mapper/CountryMapper.xml | 40 ++++--------------- 7 files changed, 22 insertions(+), 118 deletions(-) diff --git a/pom.xml b/pom.xml index c7e9339..a3489cc 100644 --- a/pom.xml +++ b/pom.xml @@ -11,19 +11,11 @@ UTF-8 - - - ${basedir}/src/main/java - com.isea533.mybatis.mapper - com.isea533.mybatis.model - - ${basedir}/src/main/resources - mapper 1.6 - 3.3.1 - 3.4.5-SNAPSHOT + 3.4.6 + 4.0.0 5.0.0 5.1.29 4.1.2.RELEASE @@ -265,7 +257,7 @@ org.mybatis.generator mybatis-generator-maven-plugin - 1.3.2 + 1.3.6 ${basedir}/src/main/resources/generator/generatorConfig.xml true diff --git a/src/main/java/com/isea533/mybatis/mapper/CountryMapper.java b/src/main/java/com/isea533/mybatis/mapper/CountryMapper.java index 6b9b997..d8b9bbf 100644 --- a/src/main/java/com/isea533/mybatis/mapper/CountryMapper.java +++ b/src/main/java/com/isea533/mybatis/mapper/CountryMapper.java @@ -1,32 +1,7 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2014 abel533@gmail.com - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - package com.isea533.mybatis.mapper; import com.isea533.mybatis.model.Country; -import com.isea533.mybatis.util.MyMapper; - -public interface CountryMapper extends MyMapper { +import tk.mybatis.mapper.common.Mapper; +public interface CountryMapper extends Mapper { } \ No newline at end of file diff --git a/src/main/java/com/isea533/mybatis/model/Country.java b/src/main/java/com/isea533/mybatis/model/Country.java index 12835ff..8f14acd 100644 --- a/src/main/java/com/isea533/mybatis/model/Country.java +++ b/src/main/java/com/isea533/mybatis/model/Country.java @@ -1,41 +1,15 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2014 abel533@gmail.com - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - package com.isea533.mybatis.model; -import javax.persistence.Column; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; +import javax.persistence.*; +@Table(name = "country") public class Country { /** * 主键 */ @Id @Column(name = "Id") - @GeneratedValue(strategy = GenerationType.IDENTITY) + @GeneratedValue(generator = "JDBC") private Integer id; /** diff --git a/src/main/resources/applicationContext.xml b/src/main/resources/applicationContext.xml index 7bdaae0..bfe02da 100644 --- a/src/main/resources/applicationContext.xml +++ b/src/main/resources/applicationContext.xml @@ -91,15 +91,6 @@ - - - diff --git a/src/main/resources/config.properties b/src/main/resources/config.properties index 4ee316b..9914238 100644 --- a/src/main/resources/config.properties +++ b/src/main/resources/config.properties @@ -32,8 +32,4 @@ jdbc.password = jdbc.maxPoolSize=50 jdbc.minPoolSize=10 jdbc.maxStatements=100 -jdbc.testConnection=true - -# \u901A\u7528Mapper\u914D\u7F6E -mapper.plugin = tk.mybatis.mapper.generator.MapperPlugin -mapper.Mapper = tk.mybatis.mapper.common.Mapper \ No newline at end of file +jdbc.testConnection=true \ No newline at end of file diff --git a/src/main/resources/generator/generatorConfig.xml b/src/main/resources/generator/generatorConfig.xml index f38f9f3..fb2b4a9 100644 --- a/src/main/resources/generator/generatorConfig.xml +++ b/src/main/resources/generator/generatorConfig.xml @@ -46,15 +46,15 @@ password="${jdbc.password}"> - + - + - - - +
+
\ No newline at end of file diff --git a/src/main/resources/mapper/CountryMapper.xml b/src/main/resources/mapper/CountryMapper.xml index 4d718ae..73de6fa 100644 --- a/src/main/resources/mapper/CountryMapper.xml +++ b/src/main/resources/mapper/CountryMapper.xml @@ -1,37 +1,13 @@ - - - - - - + + + + - - - + + +