Skip to content

Spring4 simple #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 6 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

作者邮箱: [email protected]
项目使用Spring4.1.2.RELEASE+SpringMVC4.1.2.RELEASE+Mybatis3.2.8

Mybatis工具群: 211286137 (Mybatis相关工具插件等等)
该项目中不包含MyBatis相关的插件
29 changes: 0 additions & 29 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@
<!-- XML生成路径 -->
<targetResourcesProject>${basedir}/src/main/resources</targetResourcesProject>
<targetXMLPackage>mapper</targetXMLPackage>
<!-- 编译jdk版本 -->
<jdk.version>1.6</jdk.version>
<!-- 依赖版本 -->
<mapper.version>3.1.3</mapper.version>
<pagehelper.version>4.0.0</pagehelper.version>
<mysql.version>5.1.29</mysql.version>
<spring.version>4.1.2.RELEASE</spring.version>
</properties>
Expand Down Expand Up @@ -181,18 +176,6 @@
<scope>compile</scope>
<optional>true</optional>
</dependency>
<!--分页插件-->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>${pagehelper.version}</version>
</dependency>
<!--通用Mapper-->
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper</artifactId>
<version>${mapper.version}</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
Expand Down Expand Up @@ -253,13 +236,6 @@
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
Expand All @@ -275,11 +251,6 @@
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper</artifactId>
<version>${mapper.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,8 @@ public String index() {
}

@ResponseBody
@RequestMapping("test3")
public List<Country> 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<Country> selectAll() {
return demoService.selectAll();
}
}
67 changes: 41 additions & 26 deletions src/main/java/com/isea533/mybatis/mapper/CountryMapper.java
Original file line number Diff line number Diff line change
@@ -1,31 +1,46 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2014 [email protected]
*
* 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<Country> selectAll();

public interface CountryMapper extends Mapper<Country> {
/**
* 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);
}
67 changes: 41 additions & 26 deletions src/main/java/com/isea533/mybatis/mapper/UserInfoMapper.java
Original file line number Diff line number Diff line change
@@ -1,31 +1,46 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2014 [email protected]
*
* 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<UserInfo> selectAll();

public interface UserInfoMapper extends Mapper<UserInfo> {
/**
* 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);
}
68 changes: 42 additions & 26 deletions src/main/java/com/isea533/mybatis/mapper/UserLoginInfoMapper.java
Original file line number Diff line number Diff line change
@@ -1,31 +1,47 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2014 [email protected]
*
* 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<UserLoginInfo> selectAll();

public interface UserLoginInfoMapper extends Mapper<UserLoginInfo> {
/**
* 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);
}
Loading