diff --git a/README.md b/README.md
index 98606cb..1ace5c5 100644
--- a/README.md
+++ b/README.md
@@ -1,45 +1,11 @@
-#SSM集成的基础项目,项目使用Maven管理
+# http://mybatis.tk
-#MyBatis3.2.8
+# SSM集成的基础项目,项目使用Maven管理
-#Spring4.1.2.RELEASE
+# MyBatis3.2.8
-项目使用Spring4.1.2.RELEASE+SpringMVC4.1.2.RELEASE+Mybatis3.2.8
-
-项目集成了Mybatis分页插件和通用Mapper插件
-
-项目使用的hsqldb内存数据库,根据需要可以切换为其他支持的数据库
-
-##推荐使用Mybatis通用Mapper3
-
-项目地址:https://github.com/abel533/Mapper
-
-##推荐使用Mybatis分页插件
-
-Mybatis分页插件oschub的项目地址:http://git.oschina.net/free/Mybatis_PageHelper
-
-Mybatis分页插件github的项目地址:https://github.com/pagehelper/Mybatis-PageHelper
+# Spring4.1.2.RELEASE
-分页插件文档地址:http://git.oschina.net/free/Mybatis_PageHelper/wikis/home
-
-##其他相关信息
-
-Mybatis项目:https://github.com/mybatis/mybatis-3
-
-Mybatis文档:http://mybatis.github.io/mybatis-3/zh/index.html
-
-Mybatis专栏:
- Mybatis示例:http://blog.csdn.net/column/details/mybatis-sample.html
- Mybatis问题集:http://blog.csdn.net/column/details/mybatisqa.html
-
-##作者信息
-
-作者博客:
- http://my.oschina.net/flags/blog
- http://blog.csdn.net/isea533
-
-作者QQ: 120807756
-
-作者邮箱: abel533@gmail.com
+项目使用Spring4.1.2.RELEASE+SpringMVC4.1.2.RELEASE+Mybatis3.2.8
-Mybatis工具群: 211286137 (Mybatis相关工具插件等等)
+该项目中不包含MyBatis相关的插件
diff --git a/pom.xml b/pom.xml
index 1b60280..6d4aa5a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -19,11 +19,6 @@
${basedir}/src/main/resourcesmapper
-
- 1.6
-
- 3.1.3
- 4.0.05.1.294.1.2.RELEASE
@@ -181,18 +176,6 @@
compiletrue
-
-
- com.github.pagehelper
- pagehelper
- ${pagehelper.version}
-
-
-
- tk.mybatis
- mapper
- ${mapper.version}
-
@@ -253,13 +236,6 @@
-
- maven-compiler-plugin
-
- ${jdk.version}
- ${jdk.version}
-
- org.mybatis.generatormybatis-generator-maven-plugin
@@ -275,11 +251,6 @@
mysql-connector-java${mysql.version}
-
- tk.mybatis
- mapper
- ${mapper.version}
-
diff --git a/src/main/java/com/isea533/mybatis/controller/demo/DemoController.java b/src/main/java/com/isea533/mybatis/controller/demo/DemoController.java
index 8521330..d4d7b52 100644
--- a/src/main/java/com/isea533/mybatis/controller/demo/DemoController.java
+++ b/src/main/java/com/isea533/mybatis/controller/demo/DemoController.java
@@ -49,12 +49,8 @@ public String index() {
}
@ResponseBody
- @RequestMapping("test3")
- public List requestTest7(
- @RequestParam(value = "pageNum", required = false, defaultValue = "1") int pageNum,
- @RequestParam(value = "pageSize", required = false, defaultValue = "10") int pageSize
- ) {
- demoService.test();
- return demoService.selectPage(pageNum, pageSize);
+ @RequestMapping("test")
+ public List selectAll() {
+ return demoService.selectAll();
}
}
diff --git a/src/main/java/com/isea533/mybatis/mapper/CountryMapper.java b/src/main/java/com/isea533/mybatis/mapper/CountryMapper.java
index 09c4e31..a254a6b 100644
--- a/src/main/java/com/isea533/mybatis/mapper/CountryMapper.java
+++ b/src/main/java/com/isea533/mybatis/mapper/CountryMapper.java
@@ -1,31 +1,46 @@
-/*
- * 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 tk.mybatis.mapper.common.Mapper;
import com.isea533.mybatis.model.Country;
+import java.util.List;
+
+public interface CountryMapper {
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table country
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
+ */
+ int deleteByPrimaryKey(Integer id);
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table country
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
+ */
+ int insert(Country record);
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table country
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
+ */
+ Country selectByPrimaryKey(Integer id);
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table country
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
+ */
+ List selectAll();
-public interface CountryMapper extends Mapper {
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table country
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
+ */
+ int updateByPrimaryKey(Country record);
}
\ No newline at end of file
diff --git a/src/main/java/com/isea533/mybatis/mapper/UserInfoMapper.java b/src/main/java/com/isea533/mybatis/mapper/UserInfoMapper.java
index 6a3591f..44ac322 100644
--- a/src/main/java/com/isea533/mybatis/mapper/UserInfoMapper.java
+++ b/src/main/java/com/isea533/mybatis/mapper/UserInfoMapper.java
@@ -1,31 +1,46 @@
-/*
- * 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 tk.mybatis.mapper.common.Mapper;
import com.isea533.mybatis.model.UserInfo;
+import java.util.List;
+
+public interface UserInfoMapper {
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table user_info
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
+ */
+ int deleteByPrimaryKey(Integer id);
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table user_info
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
+ */
+ int insert(UserInfo record);
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table user_info
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
+ */
+ UserInfo selectByPrimaryKey(Integer id);
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table user_info
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
+ */
+ List selectAll();
-public interface UserInfoMapper extends Mapper {
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table user_info
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
+ */
+ int updateByPrimaryKey(UserInfo record);
}
\ No newline at end of file
diff --git a/src/main/java/com/isea533/mybatis/mapper/UserLoginInfoMapper.java b/src/main/java/com/isea533/mybatis/mapper/UserLoginInfoMapper.java
index acf114d..a57b0b1 100644
--- a/src/main/java/com/isea533/mybatis/mapper/UserLoginInfoMapper.java
+++ b/src/main/java/com/isea533/mybatis/mapper/UserLoginInfoMapper.java
@@ -1,31 +1,47 @@
-/*
- * 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 tk.mybatis.mapper.common.Mapper;
import com.isea533.mybatis.model.UserLoginInfo;
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+
+public interface UserLoginInfoMapper {
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table user login info
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
+ */
+ int deleteByPrimaryKey(@Param("id") Integer id, @Param("username") String username);
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table user login info
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
+ */
+ int insert(UserLoginInfo record);
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table user login info
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
+ */
+ UserLoginInfo selectByPrimaryKey(@Param("id") Integer id, @Param("username") String username);
+
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table user login info
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
+ */
+ List selectAll();
-public interface UserLoginInfoMapper extends Mapper {
+ /**
+ * This method was generated by MyBatis Generator.
+ * This method corresponds to the database table user login info
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
+ */
+ int updateByPrimaryKey(UserLoginInfo record);
}
\ 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..f21b6fd 100644
--- a/src/main/java/com/isea533/mybatis/model/Country.java
+++ b/src/main/java/com/isea533/mybatis/model/Country.java
@@ -1,102 +1,97 @@
-/*
- * 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;
-
public class Country {
/**
- * 主键
+ * This field was generated by MyBatis Generator.
+ * This field corresponds to the database column country.Id
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
- @Id
- @Column(name = "Id")
- @GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
- * 名称
+ * This field was generated by MyBatis Generator.
+ * This field corresponds to the database column country.countryname
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
private String countryname;
/**
- * 代码
+ * This field was generated by MyBatis Generator.
+ * This field corresponds to the database column country.countrycode
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
private String countrycode;
/**
- * 获取主键
+ * This method was generated by MyBatis Generator.
+ * This method returns the value of the database column country.Id
+ *
+ * @return the value of country.Id
*
- * @return Id - 主键
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public Integer getId() {
return id;
}
/**
- * 设置主键
+ * This method was generated by MyBatis Generator.
+ * This method sets the value of the database column country.Id
*
- * @param id 主键
+ * @param id the value for country.Id
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public void setId(Integer id) {
this.id = id;
}
/**
- * 获取名称
+ * This method was generated by MyBatis Generator.
+ * This method returns the value of the database column country.countryname
+ *
+ * @return the value of country.countryname
*
- * @return countryname - 名称
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public String getCountryname() {
return countryname;
}
/**
- * 设置名称
+ * This method was generated by MyBatis Generator.
+ * This method sets the value of the database column country.countryname
+ *
+ * @param countryname the value for country.countryname
*
- * @param countryname 名称
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public void setCountryname(String countryname) {
this.countryname = countryname;
}
/**
- * 获取代码
+ * This method was generated by MyBatis Generator.
+ * This method returns the value of the database column country.countrycode
*
- * @return countrycode - 代码
+ * @return the value of country.countrycode
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public String getCountrycode() {
return countrycode;
}
/**
- * 设置代码
+ * This method was generated by MyBatis Generator.
+ * This method sets the value of the database column country.countrycode
+ *
+ * @param countrycode the value for country.countrycode
*
- * @param countrycode 代码
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public void setCountrycode(String countrycode) {
this.countrycode = countrycode;
diff --git a/src/main/java/com/isea533/mybatis/model/UserInfo.java b/src/main/java/com/isea533/mybatis/model/UserInfo.java
index ceb4aa7..7c2500f 100644
--- a/src/main/java/com/isea533/mybatis/model/UserInfo.java
+++ b/src/main/java/com/isea533/mybatis/model/UserInfo.java
@@ -1,224 +1,289 @@
-/*
- * 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.*;
-
-@Table(name = "user_info")
public class UserInfo {
- @Id
- @Column(name = "Id")
- @GeneratedValue(strategy = GenerationType.IDENTITY)
+ /**
+ * This field was generated by MyBatis Generator.
+ * This field corresponds to the database column user_info.Id
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
+ */
private Integer id;
/**
- * 用户名
+ * This field was generated by MyBatis Generator.
+ * This field corresponds to the database column user_info.username
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
private String username;
/**
- * 密码
+ * This field was generated by MyBatis Generator.
+ * This field corresponds to the database column user_info.password
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
private String password;
/**
- * 用户类型
+ * This field was generated by MyBatis Generator.
+ * This field corresponds to the database column user_info.usertype
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
private String usertype;
/**
- * 是否可用
+ * This field was generated by MyBatis Generator.
+ * This field corresponds to the database column user_info.enabled
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
private Integer enabled;
/**
- * 真实姓名
+ * This field was generated by MyBatis Generator.
+ * This field corresponds to the database column user_info.realname
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
private String realname;
/**
- * QQ
+ * This field was generated by MyBatis Generator.
+ * This field corresponds to the database column user_info.qq
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
private String qq;
+ /**
+ * This field was generated by MyBatis Generator.
+ * This field corresponds to the database column user_info.email
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
+ */
private String email;
/**
- * 联系电话
+ * This field was generated by MyBatis Generator.
+ * This field corresponds to the database column user_info.tel
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
private String tel;
/**
- * @return Id
+ * This method was generated by MyBatis Generator.
+ * This method returns the value of the database column user_info.Id
+ *
+ * @return the value of user_info.Id
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public Integer getId() {
return id;
}
/**
- * @param id
+ * This method was generated by MyBatis Generator.
+ * This method sets the value of the database column user_info.Id
+ *
+ * @param id the value for user_info.Id
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public void setId(Integer id) {
this.id = id;
}
/**
- * 获取用户名
+ * This method was generated by MyBatis Generator.
+ * This method returns the value of the database column user_info.username
*
- * @return username - 用户名
+ * @return the value of user_info.username
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public String getUsername() {
return username;
}
/**
- * 设置用户名
+ * This method was generated by MyBatis Generator.
+ * This method sets the value of the database column user_info.username
+ *
+ * @param username the value for user_info.username
*
- * @param username 用户名
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public void setUsername(String username) {
this.username = username;
}
/**
- * 获取密码
+ * This method was generated by MyBatis Generator.
+ * This method returns the value of the database column user_info.password
+ *
+ * @return the value of user_info.password
*
- * @return password - 密码
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public String getPassword() {
return password;
}
/**
- * 设置密码
+ * This method was generated by MyBatis Generator.
+ * This method sets the value of the database column user_info.password
*
- * @param password 密码
+ * @param password the value for user_info.password
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public void setPassword(String password) {
this.password = password;
}
/**
- * 获取用户类型
+ * This method was generated by MyBatis Generator.
+ * This method returns the value of the database column user_info.usertype
+ *
+ * @return the value of user_info.usertype
*
- * @return usertype - 用户类型
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public String getUsertype() {
return usertype;
}
/**
- * 设置用户类型
+ * This method was generated by MyBatis Generator.
+ * This method sets the value of the database column user_info.usertype
*
- * @param usertype 用户类型
+ * @param usertype the value for user_info.usertype
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public void setUsertype(String usertype) {
this.usertype = usertype;
}
/**
- * 获取是否可用
+ * This method was generated by MyBatis Generator.
+ * This method returns the value of the database column user_info.enabled
+ *
+ * @return the value of user_info.enabled
*
- * @return enabled - 是否可用
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public Integer getEnabled() {
return enabled;
}
/**
- * 设置是否可用
+ * This method was generated by MyBatis Generator.
+ * This method sets the value of the database column user_info.enabled
*
- * @param enabled 是否可用
+ * @param enabled the value for user_info.enabled
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public void setEnabled(Integer enabled) {
this.enabled = enabled;
}
/**
- * 获取真实姓名
+ * This method was generated by MyBatis Generator.
+ * This method returns the value of the database column user_info.realname
+ *
+ * @return the value of user_info.realname
*
- * @return realname - 真实姓名
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public String getRealname() {
return realname;
}
/**
- * 设置真实姓名
+ * This method was generated by MyBatis Generator.
+ * This method sets the value of the database column user_info.realname
*
- * @param realname 真实姓名
+ * @param realname the value for user_info.realname
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public void setRealname(String realname) {
this.realname = realname;
}
/**
- * 获取QQ
+ * This method was generated by MyBatis Generator.
+ * This method returns the value of the database column user_info.qq
+ *
+ * @return the value of user_info.qq
*
- * @return qq - QQ
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public String getQq() {
return qq;
}
/**
- * 设置QQ
+ * This method was generated by MyBatis Generator.
+ * This method sets the value of the database column user_info.qq
+ *
+ * @param qq the value for user_info.qq
*
- * @param qq QQ
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public void setQq(String qq) {
this.qq = qq;
}
/**
- * @return email
+ * This method was generated by MyBatis Generator.
+ * This method returns the value of the database column user_info.email
+ *
+ * @return the value of user_info.email
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public String getEmail() {
return email;
}
/**
- * @param email
+ * This method was generated by MyBatis Generator.
+ * This method sets the value of the database column user_info.email
+ *
+ * @param email the value for user_info.email
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public void setEmail(String email) {
this.email = email;
}
/**
- * 获取联系电话
+ * This method was generated by MyBatis Generator.
+ * This method returns the value of the database column user_info.tel
*
- * @return tel - 联系电话
+ * @return the value of user_info.tel
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public String getTel() {
return tel;
}
/**
- * 设置联系电话
+ * This method was generated by MyBatis Generator.
+ * This method sets the value of the database column user_info.tel
+ *
+ * @param tel the value for user_info.tel
*
- * @param tel 联系电话
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public void setTel(String tel) {
this.tel = tel;
diff --git a/src/main/java/com/isea533/mybatis/model/UserLoginInfo.java b/src/main/java/com/isea533/mybatis/model/UserLoginInfo.java
index 8fa481f..9d3aa41 100644
--- a/src/main/java/com/isea533/mybatis/model/UserLoginInfo.java
+++ b/src/main/java/com/isea533/mybatis/model/UserLoginInfo.java
@@ -1,118 +1,131 @@
-/*
- * 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.*;
import java.util.Date;
-@Table(name = "`user login info`")
public class UserLoginInfo {
- @Id
- @Column(name = "Id")
- @GeneratedValue(strategy = GenerationType.IDENTITY)
+ /**
+ * This field was generated by MyBatis Generator.
+ * This field corresponds to the database column user login info.Id
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
+ */
private Integer id;
/**
- * 登录名
+ * This field was generated by MyBatis Generator.
+ * This field corresponds to the database column user login info.username
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
- @Id
private String username;
/**
- * 登录时间
+ * This field was generated by MyBatis Generator.
+ * This field corresponds to the database column user login info.logindate
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
private Date logindate;
/**
- * 登录IP
+ * This field was generated by MyBatis Generator.
+ * This field corresponds to the database column user login info.loginip
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
private String loginip;
/**
- * @return Id
+ * This method was generated by MyBatis Generator.
+ * This method returns the value of the database column user login info.Id
+ *
+ * @return the value of user login info.Id
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public Integer getId() {
return id;
}
/**
- * @param id
+ * This method was generated by MyBatis Generator.
+ * This method sets the value of the database column user login info.Id
+ *
+ * @param id the value for user login info.Id
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public void setId(Integer id) {
this.id = id;
}
/**
- * 获取登录名
+ * This method was generated by MyBatis Generator.
+ * This method returns the value of the database column user login info.username
*
- * @return username - 登录名
+ * @return the value of user login info.username
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public String getUsername() {
return username;
}
/**
- * 设置登录名
+ * This method was generated by MyBatis Generator.
+ * This method sets the value of the database column user login info.username
+ *
+ * @param username the value for user login info.username
*
- * @param username 登录名
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public void setUsername(String username) {
this.username = username;
}
/**
- * 获取登录时间
+ * This method was generated by MyBatis Generator.
+ * This method returns the value of the database column user login info.logindate
*
- * @return logindate - 登录时间
+ * @return the value of user login info.logindate
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public Date getLogindate() {
return logindate;
}
/**
- * 设置登录时间
+ * This method was generated by MyBatis Generator.
+ * This method sets the value of the database column user login info.logindate
+ *
+ * @param logindate the value for user login info.logindate
*
- * @param logindate 登录时间
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public void setLogindate(Date logindate) {
this.logindate = logindate;
}
/**
- * 获取登录IP
+ * This method was generated by MyBatis Generator.
+ * This method returns the value of the database column user login info.loginip
*
- * @return loginip - 登录IP
+ * @return the value of user login info.loginip
+ *
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public String getLoginip() {
return loginip;
}
/**
- * 设置登录IP
+ * This method was generated by MyBatis Generator.
+ * This method sets the value of the database column user login info.loginip
+ *
+ * @param loginip the value for user login info.loginip
*
- * @param loginip 登录IP
+ * @mbggenerated Wed Aug 26 20:55:40 CST 2015
*/
public void setLoginip(String loginip) {
this.loginip = loginip;
diff --git a/src/main/java/com/isea533/mybatis/service/BaseService.java b/src/main/java/com/isea533/mybatis/service/BaseService.java
deleted file mode 100644
index afb88d0..0000000
--- a/src/main/java/com/isea533/mybatis/service/BaseService.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.service;
-
-import tk.mybatis.mapper.common.Mapper;
-import com.github.pagehelper.PageHelper;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * Created by liuzh on 2014/12/11.
- */
-@Service
-public abstract class BaseService {
-
- @Autowired
- protected Mapper mapper;
-
- public int save(T entity){
- return mapper.insert(entity);
- }
-
- public int delete(T entity){
- return mapper.deleteByPrimaryKey(entity);
- }
-
- /**
- * 单表分页查询
- *
- * @param pageNum
- * @param pageSize
- * @return
- */
- public List selectPage(int pageNum,int pageSize){
- PageHelper.startPage(pageNum, pageSize);
- //Spring4支持泛型注入
- return mapper.select(null);
- }
-}
diff --git a/src/main/java/com/isea533/mybatis/service/DemoService.java b/src/main/java/com/isea533/mybatis/service/DemoService.java
index 8431025..1b83a03 100644
--- a/src/main/java/com/isea533/mybatis/service/DemoService.java
+++ b/src/main/java/com/isea533/mybatis/service/DemoService.java
@@ -24,36 +24,24 @@
package com.isea533.mybatis.service;
+import com.isea533.mybatis.mapper.CountryMapper;
import com.isea533.mybatis.model.Country;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import tk.mybatis.mapper.common.Mapper;
+
+import java.util.List;
/**
* @author liuzh
*/
@Service
-public class DemoService extends BaseService {
+public class DemoService {
@Autowired
- private Mapper countryMapper;
-
- public int save(Country country) {
- if (country == null) {
- throw new NullPointerException("保存的对象不能为空!");
- }
- if (country.getCountrycode() == null || country.getCountrycode().equals("")) {
- throw new RuntimeException("国家代码不能为空!");
- }
- if (country.getCountryname() == null || country.getCountryname().equals("")) {
- throw new RuntimeException("国家名称不能为空!");
- }
- return super.save(country);
- }
+ private CountryMapper countryMapper;
- public void test() {
- int result = countryMapper.selectCount(null);
- System.out.println(result);
+ public List selectAll() {
+ return countryMapper.selectAll();
}
}
diff --git a/src/main/resources/applicationContext.xml b/src/main/resources/applicationContext.xml
index 3b10c0a..a15847f 100644
--- a/src/main/resources/applicationContext.xml
+++ b/src/main/resources/applicationContext.xml
@@ -71,18 +71,6 @@
-
-
-
-
-
- dialect=mysql
- reasonable=true
-
-
-
-
-
@@ -94,16 +82,6 @@
-
-
-
- ${mapper.Mapper}
-
-
-
-
-
diff --git a/src/main/resources/config.properties b/src/main/resources/config.properties
index 92559c2..728eef1 100644
--- a/src/main/resources/config.properties
+++ b/src/main/resources/config.properties
@@ -26,14 +26,4 @@
jdbc.driverClass = com.mysql.jdbc.Driver
jdbc.url = jdbc:mysql://192.168.16.137:3306/test
jdbc.user = root
-jdbc.password =
-
-#c3p0
-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.password =
\ No newline at end of file
diff --git a/src/main/resources/generator/generatorConfig.xml b/src/main/resources/generator/generatorConfig.xml
index b69ba60..8db6456 100644
--- a/src/main/resources/generator/generatorConfig.xml
+++ b/src/main/resources/generator/generatorConfig.xml
@@ -34,10 +34,6 @@
-
-
-
-
-
-
+
+
+ delete from country
+ where Id = #{id,jdbcType=INTEGER}
+
+
+
+
+ SELECT LAST_INSERT_ID()
+
+ insert into country (countryname, countrycode)
+ values (#{countryname,jdbcType=VARCHAR}, #{countrycode,jdbcType=VARCHAR})
+
+
+
+ update country
+ set countryname = #{countryname,jdbcType=VARCHAR},
+ countrycode = #{countrycode,jdbcType=VARCHAR}
+ where Id = #{id,jdbcType=INTEGER}
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/mapper/UserInfoMapper.xml b/src/main/resources/mapper/UserInfoMapper.xml
index b179090..1d8b4e4 100644
--- a/src/main/resources/mapper/UserInfoMapper.xml
+++ b/src/main/resources/mapper/UserInfoMapper.xml
@@ -1,33 +1,11 @@
-
-
@@ -39,4 +17,65 @@
+
+
+ delete from user_info
+ where Id = #{id,jdbcType=INTEGER}
+
+
+
+
+ SELECT LAST_INSERT_ID()
+
+ insert into user_info (username, password, usertype,
+ enabled, realname, qq,
+ email, tel)
+ values (#{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{usertype,jdbcType=VARCHAR},
+ #{enabled,jdbcType=INTEGER}, #{realname,jdbcType=VARCHAR}, #{qq,jdbcType=VARCHAR},
+ #{email,jdbcType=VARCHAR}, #{tel,jdbcType=VARCHAR})
+
+
+
+ update user_info
+ set username = #{username,jdbcType=VARCHAR},
+ password = #{password,jdbcType=VARCHAR},
+ usertype = #{usertype,jdbcType=VARCHAR},
+ enabled = #{enabled,jdbcType=INTEGER},
+ realname = #{realname,jdbcType=VARCHAR},
+ qq = #{qq,jdbcType=VARCHAR},
+ email = #{email,jdbcType=VARCHAR},
+ tel = #{tel,jdbcType=VARCHAR}
+ where Id = #{id,jdbcType=INTEGER}
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/mapper/UserLoginInfoMapper.xml b/src/main/resources/mapper/UserLoginInfoMapper.xml
index caf18cf..273ebbf 100644
--- a/src/main/resources/mapper/UserLoginInfoMapper.xml
+++ b/src/main/resources/mapper/UserLoginInfoMapper.xml
@@ -1,37 +1,71 @@
-
-
+
+
+ delete from user login info
+ where Id = #{id,jdbcType=INTEGER}
+ and username = #{username,jdbcType=VARCHAR}
+
+
+
+
+ SELECT LAST_INSERT_ID()
+
+ insert into user login info (username, logindate, loginip
+ )
+ values (#{username,jdbcType=VARCHAR}, #{logindate,jdbcType=TIMESTAMP}, #{loginip,jdbcType=VARCHAR}
+ )
+
+
+
+ update user login info
+ set logindate = #{logindate,jdbcType=TIMESTAMP},
+ loginip = #{loginip,jdbcType=VARCHAR}
+ where Id = #{id,jdbcType=INTEGER}
+ and username = #{username,jdbcType=VARCHAR}
+
+
+
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/jsp/index.jsp b/src/main/webapp/WEB-INF/jsp/index.jsp
index ef96243..c1dcf35 100644
--- a/src/main/webapp/WEB-INF/jsp/index.jsp
+++ b/src/main/webapp/WEB-INF/jsp/index.jsp
@@ -112,7 +112,7 @@
diff --git a/src/test/java/com/isea533/mybatis/test/PageMapperTest.java b/src/test/java/com/isea533/mybatis/test/PageMapperTest.java
deleted file mode 100644
index 46e9a20..0000000
--- a/src/test/java/com/isea533/mybatis/test/PageMapperTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.test;
-
-import com.github.pagehelper.PageHelper;
-import com.github.pagehelper.PageInfo;
-import com.isea533.mybatis.mapper.CountryMapper;
-import com.isea533.mybatis.model.Country;
-import org.apache.ibatis.session.SqlSession;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import tk.mybatis.mapper.entity.Example;
-
-import java.util.List;
-
-/**
- * Created by liuzh on 2015/3/7.
- */
-public class PageMapperTest extends BasicTest {
-
-// @Autowired
-// private CountryMapper countryMapper;
-
- @Autowired
- private SqlSession sqlSession;
-
- @Test
- public void test(){
- CountryMapper countryMapper = sqlSession.getMapper(CountryMapper.class);
- Example example = new Example(Country.class);
- example.createCriteria().andGreaterThan("id",100);
- PageHelper.startPage(2,10);
- List countries = countryMapper.selectByExample(example);
- PageInfo pageInfo = new PageInfo(countries);
- System.out.println(pageInfo.getTotal());
-
- countries = countryMapper.selectByExample(example);
- pageInfo = new PageInfo(countries);
- System.out.println(pageInfo.getTotal());
- }
-}