├── MyBatis ├── MyBatis.iml ├── config │ ├── SqlMapConfig.xml │ ├── log4j.properties │ └── sqlmap │ │ └── User.xml ├── src │ └── com │ │ └── crow │ │ ├── dao │ │ ├── UserDao.java │ │ └── UserDaoImpl.java │ │ ├── jdbc │ │ └── JdbcTest.java │ │ ├── mapper │ │ ├── OrdersCustomMapper.java │ │ ├── OrdersCustomMapper.xml │ │ ├── UserMapper.java │ │ └── UserMapper.xml │ │ ├── mybatis │ │ └── MyBatisDemo.java │ │ ├── po │ │ ├── Items.java │ │ ├── OrderDetail.java │ │ ├── Orders.java │ │ ├── OrdersCustom.java │ │ ├── User.java │ │ ├── UserCustom.java │ │ └── UserQueryVo.java │ │ └── test │ │ ├── OrdersCustomMapperTest.java │ │ ├── UserDaoImplTest.java │ │ └── UserMapperTest.java └── web │ ├── WEB-INF │ └── web.xml │ └── index.jsp ├── README.md ├── SSM.iml ├── SpringMVC ├── .DS_Store ├── SpringMVC.iml ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── com │ │ │ └── crow │ │ │ └── ssm │ │ │ ├── controller │ │ │ ├── ItemsController.java │ │ │ ├── ItemsController2.java │ │ │ └── ItemsController3.java │ │ │ └── po │ │ │ └── Items.java │ │ ├── resources │ │ └── spring │ │ │ └── springmvc.xml │ │ └── webapp │ │ ├── WEB-INF │ │ ├── jsp │ │ │ └── items │ │ │ │ └── itemsList.jsp │ │ └── web.xml │ │ └── index.jsp └── target │ ├── SpringMVC.war │ ├── SpringMVC │ ├── META-INF │ │ └── MANIFEST.MF │ ├── WEB-INF │ │ ├── classes │ │ │ ├── com │ │ │ │ └── crow │ │ │ │ │ └── ssm │ │ │ │ │ ├── controller │ │ │ │ │ ├── ItemsController.class │ │ │ │ │ ├── ItemsController2.class │ │ │ │ │ └── ItemsController3.class │ │ │ │ │ └── po │ │ │ │ │ └── Items.class │ │ │ └── spring │ │ │ │ └── springmvc.xml │ │ ├── jsp │ │ │ └── items │ │ │ │ └── itemsList.jsp │ │ ├── lib │ │ │ ├── aopalliance-1.0.jar │ │ │ ├── commons-logging-1.2.jar │ │ │ ├── javax.servlet-api-3.1.0.jar │ │ │ ├── jsp-api-2.2.jar │ │ │ ├── jstl-1.2.jar │ │ │ ├── spring-aop-4.2.4.RELEASE.jar │ │ │ ├── spring-beans-4.2.4.RELEASE.jar │ │ │ ├── spring-context-4.2.4.RELEASE.jar │ │ │ ├── spring-core-4.2.4.RELEASE.jar │ │ │ ├── spring-expression-4.2.4.RELEASE.jar │ │ │ ├── spring-web-4.2.4.RELEASE.jar │ │ │ └── spring-webmvc-4.2.4.RELEASE.jar │ │ └── web.xml │ └── index.jsp │ ├── classes │ ├── com │ │ └── crow │ │ │ └── ssm │ │ │ ├── controller │ │ │ ├── ItemsController.class │ │ │ ├── ItemsController2.class │ │ │ └── ItemsController3.class │ │ │ └── po │ │ │ └── Items.class │ └── spring │ │ └── springmvc.xml │ ├── maven-archiver │ └── pom.properties │ └── maven-status │ └── maven-compiler-plugin │ └── compile │ └── default-compile │ ├── createdFiles.lst │ └── inputFiles.lst ├── springmvc-mybatis-start ├── pom.xml ├── springmvc-mybatis-start.iml ├── src │ └── main │ │ ├── java │ │ └── com │ │ │ └── crow │ │ │ └── ssm │ │ │ ├── controller │ │ │ ├── ItemsController.java │ │ │ ├── JsonTest.java │ │ │ ├── LoginController.java │ │ │ └── converter │ │ │ │ ├── CustomDateConverter.java │ │ │ │ └── validation │ │ │ │ ├── ValidGroup1.java │ │ │ │ └── ValidGroup2.java │ │ │ ├── exception │ │ │ ├── CustomException.java │ │ │ └── CustomExceptionResolver.java │ │ │ ├── interceptor │ │ │ ├── HandlerInterceptor1.java │ │ │ ├── HandlerInterceptor2.java │ │ │ └── LoginInterceptor.java │ │ │ ├── mapper │ │ │ ├── ItemsMapper.java │ │ │ ├── ItemsMapperCustom.java │ │ │ ├── OrderdetailMapper.java │ │ │ ├── OrdersMapper.java │ │ │ └── UserMapper.java │ │ │ ├── po │ │ │ ├── Items.java │ │ │ ├── ItemsCustom.java │ │ │ ├── ItemsExample.java │ │ │ ├── ItemsQueryVo.java │ │ │ ├── Orderdetail.java │ │ │ ├── OrderdetailExample.java │ │ │ ├── Orders.java │ │ │ ├── OrdersExample.java │ │ │ ├── User.java │ │ │ └── UserExample.java │ │ │ └── service │ │ │ ├── ItemsService.java │ │ │ └── impl │ │ │ └── ItemsServiceImpl.java │ │ ├── resources │ │ ├── CustomValidationMessages.properties │ │ ├── com │ │ │ └── crow │ │ │ │ └── ssm │ │ │ │ └── mapper │ │ │ │ ├── ItemsMapper.xml │ │ │ │ ├── ItemsMapperCustom.xml │ │ │ │ ├── OrderdetailMapper.xml │ │ │ │ ├── OrdersMapper.xml │ │ │ │ └── UserMapper.xml │ │ ├── db.properties │ │ ├── log4j.properties │ │ ├── mybatis │ │ │ └── sqlMapConfig.xml │ │ └── spring │ │ │ ├── applicationContext-dao.xml │ │ │ ├── applicationContext-service.xml │ │ │ ├── applicationContext-transaction.xml │ │ │ └── springmvc.xml │ │ └── webapp │ │ ├── WEB-INF │ │ ├── jsp │ │ │ ├── error.jsp │ │ │ ├── items │ │ │ │ ├── editItems.jsp │ │ │ │ ├── editItemsQuery.jsp │ │ │ │ └── itemsList.jsp │ │ │ ├── login.jsp │ │ │ └── success.jsp │ │ └── web.xml │ │ ├── index.jsp │ │ ├── js │ │ └── jquery-1.4.4.min.js │ │ └── jsonTest.jsp └── target │ ├── classes │ ├── CustomValidationMessages.properties │ ├── com │ │ └── crow │ │ │ └── ssm │ │ │ ├── controller │ │ │ ├── ItemsController.class │ │ │ ├── JsonTest.class │ │ │ ├── LoginController.class │ │ │ └── converter │ │ │ │ ├── CustomDateConverter.class │ │ │ │ └── validation │ │ │ │ ├── ValidGroup1.class │ │ │ │ └── ValidGroup2.class │ │ │ ├── exception │ │ │ ├── CustomException.class │ │ │ └── CustomExceptionResolver.class │ │ │ ├── interceptor │ │ │ ├── HandlerInterceptor1.class │ │ │ ├── HandlerInterceptor2.class │ │ │ └── LoginInterceptor.class │ │ │ ├── mapper │ │ │ ├── ItemsMapper.class │ │ │ ├── ItemsMapper.xml │ │ │ ├── ItemsMapperCustom.class │ │ │ ├── ItemsMapperCustom.xml │ │ │ ├── OrderdetailMapper.class │ │ │ ├── OrderdetailMapper.xml │ │ │ ├── OrdersMapper.class │ │ │ ├── OrdersMapper.xml │ │ │ ├── UserMapper.class │ │ │ └── UserMapper.xml │ │ │ ├── po │ │ │ ├── Items.class │ │ │ ├── ItemsCustom.class │ │ │ ├── ItemsExample$Criteria.class │ │ │ ├── ItemsExample$Criterion.class │ │ │ ├── ItemsExample$GeneratedCriteria.class │ │ │ ├── ItemsExample.class │ │ │ ├── ItemsQueryVo.class │ │ │ ├── Orderdetail.class │ │ │ ├── OrderdetailExample$Criteria.class │ │ │ ├── OrderdetailExample$Criterion.class │ │ │ ├── OrderdetailExample$GeneratedCriteria.class │ │ │ ├── OrderdetailExample.class │ │ │ ├── Orders.class │ │ │ ├── OrdersExample$Criteria.class │ │ │ ├── OrdersExample$Criterion.class │ │ │ ├── OrdersExample$GeneratedCriteria.class │ │ │ ├── OrdersExample.class │ │ │ ├── User.class │ │ │ ├── UserExample$Criteria.class │ │ │ ├── UserExample$Criterion.class │ │ │ ├── UserExample$GeneratedCriteria.class │ │ │ └── UserExample.class │ │ │ └── service │ │ │ ├── ItemsService.class │ │ │ └── impl │ │ │ └── ItemsServiceImpl.class │ ├── db.properties │ ├── log4j.properties │ ├── mybatis │ │ └── sqlMapConfig.xml │ └── spring │ │ ├── applicationContext-dao.xml │ │ ├── applicationContext-service.xml │ │ ├── applicationContext-transaction.xml │ │ └── springmvc.xml │ └── springmvc-mybatis-start-1.0-SNAPSHOT │ ├── META-INF │ └── MANIFEST.MF │ ├── WEB-INF │ ├── classes │ │ ├── CustomValidationMessages.properties │ │ ├── com │ │ │ └── crow │ │ │ │ └── ssm │ │ │ │ ├── controller │ │ │ │ ├── ItemsController.class │ │ │ │ ├── JsonTest.class │ │ │ │ ├── LoginController.class │ │ │ │ └── converter │ │ │ │ │ ├── CustomDateConverter.class │ │ │ │ │ └── validation │ │ │ │ │ ├── ValidGroup1.class │ │ │ │ │ └── ValidGroup2.class │ │ │ │ ├── exception │ │ │ │ ├── CustomException.class │ │ │ │ └── CustomExceptionResolver.class │ │ │ │ ├── interceptor │ │ │ │ ├── HandlerInterceptor1.class │ │ │ │ ├── HandlerInterceptor2.class │ │ │ │ └── LoginInterceptor.class │ │ │ │ ├── mapper │ │ │ │ ├── ItemsMapper.class │ │ │ │ ├── ItemsMapper.xml │ │ │ │ ├── ItemsMapperCustom.class │ │ │ │ ├── ItemsMapperCustom.xml │ │ │ │ ├── OrderdetailMapper.class │ │ │ │ ├── OrderdetailMapper.xml │ │ │ │ ├── OrdersMapper.class │ │ │ │ ├── OrdersMapper.xml │ │ │ │ ├── UserMapper.class │ │ │ │ └── UserMapper.xml │ │ │ │ ├── po │ │ │ │ ├── Items.class │ │ │ │ ├── ItemsCustom.class │ │ │ │ ├── ItemsExample$Criteria.class │ │ │ │ ├── ItemsExample$Criterion.class │ │ │ │ ├── ItemsExample$GeneratedCriteria.class │ │ │ │ ├── ItemsExample.class │ │ │ │ ├── ItemsQueryVo.class │ │ │ │ ├── Orderdetail.class │ │ │ │ ├── OrderdetailExample$Criteria.class │ │ │ │ ├── OrderdetailExample$Criterion.class │ │ │ │ ├── OrderdetailExample$GeneratedCriteria.class │ │ │ │ ├── OrderdetailExample.class │ │ │ │ ├── Orders.class │ │ │ │ ├── OrdersExample$Criteria.class │ │ │ │ ├── OrdersExample$Criterion.class │ │ │ │ ├── OrdersExample$GeneratedCriteria.class │ │ │ │ ├── OrdersExample.class │ │ │ │ ├── User.class │ │ │ │ ├── UserExample$Criteria.class │ │ │ │ ├── UserExample$Criterion.class │ │ │ │ ├── UserExample$GeneratedCriteria.class │ │ │ │ └── UserExample.class │ │ │ │ └── service │ │ │ │ ├── ItemsService.class │ │ │ │ └── impl │ │ │ │ └── ItemsServiceImpl.class │ │ ├── db.properties │ │ ├── log4j.properties │ │ ├── mybatis │ │ │ └── sqlMapConfig.xml │ │ └── spring │ │ │ ├── applicationContext-dao.xml │ │ │ ├── applicationContext-service.xml │ │ │ ├── applicationContext-transaction.xml │ │ │ └── springmvc.xml │ ├── jsp │ │ ├── error.jsp │ │ ├── items │ │ │ ├── editItems.jsp │ │ │ ├── editItemsQuery.jsp │ │ │ └── itemsList.jsp │ │ ├── login.jsp │ │ └── success.jsp │ ├── lib │ │ ├── aopalliance-1.0.jar │ │ ├── aspectjweaver-1.8.7.jar │ │ ├── classmate-1.1.0.jar │ │ ├── commons-dbcp-1.4.jar │ │ ├── commons-fileupload-1.3.1.jar │ │ ├── commons-io-2.2.jar │ │ ├── commons-logging-1.2.jar │ │ ├── commons-pool-1.5.4.jar │ │ ├── hibernate-validator-5.2.4.Final.jar │ │ ├── jackson-annotations-2.7.0.jar │ │ ├── jackson-core-2.7.2.jar │ │ ├── jackson-core-asl-1.9.13.jar │ │ ├── jackson-databind-2.7.2.jar │ │ ├── jackson-mapper-asl-1.9.13.jar │ │ ├── javax.servlet-api-3.1.0.jar │ │ ├── jboss-logging-3.2.1.Final.jar │ │ ├── jsp-api-2.2.jar │ │ ├── jstl-1.2.jar │ │ ├── log4j-1.2.17.jar │ │ ├── mybatis-3.3.1.jar │ │ ├── mybatis-spring-1.2.4.jar │ │ ├── mysql-connector-java-5.1.38.jar │ │ ├── slf4j-api-1.7.18.jar │ │ ├── spring-aop-4.2.4.RELEASE.jar │ │ ├── spring-aspects-4.2.4.RELEASE.jar │ │ ├── spring-beans-4.2.4.RELEASE.jar │ │ ├── spring-context-4.2.4.RELEASE.jar │ │ ├── spring-core-4.2.4.RELEASE.jar │ │ ├── spring-expression-4.2.4.RELEASE.jar │ │ ├── spring-jdbc-4.2.4.RELEASE.jar │ │ ├── spring-orm-4.2.4.RELEASE.jar │ │ ├── spring-test-4.2.4.RELEASE.jar │ │ ├── spring-tx-4.2.4.RELEASE.jar │ │ ├── spring-web-4.2.4.RELEASE.jar │ │ ├── spring-webmvc-4.2.4.RELEASE.jar │ │ ├── standard-1.1.2.jar │ │ └── validation-api-1.1.0.Final.jar │ └── web.xml │ ├── index.jsp │ ├── js │ └── jquery-1.4.4.min.js │ └── jsonTest.jsp └── sql ├── create.sql └── data.sql /MyBatis/MyBatis.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /MyBatis/config/SqlMapConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /MyBatis/config/log4j.properties: -------------------------------------------------------------------------------- 1 | # Global logging configuration 2 | # 在开发环境下日志级别设置成DEBUG,在生产环境下才设置为ERROR和INFO 3 | log4j.rootLogger=DEBUG, stdout 4 | # MyBatis logging configuration... 5 | log4j.logger.org.mybatis.example.BlogMapper=TRACE 6 | # Console output... 7 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 8 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 9 | log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n -------------------------------------------------------------------------------- /MyBatis/config/sqlmap/User.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 13 | 16 | 19 | 20 | 21 | SELECT LAST_INSERT_ID() 22 | 23 | INSERT INTO USER (username, sex, birthday, address) VALUES (#{username}, #{sex}, #{birthday}, #{address}) 24 | 25 | 26 | DELETE FROM USER WHERE id = #{id} 27 | 28 | 29 | UPDATE USER SET username = #{username}, sex = #{sex}, birthday = #{birthday}, address = #{address} WHERE id = #{id} 30 | 31 | 32 | -------------------------------------------------------------------------------- /MyBatis/src/com/crow/dao/UserDao.java: -------------------------------------------------------------------------------- 1 | package com.crow.dao; 2 | 3 | import com.crow.po.User; 4 | 5 | import java.io.IOException; 6 | import java.util.List; 7 | 8 | /** 9 | * Created by CrowHawk on 17/3/16. 10 | */ 11 | public interface UserDao { 12 | public void insertUser(User user) throws Exception; 13 | public User findUserById(int id) throws Exception; 14 | public List findUserByName(String name) throws Exception;//模糊查找 15 | public void deleteUser(int id) throws Exception; 16 | } 17 | -------------------------------------------------------------------------------- /MyBatis/src/com/crow/dao/UserDaoImpl.java: -------------------------------------------------------------------------------- 1 | package com.crow.dao; 2 | 3 | import com.crow.po.User; 4 | import org.apache.ibatis.session.SqlSession; 5 | import org.apache.ibatis.session.SqlSessionFactory; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by CrowHawk on 17/3/16. 11 | */ 12 | public class UserDaoImpl implements UserDao { 13 | private SqlSessionFactory sqlSessionFactory; 14 | public UserDaoImpl(SqlSessionFactory sqlSessionFactory){ 15 | this.sqlSessionFactory = sqlSessionFactory; 16 | } 17 | 18 | @Override 19 | public void insertUser(User user) throws Exception{ 20 | SqlSession sqlSession = sqlSessionFactory.openSession(); 21 | sqlSession.insert("test.insertUser", user); 22 | sqlSession.commit(); 23 | sqlSession.close(); 24 | } 25 | 26 | @Override 27 | public User findUserById(int id) throws Exception{ 28 | SqlSession sqlSession = sqlSessionFactory.openSession(); 29 | User user = sqlSession.selectOne("test.findUserById", id); 30 | sqlSession.close(); 31 | return user; 32 | } 33 | 34 | @Override 35 | public List findUserByName(String name) throws Exception{ 36 | SqlSession sqlSession = sqlSessionFactory.openSession(); 37 | List userList = sqlSession.selectList("test.findUserByName", name); 38 | sqlSession.close(); 39 | return userList; 40 | } 41 | 42 | @Override 43 | public void deleteUser(int id) throws Exception{ 44 | SqlSession sqlSession = sqlSessionFactory.openSession(); 45 | sqlSession.delete("test.deleteUser", id); 46 | sqlSession.commit(); 47 | sqlSession.close(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /MyBatis/src/com/crow/jdbc/JdbcTest.java: -------------------------------------------------------------------------------- 1 | package com.crow.jdbc; 2 | 3 | 4 | import java.sql.Connection; 5 | import java.sql.DriverManager; 6 | import java.sql.ResultSet; 7 | import java.sql.Statement; 8 | 9 | /** 10 | * Created by CrowHawk on 17/3/15. 11 | */ 12 | public class JdbcTest { 13 | public static void main(String[] args) throws Exception{ 14 | String url = "jdbc:mysql://localhost:3306/OrderForm"; 15 | String username = "root"; 16 | String password = "wyj"; 17 | Class.forName("com.mysql.jdbc.Driver");//加载数据库驱动 18 | Connection conn = DriverManager.getConnection(url, username, password);////通过驱动管理类获取数据库链接 19 | Statement statement = conn.createStatement();//获取用于向数据库发送sql语句的statement 20 | String sql = "select * from user";//定义sql语句 21 | ResultSet resultSet = statement.executeQuery(sql);//向数据库发sql,并获取结果集 22 | while (resultSet.next()){//取出结果集的数据 23 | System.out.println("id = " + resultSet.getObject("id")); 24 | System.out.println("username = " + resultSet.getObject("username")); 25 | System.out.println("birthday = " + resultSet.getObject("birthday")); 26 | System.out.println("sex = " + resultSet.getObject("sex")); 27 | System.out.println("address = " + resultSet.getObject("address")); 28 | } 29 | //释放资源 30 | resultSet.close(); 31 | statement.close(); 32 | conn.close(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /MyBatis/src/com/crow/mapper/OrdersCustomMapper.java: -------------------------------------------------------------------------------- 1 | package com.crow.mapper; 2 | 3 | import com.crow.po.Orders; 4 | import com.crow.po.OrdersCustom; 5 | import com.crow.po.User; 6 | import com.sun.org.apache.xpath.internal.operations.Or; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Created by CrowHawk on 17/3/21. 12 | */ 13 | public interface OrdersCustomMapper { 14 | public List findOrdersUser(); 15 | 16 | public List findOrdersUserResultMap(); 17 | 18 | public List findOrderAndDetailResultMap(); 19 | 20 | public List findUserAndItemsResultMap(); 21 | 22 | //查询订单关联查询用户,用户信息是延迟加载 23 | public List findOrdersUserLazyLoading()throws Exception; 24 | } 25 | -------------------------------------------------------------------------------- /MyBatis/src/com/crow/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.crow.mapper; 2 | 3 | import com.crow.po.User; 4 | import com.crow.po.UserCustom; 5 | import com.crow.po.UserQueryVo; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by CrowHawk on 17/3/17. 11 | */ 12 | public interface UserMapper { 13 | //用户信息综合查询 14 | public List findUserList(UserQueryVo userQueryVo) throws Exception; 15 | 16 | //用户信息综合查询总数 17 | public int findUserCount(UserQueryVo userQueryVo) throws Exception; 18 | 19 | //根据id查询用户信息 20 | public User findUserById(int id) throws Exception; 21 | 22 | //根据id查询用户信息,使用resultMap输出 23 | // public User findUserByIdResultMap(int id) throws Exception; 24 | 25 | 26 | //根据用户名列查询用户列表 27 | public List findUserByName(String name)throws Exception; 28 | 29 | public List findUserBySex(int sex)throws Exception; 30 | 31 | public List findUserByAddress(String address)throws Exception; 32 | 33 | //插入用户 34 | public void insertUser(User user)throws Exception; 35 | 36 | //删除用户 37 | public default void deleteUser(int id) throws Exception { 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /MyBatis/src/com/crow/mapper/UserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 10 | 11 | 12 | 13 | and user.sex = #{userCustom.sex} 14 | 15 | 16 | and user.username LIKE '%${userCustom.username}%' 17 | 18 | 19 | 26 | 29 | 30 | 31 | id=#{user_id} 32 | 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 44 | 48 | 62 | 66 | 80 | 84 | 87 | 92 | 95 | 98 | 99 | 100 | SELECT LAST_INSERT_ID() 101 | 102 | INSERT INTO USER (username, sex, birthday, address) VALUES (#{username}, #{sex}, #{birthday}, #{address}) 103 | 104 | 105 | DELETE FROM USER WHERE id = #{id} 106 | 107 | 108 | UPDATE USER SET username = #{username}, sex = #{sex}, birthday = #{birthday}, address = #{address} WHERE id = #{id} 109 | 110 | 111 | -------------------------------------------------------------------------------- /MyBatis/src/com/crow/mybatis/MyBatisDemo.java: -------------------------------------------------------------------------------- 1 | package com.crow.mybatis; 2 | 3 | import com.crow.po.User; 4 | import org.apache.ibatis.io.Resources; 5 | import org.apache.ibatis.session.SqlSession; 6 | import org.apache.ibatis.session.SqlSessionFactory; 7 | import org.apache.ibatis.session.SqlSessionFactoryBuilder; 8 | import org.junit.Test; 9 | 10 | 11 | import java.io.IOException; 12 | import java.io.InputStream; 13 | import java.util.Date; 14 | import java.util.List; 15 | 16 | /** 17 | * Created by CrowHawk on 17/3/15. 18 | */ 19 | public class MyBatisDemo { 20 | //根据ID查询用户信息,得到一条记录结果 21 | @Test 22 | public void findUserByIdTest() throws IOException{ 23 | String resource = "SqlMapConfig.xml"; 24 | InputStream inputStream = Resources.getResourceAsStream(resource);//获取配置文件流 25 | // 创建会话工厂,传入mybatis的配置文件信息 26 | SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream); 27 | // 通过工厂得到SqlSession 28 | SqlSession sqlSession = sqlSessionFactory.openSession(); 29 | User user = sqlSession.selectOne("test.findUserById",1); 30 | System.out.println(user); 31 | sqlSession.close(); 32 | } 33 | 34 | @Test 35 | public void findUserByNameTest() throws IOException{ 36 | String resource = "SqlMapConfig.xml"; 37 | InputStream inputStream = Resources.getResourceAsStream(resource); 38 | SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream); 39 | SqlSession sqlSession = sqlSessionFactory.openSession(); 40 | List userList = sqlSession.selectList("test.findUserByName", "小明"); 41 | System.out.println(userList); 42 | sqlSession.close(); 43 | } 44 | 45 | @Test 46 | public void insertUser() throws IOException{ 47 | String resource = "SqlMapConfig.xml"; 48 | InputStream inputStream = Resources.getResourceAsStream(resource); 49 | SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream); 50 | SqlSession sqlSession = sqlSessionFactory.openSession(); 51 | User user = new User(); 52 | user.setUsername("老王"); 53 | user.setSex("1"); 54 | user.setAddress("江苏镇江"); 55 | user.setBirthday(new Date()); 56 | sqlSession.insert("test.insertUser", user); 57 | // 提交事务 58 | sqlSession.commit(); 59 | // 获取用户信息主键 60 | System.out.println(user.getId()); 61 | sqlSession.close(); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /MyBatis/src/com/crow/po/Items.java: -------------------------------------------------------------------------------- 1 | package com.crow.po; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * Created by CrowHawk on 17/3/22. 7 | */ 8 | public class Items { 9 | private Integer id; 10 | 11 | private String name; 12 | 13 | private Float price; 14 | 15 | private String pic; 16 | 17 | private Date createtime; 18 | 19 | private String detail; 20 | 21 | public Integer getId() { 22 | return id; 23 | } 24 | 25 | public void setId(Integer id) { 26 | this.id = id; 27 | } 28 | 29 | public String getName() { 30 | return name; 31 | } 32 | 33 | public void setName(String name) { 34 | this.name = name == null ? null : name.trim(); 35 | } 36 | 37 | public Float getPrice() { 38 | return price; 39 | } 40 | 41 | public void setPrice(Float price) { 42 | this.price = price; 43 | } 44 | 45 | public String getPic() { 46 | return pic; 47 | } 48 | 49 | public void setPic(String pic) { 50 | this.pic = pic == null ? null : pic.trim(); 51 | } 52 | 53 | public Date getCreatetime() { 54 | return createtime; 55 | } 56 | 57 | public void setCreatetime(Date createtime) { 58 | this.createtime = createtime; 59 | } 60 | 61 | public String getDetail() { 62 | return detail; 63 | } 64 | 65 | public void setDetail(String detail) { 66 | this.detail = detail == null ? null : detail.trim(); 67 | } 68 | 69 | @Override 70 | public String toString() { 71 | return "Items [id=" + id + ", name=" + name + ", price=" + price 72 | + ", pic=" + pic + ", createtime=" + createtime + ", detail=" 73 | + detail + "]"; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /MyBatis/src/com/crow/po/OrderDetail.java: -------------------------------------------------------------------------------- 1 | package com.crow.po; 2 | 3 | 4 | 5 | /** 6 | * Created by CrowHawk on 17/3/22. 7 | */ 8 | public class OrderDetail { 9 | private Integer id; 10 | 11 | private Integer ordersId; 12 | 13 | private Integer itemsId; 14 | 15 | private Integer itemsNum; 16 | 17 | //明细对应的商品信息 18 | private Items items; 19 | 20 | 21 | public Integer getId() { 22 | return id; 23 | } 24 | 25 | public void setId(Integer id) { 26 | this.id = id; 27 | } 28 | 29 | public Integer getOrdersId() { 30 | return ordersId; 31 | } 32 | 33 | public void setOrdersId(Integer ordersId) { 34 | this.ordersId = ordersId; 35 | } 36 | 37 | public Integer getItemsId() { 38 | return itemsId; 39 | } 40 | 41 | public void setItemsId(Integer itemsId) { 42 | this.itemsId = itemsId; 43 | } 44 | 45 | public Integer getItemsNum() { 46 | return itemsNum; 47 | } 48 | 49 | public void setItemsNum(Integer itemsNum) { 50 | this.itemsNum = itemsNum; 51 | } 52 | 53 | public Items getItems() { 54 | return items; 55 | } 56 | 57 | public void setItems(Items items) { 58 | this.items = items; 59 | } 60 | 61 | @Override 62 | public String toString() { 63 | return "Orderdetail [id=" + id + ", ordersId=" + ordersId 64 | + ", itemsId=" + itemsId + ", itemsNum=" + itemsNum + "]"; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /MyBatis/src/com/crow/po/Orders.java: -------------------------------------------------------------------------------- 1 | package com.crow.po; 2 | 3 | import java.util.Date; 4 | import java.util.List; 5 | 6 | /** 7 | * Created by CrowHawk on 17/3/21. 8 | */ 9 | public class Orders { 10 | private Integer id; 11 | 12 | private Integer userId; 13 | 14 | private String number; 15 | 16 | private Date createtime; 17 | 18 | private String note; 19 | 20 | //用户信息 21 | private User user; 22 | 23 | //订单明细 24 | private List orderDetails; 25 | 26 | public Integer getId() { 27 | return id; 28 | } 29 | 30 | public void setId(Integer id) { 31 | this.id = id; 32 | } 33 | 34 | public Integer getUserId() { 35 | return userId; 36 | } 37 | 38 | public void setUserId(Integer userId) { 39 | this.userId = userId; 40 | } 41 | 42 | public String getNumber() { 43 | return number; 44 | } 45 | 46 | public void setNumber(String number) { 47 | this.number = number == null ? null : number.trim(); 48 | } 49 | 50 | public Date getCreatetime() { 51 | return createtime; 52 | } 53 | 54 | public void setCreatetime(Date createtime) { 55 | this.createtime = createtime; 56 | } 57 | 58 | public String getNote() { 59 | return note; 60 | } 61 | 62 | public void setNote(String note) { 63 | this.note = note == null ? null : note.trim(); 64 | } 65 | 66 | public User getUser() { 67 | return user; 68 | } 69 | 70 | public void setUser(User user) { 71 | this.user = user; 72 | } 73 | 74 | public List getOrderDetails() { 75 | return orderDetails; 76 | } 77 | 78 | public void setOrderDetails(List orderDetails) { 79 | this.orderDetails = orderDetails; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /MyBatis/src/com/crow/po/OrdersCustom.java: -------------------------------------------------------------------------------- 1 | package com.crow.po; 2 | 3 | /** 4 | * Created by CrowHawk on 17/3/21. 5 | */ 6 | public class OrdersCustom extends Orders{ 7 | private String username; 8 | private String sex; 9 | private String address; 10 | public String getUsername() { 11 | return username; 12 | } 13 | public void setUsername(String username) { 14 | this.username = username; 15 | } 16 | public String getSex() { 17 | return sex; 18 | } 19 | public void setSex(String sex) { 20 | this.sex = sex; 21 | } 22 | public String getAddress() { 23 | return address; 24 | } 25 | public void setAddress(String address) { 26 | this.address = address; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /MyBatis/src/com/crow/po/User.java: -------------------------------------------------------------------------------- 1 | package com.crow.po; 2 | 3 | import java.util.Date; 4 | import java.util.List; 5 | 6 | /** 7 | * Created by CrowHawk on 17/3/15. 8 | */ 9 | 10 | public class User { 11 | //属性名和数据库表对应 12 | private int id; 13 | private String username;// 用户姓名 14 | private String sex;// 性别 15 | private Date birthday;// 生日 16 | private String address;// 地址 17 | private List ordersList;//用户创建的订单列表 18 | 19 | public int getId() { 20 | return id; 21 | } 22 | public void setId(int id) { 23 | this.id = id; 24 | } 25 | public String getUsername() { 26 | return username; 27 | } 28 | public void setUsername(String username) { 29 | this.username = username; 30 | } 31 | public String getSex() { 32 | return sex; 33 | } 34 | public void setSex(String sex) { 35 | this.sex = sex; 36 | } 37 | public Date getBirthday() { 38 | return birthday; 39 | } 40 | public void setBirthday(Date birthday) { 41 | this.birthday = birthday; 42 | } 43 | public String getAddress() { 44 | return address; 45 | } 46 | public void setAddress(String address) { 47 | this.address = address; 48 | } 49 | 50 | public List getOrdersList() { 51 | return ordersList; 52 | } 53 | 54 | public void setOrdersList(List ordersList) { 55 | this.ordersList = ordersList; 56 | } 57 | 58 | @Override 59 | public String toString() { 60 | return "User [id=" + id + ", username=" + username + ", sex=" + sex 61 | + ", birthday=" + birthday + ", address=" + address + "]"; 62 | } 63 | } -------------------------------------------------------------------------------- /MyBatis/src/com/crow/po/UserCustom.java: -------------------------------------------------------------------------------- 1 | package com.crow.po; 2 | 3 | /** 4 | * Created by CrowHawk on 17/3/20. 5 | */ 6 | public class UserCustom extends User { 7 | } 8 | -------------------------------------------------------------------------------- /MyBatis/src/com/crow/po/UserQueryVo.java: -------------------------------------------------------------------------------- 1 | package com.crow.po; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Created by CrowHawk on 17/3/20. 7 | */ 8 | public class UserQueryVo { 9 | //传入多个id 10 | private List ids; 11 | 12 | 13 | //在这里包装所需要的查询条件 14 | 15 | //用户查询条件 16 | private UserCustom userCustom; 17 | 18 | public UserCustom getUserCustom() { 19 | return userCustom; 20 | } 21 | 22 | public void setUserCustom(UserCustom userCustom) { 23 | this.userCustom = userCustom; 24 | } 25 | 26 | public List getIds() { 27 | return ids; 28 | } 29 | 30 | public void setIds(List ids) { 31 | this.ids = ids; 32 | } 33 | 34 | //可以包装其它的查询条件,订单、商品 35 | //.... 36 | 37 | 38 | } 39 | 40 | -------------------------------------------------------------------------------- /MyBatis/src/com/crow/test/OrdersCustomMapperTest.java: -------------------------------------------------------------------------------- 1 | package com.crow.test; 2 | 3 | import com.crow.mapper.OrdersCustomMapper; 4 | import com.crow.po.Orders; 5 | import com.crow.po.OrdersCustom; 6 | import com.crow.po.User; 7 | import org.apache.ibatis.io.Resources; 8 | import org.apache.ibatis.session.SqlSession; 9 | import org.apache.ibatis.session.SqlSessionFactory; 10 | import org.apache.ibatis.session.SqlSessionFactoryBuilder; 11 | import org.junit.Before; 12 | import org.junit.Test; 13 | 14 | import java.io.InputStream; 15 | import java.util.List; 16 | 17 | /** 18 | * Created by CrowHawk on 17/3/21. 19 | */ 20 | public class OrdersCustomMapperTest { 21 | 22 | private SqlSessionFactory sqlSessionFactory; 23 | 24 | @Before 25 | public void setUp() throws Exception { 26 | // 创建sqlSessionFactory 27 | 28 | // mybatis配置文件 29 | String resource = "SqlMapConfig.xml"; 30 | // 得到配置文件流 31 | InputStream inputStream = Resources.getResourceAsStream(resource); 32 | 33 | // 创建会话工厂,传入mybatis的配置文件信息 34 | sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream); 35 | } 36 | 37 | @Test 38 | public void testFindOrdersUser() throws Exception { 39 | 40 | SqlSession sqlSession = sqlSessionFactory.openSession(); 41 | // 创建代理对象 42 | OrdersCustomMapper ordersCustomMapper = sqlSession.getMapper(OrdersCustomMapper.class); 43 | 44 | // 调用maper的方法 45 | List list = ordersCustomMapper.findOrdersUser(); 46 | 47 | System.out.println(list); 48 | 49 | sqlSession.close(); 50 | } 51 | 52 | @Test 53 | public void testFindOrdersUserResultMap() throws Exception { 54 | 55 | SqlSession sqlSession = sqlSessionFactory.openSession(); 56 | // 创建代理对象 57 | OrdersCustomMapper ordersCustomMapper = sqlSession.getMapper(OrdersCustomMapper.class); 58 | 59 | // 调用maper的方法 60 | List list = ordersCustomMapper.findOrdersUserResultMap(); 61 | 62 | System.out.println(list); 63 | 64 | sqlSession.close(); 65 | } 66 | 67 | @Test 68 | public void testFindOrderAndDetailResultMap() throws Exception{ 69 | SqlSession sqlSession = sqlSessionFactory.openSession(); 70 | OrdersCustomMapper ordersCustomMapper = sqlSession.getMapper(OrdersCustomMapper.class); 71 | List ordersList = ordersCustomMapper.findOrderAndDetailResultMap(); 72 | System.out.println(ordersList); 73 | sqlSession.close(); 74 | } 75 | 76 | @Test 77 | public void testfindUserAndItemsResultMap() throws Exception{ 78 | SqlSession sqlSession = sqlSessionFactory.openSession(); 79 | OrdersCustomMapper ordersCustomMapper = sqlSession.getMapper(OrdersCustomMapper.class); 80 | List userList = ordersCustomMapper.findUserAndItemsResultMap(); 81 | System.out.println(userList); 82 | sqlSession.close(); 83 | } 84 | 85 | // 查询订单关联查询用户,用户信息使用延迟加载 86 | @Test 87 | public void testFindOrdersUserLazyLoading() throws Exception { 88 | SqlSession sqlSession = sqlSessionFactory.openSession();// 创建代理对象 89 | OrdersCustomMapper ordersMapperCustom = sqlSession 90 | .getMapper(OrdersCustomMapper.class); 91 | // 查询订单信息(单表) 92 | List list = ordersMapperCustom.findOrdersUserLazyLoading(); 93 | 94 | // 遍历上边的订单列表 95 | for (Orders orders : list) { 96 | // 执行getUser()去查询用户信息,这里实现按需加载 97 | User user = orders.getUser(); 98 | System.out.println(user); 99 | } 100 | 101 | } 102 | 103 | } 104 | -------------------------------------------------------------------------------- /MyBatis/src/com/crow/test/UserDaoImplTest.java: -------------------------------------------------------------------------------- 1 | package com.crow.test; 2 | 3 | import com.crow.dao.UserDao; 4 | import com.crow.dao.UserDaoImpl; 5 | import com.crow.po.User; 6 | import org.apache.ibatis.io.Resources; 7 | import org.apache.ibatis.session.SqlSessionFactory; 8 | import org.apache.ibatis.session.SqlSessionFactoryBuilder; 9 | import org.junit.Before; 10 | import org.junit.Test; 11 | 12 | import java.io.IOException; 13 | import java.io.InputStream; 14 | import java.util.List; 15 | 16 | /** 17 | * Created by CrowHawk on 17/3/17. 18 | */ 19 | public class UserDaoImplTest { 20 | private SqlSessionFactory sqlSessionFactory; 21 | 22 | @Before 23 | public void setUp() throws IOException{ 24 | String resource = "SqlMapConfig.xml"; 25 | InputStream inputStream = Resources.getResourceAsStream(resource); 26 | sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream); 27 | } 28 | 29 | @Test 30 | public void findUserByIdTest() throws Exception{ 31 | UserDao userDao = new UserDaoImpl(sqlSessionFactory); 32 | User user = userDao.findUserById(1); 33 | System.out.println(user); 34 | } 35 | 36 | @Test 37 | public void findUserByNameTest() throws Exception{ 38 | UserDao userDao = new UserDaoImpl(sqlSessionFactory); 39 | List userList = userDao.findUserByName("小明"); 40 | System.out.println(userList); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /MyBatis/src/com/crow/test/UserMapperTest.java: -------------------------------------------------------------------------------- 1 | package com.crow.test; 2 | 3 | import com.crow.mapper.UserMapper; 4 | import com.crow.po.User; 5 | import com.crow.po.UserCustom; 6 | import com.crow.po.UserQueryVo; 7 | import org.apache.ibatis.io.Resources; 8 | import org.apache.ibatis.session.SqlSession; 9 | import org.apache.ibatis.session.SqlSessionFactory; 10 | import org.apache.ibatis.session.SqlSessionFactoryBuilder; 11 | import org.junit.Before; 12 | import org.junit.Test; 13 | 14 | import java.io.IOException; 15 | import java.io.InputStream; 16 | import java.util.ArrayList; 17 | import java.util.List; 18 | 19 | /** 20 | * Created by CrowHawk on 17/3/17. 21 | */ 22 | public class UserMapperTest { 23 | private SqlSessionFactory sqlSessionFactory; 24 | 25 | @Before 26 | public void setUp() throws IOException { 27 | String resource = "SqlMapConfig.xml"; 28 | InputStream inputStream = Resources.getResourceAsStream(resource); 29 | sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream); 30 | } 31 | 32 | @Test 33 | public void testFindUserList() throws Exception { 34 | 35 | SqlSession sqlSession = sqlSessionFactory.openSession(); 36 | 37 | //创建UserMapper对象,mybatis自动生成mapper代理对象 38 | UserMapper userMapper = sqlSession.getMapper(UserMapper.class); 39 | 40 | //创建包装对象,设置查询条件 41 | UserQueryVo userQueryVo = new UserQueryVo(); 42 | UserCustom userCustom = new UserCustom(); 43 | //由于这里使用动态sql,如果不设置某个值,条件不会拼接在sql中 44 | // userCustom.setSex("1"); 45 | userCustom.setUsername("小明"); 46 | //传入多个id 47 | List ids = new ArrayList(); 48 | ids.add(1); 49 | ids.add(10); 50 | ids.add(16); 51 | //将ids通过userQueryVo传入statement中 52 | userQueryVo.setIds(ids); 53 | userQueryVo.setUserCustom(userCustom); 54 | //调用userMapper的方法 55 | 56 | List list = userMapper.findUserList(userQueryVo); 57 | 58 | System.out.println(list); 59 | 60 | 61 | } 62 | 63 | @Test 64 | public void testFindUserCount() throws Exception { 65 | 66 | SqlSession sqlSession = sqlSessionFactory.openSession(); 67 | 68 | //创建UserMapper对象,mybatis自动生成mapper代理对象 69 | UserMapper userMapper = sqlSession.getMapper(UserMapper.class); 70 | 71 | //创建包装对象,设置查询条件 72 | UserQueryVo userQueryVo = new UserQueryVo(); 73 | UserCustom userCustom = new UserCustom(); 74 | userCustom.setSex("1"); 75 | userCustom.setUsername("张三丰"); 76 | userQueryVo.setUserCustom(userCustom); 77 | //调用userMapper的方法 78 | 79 | int count = userMapper.findUserCount(userQueryVo); 80 | 81 | System.out.println(count); 82 | 83 | 84 | } 85 | 86 | @Test 87 | public void findUserByIdTest() throws Exception{ 88 | SqlSession sqlSession = sqlSessionFactory.openSession(); 89 | UserMapper userMapper = sqlSession.getMapper(UserMapper.class);//生成代理对象userMapper 90 | User user = userMapper.findUserById(16); 91 | System.out.println(user); 92 | } 93 | 94 | @Test 95 | public void findUserByNameTest() throws Exception{ 96 | SqlSession sqlSession = sqlSessionFactory.openSession(); 97 | UserMapper userMapper = sqlSession.getMapper(UserMapper.class); 98 | List userList = userMapper.findUserByName("张小明"); 99 | System.out.println(userList); 100 | } 101 | 102 | @Test 103 | public void findUserBySexTest() throws Exception{ 104 | SqlSession sqlSession = sqlSessionFactory.openSession(); 105 | UserMapper userMapper = sqlSession.getMapper(UserMapper.class); 106 | List userList = userMapper.findUserBySex(1); 107 | System.out.println(userList); 108 | } 109 | 110 | @Test 111 | public void findUserByAddressTest() throws Exception{ 112 | SqlSession sqlSession = sqlSessionFactory.openSession(); 113 | UserMapper userMapper = sqlSession.getMapper(UserMapper.class); 114 | List userList = userMapper.findUserByAddress("江苏镇江"); 115 | System.out.println(userList); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /MyBatis/web/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | -------------------------------------------------------------------------------- /MyBatis/web/index.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: CrowHawk 4 | Date: 17/7/9 5 | Time: 上午10:13 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | 10 | 11 | $Title$ 12 | 13 | 14 | $END$ 15 | 16 | 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SpringMVC+MyBatis学习笔记 2 | 3 | 本仓库代码是笔者在学习SpringMVC+MyBatis框架过程中完成的小Demo,学习的初衷是为了在没有JavaWeb开发基础的情况下尽快完成实验室系主页的搭建,因此本笔记旨在快速上手框架,对底层细节未进行过多探索,适合初学者入门,代码具体内容的描述可参考博客系列文章。 4 | 5 | ## 博客目录 6 | ### MyBatis 7 | + [MyBatis学习笔记(1)——MyBatis介绍](https://crowhawk.github.io/2017/03/23/Mybatis_1/) 8 | + [MyBatis学习笔记(2)——MyBatis入门程序](https://crowhawk.github.io/2017/03/23/Mybatis_2/) 9 | + [MyBatis学习笔记(3)——使用原始方法开发Dao](https://crowhawk.github.io/2017/03/23/Mybatis_3/) 10 | + [MyBatis学习笔记(4)——使用Mapper代理方法开发Dao](https://crowhawk.github.io/2017/03/23/Mybatis_4/) 11 | + [MyBatis学习笔记(5)——输入映射](https://crowhawk.github.io/2017/03/23/Mybatis_5/) 12 | + [MyBatis学习笔记(6)——输出映射](https://crowhawk.github.io/2017/03/23/Mybatis_6/) 13 | + [MyBatis学习笔记(7)——动态SQL](https://crowhawk.github.io/2017/03/23/Mybatis_7/) 14 | + [MyBatis学习笔记(8)——高级映射之一对一映射](https://crowhawk.github.io/2017/03/24/Mybatis_8/) 15 | + [MyBatis学习笔记(9)——高级映射之一对多映射](https://crowhawk.github.io/2017/03/24/Mybatis_9/) 16 | + [MyBatis学习笔记(10)——高级映射之多对多映射](https://crowhawk.github.io/2017/03/24/Mybatis_10/) 17 | ### SpringMVC 18 | + [SpringMVC学习笔记(1)——SpringMVC介绍](https://crowhawk.github.io/2017/04/10/SpringMVC_1/) 19 | + [SpringMVC学习笔记(2)——商品列表查询入门程序](https://crowhawk.github.io/2017/04/10/SpringMVC_2/) 20 | + [SpringMVC学习笔记(3)——Spring+SpringMVC+MyBatis框架整合](https://crowhawk.github.io/2017/04/11/SpringMVC_3/) 21 | + [SpringMVC学习笔记(4)——商品修改功能开发](https://crowhawk.github.io/2017/04/11/SpringMVC_4/) 22 | + [SpringMVC学习笔记(5)——参数绑定](https://crowhawk.github.io/2017/04/11/SpringMVC_5/) 23 | 24 | ## 源码说明 25 | ### 安装运行 26 | + 运行前请新建数据库。源代码中默认数据库名为OrderForm,用户名root,密码wyj,可在配置文件中自行更改。数据库初始化脚本位于[sql](https://github.com/CrowHawk/SpringMVC-MyBatis-Learning/tree/master/sql)中。 27 | + 运行前请先启动TomcatServer 28 | ### 模块 29 | + [MyBatis](https://github.com/CrowHawk/SpringMVC-MyBatis-Learning/tree/master/MyBatis):博客中MyBatis系列文章涉及源码 30 | + [SpringMVC](https://github.com/CrowHawk/SpringMVC-MyBatis-Learning/tree/master/SpringMVC):博客中SpringMVC系列文章前两篇涉及源码 31 | + [springmvc-mybatis-start](https://github.com/CrowHawk/SpringMVC-MyBatis-Learning/tree/master/springmvc-mybatis-start):博客中MyBatis与SpringMVC框架整合代码,覆盖系列文章中几乎所有内容 32 | ## 联系作者 33 | [Personal Website:Crow Home](https://crowhawk.github.io/) 34 | 35 | -------------------------------------------------------------------------------- /SSM.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /SpringMVC/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/SpringMVC/.DS_Store -------------------------------------------------------------------------------- /SpringMVC/SpringMVC.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /SpringMVC/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.crow 8 | SpringMVC 9 | 1.0-SNAPSHOT 10 | war 11 | 12 | 13 | 14 | javax.servlet 15 | javax.servlet-api 16 | 3.1.0 17 | 18 | 19 | javax.servlet.jsp 20 | jsp-api 21 | 2.2 22 | 23 | 24 | javax.servlet 25 | jstl 26 | 1.2 27 | 28 | 29 | org.springframework 30 | spring-webmvc 31 | 4.2.4.RELEASE 32 | 33 | 34 | 35 | 36 | SpringMVC 37 | 38 | 39 | -------------------------------------------------------------------------------- /SpringMVC/src/main/java/com/crow/ssm/controller/ItemsController.java: -------------------------------------------------------------------------------- 1 | package com.crow.ssm.controller; 2 | 3 | 4 | import com.crow.ssm.po.Items; 5 | import org.springframework.web.servlet.ModelAndView; 6 | import org.springframework.web.servlet.mvc.Controller; 7 | 8 | import javax.servlet.http.HttpServletRequest; 9 | import javax.servlet.http.HttpServletResponse; 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | /** 14 | * Created by CrowHawk on 17/3/30. 15 | */ 16 | public class ItemsController implements Controller { 17 | 18 | public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { 19 | //调用service查找数据库,查询商品列表,这里使用静态数据模拟 20 | List itemsList = new ArrayList(); 21 | 22 | //向list中填充静态数据 23 | Items items_1 = new Items(); 24 | items_1.setName("联想笔记本"); 25 | items_1.setPrice(6000f); 26 | items_1.setDetail("X Carbon"); 27 | 28 | Items items_2 = new Items(); 29 | items_2.setName("苹果手机"); 30 | items_2.setPrice(5000f); 31 | items_2.setDetail("iphone7"); 32 | 33 | itemsList.add(items_1); 34 | itemsList.add(items_2); 35 | 36 | //返回ModelAndView 37 | ModelAndView modelAndView = new ModelAndView(); 38 | //相当于request的setAttribute方法,在jsp页面中通过itemsList取数据 39 | modelAndView.addObject("itemsList", itemsList); 40 | 41 | //指定视图 42 | modelAndView.setViewName("/items/itemsList"); 43 | 44 | return modelAndView; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /SpringMVC/src/main/java/com/crow/ssm/controller/ItemsController2.java: -------------------------------------------------------------------------------- 1 | package com.crow.ssm.controller; 2 | 3 | import com.crow.ssm.po.Items; 4 | import org.springframework.web.HttpRequestHandler; 5 | 6 | import javax.servlet.ServletException; 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | import java.io.IOException; 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | /** 14 | * Created by CrowHawk on 17/3/31. 15 | */ 16 | public class ItemsController2 implements HttpRequestHandler { 17 | 18 | public void handleRequest(HttpServletRequest request, 19 | HttpServletResponse response) throws ServletException, IOException { 20 | //调用service查找数据库,查询商品列表,这里使用静态数据模拟 21 | List itemsList = new ArrayList(); 22 | 23 | //向list中填充静态数据 24 | Items items_1 = new Items(); 25 | items_1.setName("联想笔记本"); 26 | items_1.setPrice(6000f); 27 | items_1.setDetail("X Carbon"); 28 | 29 | Items items_2 = new Items(); 30 | items_2.setName("苹果手机"); 31 | items_2.setPrice(5000f); 32 | items_2.setDetail("iphone7"); 33 | 34 | itemsList.add(items_1); 35 | itemsList.add(items_2); 36 | 37 | request.setAttribute("itemsList", itemsList); 38 | request.getRequestDispatcher("/items/itemsList").forward(request,response); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /SpringMVC/src/main/java/com/crow/ssm/controller/ItemsController3.java: -------------------------------------------------------------------------------- 1 | package com.crow.ssm.controller; 2 | 3 | import com.crow.ssm.po.Items; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.servlet.ModelAndView; 7 | 8 | import javax.servlet.http.HttpServletRequest; 9 | import javax.servlet.http.HttpServletResponse; 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | /** 14 | * Created by CrowHawk on 17/3/31. 15 | */ 16 | @Controller 17 | public class ItemsController3 { 18 | 19 | @RequestMapping("/queryItems") 20 | public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { 21 | //调用service查找数据库,查询商品列表,这里使用静态数据模拟 22 | List itemsList = new ArrayList(); 23 | 24 | //向list中填充静态数据 25 | Items items_1 = new Items(); 26 | items_1.setName("联想笔记本"); 27 | items_1.setPrice(6000f); 28 | items_1.setDetail("X Carbon"); 29 | 30 | Items items_2 = new Items(); 31 | items_2.setName("苹果手机"); 32 | items_2.setPrice(5000f); 33 | items_2.setDetail("iphone7"); 34 | 35 | itemsList.add(items_1); 36 | itemsList.add(items_2); 37 | 38 | //返回ModelAndView 39 | ModelAndView modelAndView = new ModelAndView(); 40 | //相当于request的setAttribute方法,在jsp页面中通过itemsList取数据 41 | modelAndView.addObject("itemsList", itemsList); 42 | 43 | //指定视图 44 | modelAndView.setViewName("/items/itemsList"); 45 | 46 | return modelAndView; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /SpringMVC/src/main/java/com/crow/ssm/po/Items.java: -------------------------------------------------------------------------------- 1 | package com.crow.ssm.po; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * Created by CrowHawk on 17/3/30. 7 | */ 8 | public class Items { 9 | private Integer id; 10 | 11 | private String name; 12 | 13 | private Float price; 14 | 15 | private String pic; 16 | 17 | private Date createtime; 18 | 19 | private String detail; 20 | 21 | public Integer getId() { 22 | return id; 23 | } 24 | 25 | public void setId(Integer id) { 26 | this.id = id; 27 | } 28 | 29 | public String getName() { 30 | return name; 31 | } 32 | 33 | public void setName(String name) { 34 | this.name = name == null ? null : name.trim(); 35 | } 36 | 37 | public Float getPrice() { 38 | return price; 39 | } 40 | 41 | public void setPrice(Float price) { 42 | this.price = price; 43 | } 44 | 45 | public String getPic() { 46 | return pic; 47 | } 48 | 49 | public void setPic(String pic) { 50 | this.pic = pic == null ? null : pic.trim(); 51 | } 52 | 53 | public Date getCreatetime() { 54 | return createtime; 55 | } 56 | 57 | public void setCreatetime(Date createtime) { 58 | this.createtime = createtime; 59 | } 60 | 61 | public String getDetail() { 62 | return detail; 63 | } 64 | 65 | public void setDetail(String detail) { 66 | this.detail = detail == null ? null : detail.trim(); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /SpringMVC/src/main/resources/spring/springmvc.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 16 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | itemsController 28 | itemsController2 29 | 30 | 31 | 32 | 33 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /SpringMVC/src/main/webapp/WEB-INF/jsp/items/itemsList.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: CrowHawk 4 | Date: 17/3/30 5 | Time: 下午3:37 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | 9 | <%@ page language="java" contentType="text/html; charset=UTF-8" 10 | pageEncoding="UTF-8" %> 11 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 12 | <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 13 | 14 | 15 | 16 | 17 | 查询商品列表 18 | 19 | 20 |
21 | 查询条件: 22 | 23 | 24 | 25 | 26 |
27 | 商品列表: 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 |
商品名称商品价格生产日期商品描述操作
${item.name }${item.price }${item.detail }修改
49 |
50 | 51 | 52 | -------------------------------------------------------------------------------- /SpringMVC/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | springmvc 10 | org.springframework.web.servlet.DispatcherServlet 11 | 14 | 15 | contextConfigLocation 16 | classpath:/spring/springmvc.xml 17 | 18 | 19 | 20 | 21 | springmvc 22 | 29 | *.action 30 | 31 | -------------------------------------------------------------------------------- /SpringMVC/src/main/webapp/index.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Hello World!

4 | 5 | 6 | -------------------------------------------------------------------------------- /SpringMVC/target/SpringMVC.war: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/SpringMVC/target/SpringMVC.war -------------------------------------------------------------------------------- /SpringMVC/target/SpringMVC/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: CrowHawk 3 | Created-By: IntelliJ IDEA 4 | Build-Jdk: 1.8.0_66 5 | 6 | -------------------------------------------------------------------------------- /SpringMVC/target/SpringMVC/WEB-INF/classes/com/crow/ssm/controller/ItemsController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/SpringMVC/target/SpringMVC/WEB-INF/classes/com/crow/ssm/controller/ItemsController.class -------------------------------------------------------------------------------- /SpringMVC/target/SpringMVC/WEB-INF/classes/com/crow/ssm/controller/ItemsController2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/SpringMVC/target/SpringMVC/WEB-INF/classes/com/crow/ssm/controller/ItemsController2.class -------------------------------------------------------------------------------- /SpringMVC/target/SpringMVC/WEB-INF/classes/com/crow/ssm/controller/ItemsController3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/SpringMVC/target/SpringMVC/WEB-INF/classes/com/crow/ssm/controller/ItemsController3.class -------------------------------------------------------------------------------- /SpringMVC/target/SpringMVC/WEB-INF/classes/com/crow/ssm/po/Items.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/SpringMVC/target/SpringMVC/WEB-INF/classes/com/crow/ssm/po/Items.class -------------------------------------------------------------------------------- /SpringMVC/target/SpringMVC/WEB-INF/classes/spring/springmvc.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 16 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | itemsController 28 | itemsController2 29 | 30 | 31 | 32 | 33 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /SpringMVC/target/SpringMVC/WEB-INF/jsp/items/itemsList.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: CrowHawk 4 | Date: 17/3/30 5 | Time: 下午3:37 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | 9 | <%@ page language="java" contentType="text/html; charset=UTF-8" 10 | pageEncoding="UTF-8" %> 11 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 12 | <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 13 | 14 | 15 | 16 | 17 | 查询商品列表 18 | 19 | 20 |
21 | 查询条件: 22 | 23 | 24 | 25 | 26 |
27 | 商品列表: 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 |
商品名称商品价格生产日期商品描述操作
${item.name }${item.price }${item.detail }修改
49 |
50 | 51 | 52 | -------------------------------------------------------------------------------- /SpringMVC/target/SpringMVC/WEB-INF/lib/aopalliance-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/SpringMVC/target/SpringMVC/WEB-INF/lib/aopalliance-1.0.jar -------------------------------------------------------------------------------- /SpringMVC/target/SpringMVC/WEB-INF/lib/commons-logging-1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/SpringMVC/target/SpringMVC/WEB-INF/lib/commons-logging-1.2.jar -------------------------------------------------------------------------------- /SpringMVC/target/SpringMVC/WEB-INF/lib/javax.servlet-api-3.1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/SpringMVC/target/SpringMVC/WEB-INF/lib/javax.servlet-api-3.1.0.jar -------------------------------------------------------------------------------- /SpringMVC/target/SpringMVC/WEB-INF/lib/jsp-api-2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/SpringMVC/target/SpringMVC/WEB-INF/lib/jsp-api-2.2.jar -------------------------------------------------------------------------------- /SpringMVC/target/SpringMVC/WEB-INF/lib/jstl-1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/SpringMVC/target/SpringMVC/WEB-INF/lib/jstl-1.2.jar -------------------------------------------------------------------------------- /SpringMVC/target/SpringMVC/WEB-INF/lib/spring-aop-4.2.4.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/SpringMVC/target/SpringMVC/WEB-INF/lib/spring-aop-4.2.4.RELEASE.jar -------------------------------------------------------------------------------- /SpringMVC/target/SpringMVC/WEB-INF/lib/spring-beans-4.2.4.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/SpringMVC/target/SpringMVC/WEB-INF/lib/spring-beans-4.2.4.RELEASE.jar -------------------------------------------------------------------------------- /SpringMVC/target/SpringMVC/WEB-INF/lib/spring-context-4.2.4.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/SpringMVC/target/SpringMVC/WEB-INF/lib/spring-context-4.2.4.RELEASE.jar -------------------------------------------------------------------------------- /SpringMVC/target/SpringMVC/WEB-INF/lib/spring-core-4.2.4.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/SpringMVC/target/SpringMVC/WEB-INF/lib/spring-core-4.2.4.RELEASE.jar -------------------------------------------------------------------------------- /SpringMVC/target/SpringMVC/WEB-INF/lib/spring-expression-4.2.4.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/SpringMVC/target/SpringMVC/WEB-INF/lib/spring-expression-4.2.4.RELEASE.jar -------------------------------------------------------------------------------- /SpringMVC/target/SpringMVC/WEB-INF/lib/spring-web-4.2.4.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/SpringMVC/target/SpringMVC/WEB-INF/lib/spring-web-4.2.4.RELEASE.jar -------------------------------------------------------------------------------- /SpringMVC/target/SpringMVC/WEB-INF/lib/spring-webmvc-4.2.4.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/SpringMVC/target/SpringMVC/WEB-INF/lib/spring-webmvc-4.2.4.RELEASE.jar -------------------------------------------------------------------------------- /SpringMVC/target/SpringMVC/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | springmvc 10 | org.springframework.web.servlet.DispatcherServlet 11 | 14 | 15 | contextConfigLocation 16 | classpath:/spring/springmvc.xml 17 | 18 | 19 | 20 | 21 | springmvc 22 | 29 | *.action 30 | 31 | -------------------------------------------------------------------------------- /SpringMVC/target/SpringMVC/index.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Hello World!

4 | 5 | 6 | -------------------------------------------------------------------------------- /SpringMVC/target/classes/com/crow/ssm/controller/ItemsController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/SpringMVC/target/classes/com/crow/ssm/controller/ItemsController.class -------------------------------------------------------------------------------- /SpringMVC/target/classes/com/crow/ssm/controller/ItemsController2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/SpringMVC/target/classes/com/crow/ssm/controller/ItemsController2.class -------------------------------------------------------------------------------- /SpringMVC/target/classes/com/crow/ssm/controller/ItemsController3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/SpringMVC/target/classes/com/crow/ssm/controller/ItemsController3.class -------------------------------------------------------------------------------- /SpringMVC/target/classes/com/crow/ssm/po/Items.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/SpringMVC/target/classes/com/crow/ssm/po/Items.class -------------------------------------------------------------------------------- /SpringMVC/target/classes/spring/springmvc.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 16 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | itemsController 28 | itemsController2 29 | 30 | 31 | 32 | 33 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /SpringMVC/target/maven-archiver/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven 2 | #Sun Apr 09 00:49:57 CST 2017 3 | version=1.0-SNAPSHOT 4 | groupId=com.crow 5 | artifactId=SpringMVC 6 | -------------------------------------------------------------------------------- /SpringMVC/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst: -------------------------------------------------------------------------------- 1 | com/crow/ssm/po/Items.class 2 | com/crow/ssm/controller/ItemsController.class 3 | com/crow/ssm/controller/ItemsController2.class 4 | com/crow/ssm/controller/ItemsController3.class 5 | -------------------------------------------------------------------------------- /SpringMVC/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst: -------------------------------------------------------------------------------- 1 | /Users/CrowHawk/Development/SSM/SpringMVC/src/main/java/com/crow/ssm/po/Items.java 2 | /Users/CrowHawk/Development/SSM/SpringMVC/src/main/java/com/crow/ssm/controller/ItemsController3.java 3 | /Users/CrowHawk/Development/SSM/SpringMVC/src/main/java/com/crow/ssm/controller/ItemsController.java 4 | /Users/CrowHawk/Development/SSM/SpringMVC/src/main/java/com/crow/ssm/controller/ItemsController2.java 5 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/java/com/crow/ssm/controller/JsonTest.java: -------------------------------------------------------------------------------- 1 | package com.crow.ssm.controller; 2 | 3 | import com.crow.ssm.po.ItemsCustom; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.RequestBody; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.ResponseBody; 8 | 9 | /** 10 | * Created by CrowHawk on 17/4/7. 11 | */ 12 | @Controller 13 | public class JsonTest { 14 | 15 | //请求json串(商品信息),输出json(商品信息) 16 | //@RequestBody将请求的商品信息的json串转成itemsCustom对象 17 | //@ResponseBody将itemsCustom转成json输出 18 | @RequestMapping("/requestJson") 19 | public @ResponseBody 20 | ItemsCustom requestJson(@RequestBody ItemsCustom itemsCustom){ 21 | 22 | //@ResponseBody将itemsCustom转成json输出 23 | return itemsCustom; 24 | } 25 | 26 | //请求key/value,输出json 27 | @RequestMapping("/responseJson") 28 | public @ResponseBody ItemsCustom responseJson(ItemsCustom itemsCustom){ 29 | 30 | //@ResponseBody将itemsCustom转成json输出 31 | return itemsCustom; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/java/com/crow/ssm/controller/LoginController.java: -------------------------------------------------------------------------------- 1 | package com.crow.ssm.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | 6 | import javax.servlet.http.HttpSession; 7 | 8 | /** 9 | * Created by CrowHawk on 17/4/7. 10 | */ 11 | @Controller 12 | public class LoginController { 13 | 14 | // 登陆 15 | @RequestMapping("/login") 16 | public String login(HttpSession session, String username, String password) 17 | throws Exception { 18 | 19 | // 调用service进行用户身份验证 20 | // ... 21 | 22 | // 在session中保存用户身份信息 23 | session.setAttribute("username", username); 24 | // 重定向到商品列表页面 25 | return "redirect:/items/queryItems.action"; 26 | } 27 | 28 | // 退出 29 | @RequestMapping("/logout") 30 | public String logout(HttpSession session) throws Exception { 31 | 32 | // 清除session 33 | session.invalidate(); 34 | 35 | // 重定向到商品列表页面 36 | return "redirect:/items/queryItems.action"; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/java/com/crow/ssm/controller/converter/CustomDateConverter.java: -------------------------------------------------------------------------------- 1 | package com.crow.ssm.controller.converter; 2 | 3 | import org.springframework.core.convert.converter.Converter; 4 | 5 | import java.text.ParseException; 6 | import java.text.SimpleDateFormat; 7 | import java.util.Date; 8 | 9 | /** 10 | * Created by CrowHawk on 17/4/7. 11 | */ 12 | public class CustomDateConverter implements Converter { 13 | public Date convert(String s) { 14 | //实现 将日期串转成日期类型(格式是yyyy-MM-dd HH:mm:ss) 15 | 16 | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 17 | 18 | try { 19 | //转成直接返回 20 | return simpleDateFormat.parse(s); 21 | } catch (ParseException e) { 22 | // TODO Auto-generated catch block 23 | e.printStackTrace(); 24 | } 25 | //如果参数绑定失败返回null 26 | return null; 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/java/com/crow/ssm/controller/converter/validation/ValidGroup1.java: -------------------------------------------------------------------------------- 1 | package com.crow.ssm.controller.converter.validation; 2 | 3 | /** 4 | * Created by CrowHawk on 17/4/7. 5 | */ 6 | public interface ValidGroup1 { 7 | //接口中不需要定义任何方法,仅是对不同的校验规则进行分组 8 | //此分组只校验商品名称长度 9 | } 10 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/java/com/crow/ssm/controller/converter/validation/ValidGroup2.java: -------------------------------------------------------------------------------- 1 | package com.crow.ssm.controller.converter.validation; 2 | 3 | /** 4 | * Created by CrowHawk on 17/4/7. 5 | */ 6 | public interface ValidGroup2 { 7 | } 8 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/java/com/crow/ssm/exception/CustomException.java: -------------------------------------------------------------------------------- 1 | package com.crow.ssm.exception; 2 | 3 | /** 4 | * Created by CrowHawk on 17/4/7. 5 | */ 6 | public class CustomException extends Exception{ 7 | //异常信息 8 | public String message; 9 | 10 | public CustomException(String message) { 11 | super(message); 12 | this.message = message; 13 | } 14 | 15 | public String getMessage() { 16 | return message; 17 | } 18 | 19 | public void setMessage(String message) { 20 | this.message = message; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/java/com/crow/ssm/exception/CustomExceptionResolver.java: -------------------------------------------------------------------------------- 1 | package com.crow.ssm.exception; 2 | 3 | import org.springframework.web.servlet.HandlerExceptionResolver; 4 | import org.springframework.web.servlet.ModelAndView; 5 | 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpServletResponse; 8 | 9 | /** 10 | * Created by CrowHawk on 17/4/7. 11 | */ 12 | public class CustomExceptionResolver implements HandlerExceptionResolver { 13 | /** 14 | * @param request 15 | * @param response 16 | * @param handler 17 | * @param ex 系统抛出的异常 18 | * @return 19 | */ 20 | public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) { 21 | //handler就是处理器适配器要执行Handler对象(只有method) 22 | //解析出异常类型 23 | //如果该 异常类型是系统 自定义的异常,直接取出异常信息,在错误页面展示 24 | //String message = null; 25 | //if(ex instanceof CustomException){ 26 | //message = ((CustomException)ex).getMessage(); 27 | //}else{ 28 | ////如果该 异常类型不是系统 自定义的异常,构造一个自定义的异常类型(信息为“未知错误”) 29 | //message="未知错误"; 30 | //} 31 | 32 | //上边代码变为 33 | CustomException customException; 34 | if (ex instanceof CustomException) { 35 | customException = (CustomException) ex; 36 | } else { 37 | customException = new CustomException("未知错误"); 38 | } 39 | 40 | //错误信息 41 | String message = customException.getMessage(); 42 | 43 | ModelAndView modelAndView = new ModelAndView(); 44 | 45 | //将错误信息传到页面 46 | modelAndView.addObject("message", message); 47 | 48 | //指向错误页面 49 | modelAndView.setViewName("error"); 50 | 51 | return modelAndView; 52 | 53 | } 54 | } 55 | 56 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/java/com/crow/ssm/interceptor/HandlerInterceptor1.java: -------------------------------------------------------------------------------- 1 | package com.crow.ssm.interceptor; 2 | 3 | import org.springframework.web.servlet.HandlerInterceptor; 4 | import org.springframework.web.servlet.ModelAndView; 5 | 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpServletResponse; 8 | 9 | /** 10 | * Created by CrowHawk on 17/4/7. 11 | */ 12 | public class HandlerInterceptor1 implements HandlerInterceptor { 13 | //进入 Handler方法之前执行 14 | //用于身份认证、身份授权 15 | //比如身份认证,如果认证通过表示当前用户没有登陆,需要此方法拦截不再向下执行 16 | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { 17 | 18 | System.out.println("HandlerInterceptor1...preHandle"); 19 | 20 | //return false表示拦截,不向下执行 21 | //return true表示放行 22 | return true; 23 | } 24 | 25 | //进入Handler方法之后,返回modelAndView之前执行 26 | //应用场景从modelAndView出发:将公用的模型数据(比如菜单导航)在这里传到视图,也可以在这里统一指定视图 27 | public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) 28 | throws Exception { 29 | System.out.println("HandlerInterceptor1...postHandle"); 30 | } 31 | 32 | //执行Handler完成执行此方法 33 | //应用场景:统一异常处理,统一日志处理 34 | public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { 35 | System.out.println("HandlerInterceptor1...afterCompletion"); 36 | } 37 | } -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/java/com/crow/ssm/interceptor/HandlerInterceptor2.java: -------------------------------------------------------------------------------- 1 | package com.crow.ssm.interceptor; 2 | 3 | import org.springframework.web.servlet.HandlerInterceptor; 4 | import org.springframework.web.servlet.ModelAndView; 5 | 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpServletResponse; 8 | 9 | /** 10 | * Created by CrowHawk on 17/4/7. 11 | */ 12 | public class HandlerInterceptor2 implements HandlerInterceptor { 13 | //进入 Handler方法之前执行 14 | //用于身份认证、身份授权 15 | //比如身份认证,如果认证通过表示当前用户没有登陆,需要此方法拦截不再向下执行 16 | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { 17 | 18 | System.out.println("HandlerInterceptor2...preHandle"); 19 | 20 | //return false表示拦截,不向下执行 21 | //return true表示放行 22 | return true; 23 | } 24 | 25 | //进入Handler方法之后,返回modelAndView之前执行 26 | //应用场景从modelAndView出发:将公用的模型数据(比如菜单导航)在这里传到视图,也可以在这里统一指定视图 27 | public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) 28 | throws Exception { 29 | System.out.println("HandlerInterceptor2...postHandle"); 30 | } 31 | 32 | //执行Handler完成执行此方法 33 | //应用场景:统一异常处理,统一日志处理 34 | public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { 35 | System.out.println("HandlerInterceptor2...afterCompletion"); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/java/com/crow/ssm/interceptor/LoginInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.crow.ssm.interceptor; 2 | 3 | import org.springframework.web.servlet.HandlerInterceptor; 4 | import org.springframework.web.servlet.ModelAndView; 5 | 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpServletResponse; 8 | import javax.servlet.http.HttpSession; 9 | 10 | /** 11 | * Created by CrowHawk on 17/4/7. 12 | */ 13 | public class LoginInterceptor implements HandlerInterceptor { 14 | 15 | //进入 Handler方法之前执行 16 | //用于身份认证、身份授权 17 | //比如身份认证,如果认证通过表示当前用户没有登陆,需要此方法拦截不再向下执行 18 | public boolean preHandle(HttpServletRequest request, 19 | HttpServletResponse response, Object handler) throws Exception { 20 | 21 | //获取请求的url,这里是相对url,如"/ssm1/login.action" 22 | String url = request.getRequestURI(); 23 | //判断url是否是公开 地址(实际使用时将公开 地址配置配置文件中) 24 | //这里公开地址是登陆提交的地址 25 | if (url.indexOf("login.action") >= 0) { 26 | //如果进行登陆提交,放行 27 | return true; 28 | } 29 | 30 | //判断session 31 | HttpSession session = request.getSession(); 32 | //从session中取出用户身份信息 33 | String username = (String) session.getAttribute("username"); 34 | 35 | if (username != null) { 36 | //身份存在,放行 37 | return true; 38 | } 39 | 40 | //执行这里表示用户身份需要认证,跳转登陆页面 41 | request.getRequestDispatcher("/WEB-INF/jsp/login.jsp").forward(request, response); 42 | 43 | //return false表示拦截,不向下执行 44 | //return true表示放行 45 | return false; 46 | } 47 | 48 | //进入Handler方法之后,返回modelAndView之前执行 49 | //应用场景从modelAndView出发:将公用的模型数据(比如菜单导航)在这里传到视图,也可以在这里统一指定视图 50 | public void postHandle(HttpServletRequest request, 51 | HttpServletResponse response, Object handler, 52 | ModelAndView modelAndView) throws Exception { 53 | 54 | System.out.println("LoginInterceptor...postHandle"); 55 | 56 | } 57 | 58 | //执行Handler完成执行此方法 59 | //应用场景:统一异常处理,统一日志处理 60 | public void afterCompletion(HttpServletRequest request, 61 | HttpServletResponse response, Object handler, Exception ex) 62 | throws Exception { 63 | 64 | System.out.println("LoginInterceptor...afterCompletion"); 65 | } 66 | 67 | } -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/java/com/crow/ssm/mapper/ItemsMapper.java: -------------------------------------------------------------------------------- 1 | package com.crow.ssm.mapper; 2 | 3 | import com.crow.ssm.po.Items; 4 | import com.crow.ssm.po.ItemsExample; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by CrowHawk on 17/4/3. 11 | */ 12 | public interface ItemsMapper { 13 | int countByExample(ItemsExample example); 14 | 15 | int deleteByExample(ItemsExample example); 16 | 17 | int deleteByPrimaryKey(Integer id); 18 | 19 | int insert(Items record); 20 | 21 | int insertSelective(Items record); 22 | 23 | List selectByExampleWithBLOBs(ItemsExample example); 24 | 25 | List selectByExample(ItemsExample example); 26 | 27 | Items selectByPrimaryKey(Integer id); 28 | 29 | int updateByExampleSelective(@Param("record") Items record, @Param("example") ItemsExample example); 30 | 31 | int updateByExampleWithBLOBs(@Param("record") Items record, @Param("example") ItemsExample example); 32 | 33 | int updateByExample(@Param("record") Items record, @Param("example") ItemsExample example); 34 | 35 | int updateByPrimaryKeySelective(Items record); 36 | 37 | int updateByPrimaryKeyWithBLOBs(Items record); 38 | 39 | int updateByPrimaryKey(Items record); 40 | } 41 | 42 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/java/com/crow/ssm/mapper/ItemsMapperCustom.java: -------------------------------------------------------------------------------- 1 | package com.crow.ssm.mapper; 2 | 3 | import com.crow.ssm.po.ItemsCustom; 4 | import com.crow.ssm.po.ItemsQueryVo; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Created by CrowHawk on 17/4/3. 10 | */ 11 | public interface ItemsMapperCustom { 12 | //商品查询列表 13 | List findItemsList(ItemsQueryVo itemsQueryVo)throws Exception; 14 | } 15 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/java/com/crow/ssm/mapper/OrderdetailMapper.java: -------------------------------------------------------------------------------- 1 | package com.crow.ssm.mapper; 2 | 3 | import com.crow.ssm.po.Orderdetail; 4 | import com.crow.ssm.po.OrderdetailExample; 5 | import org.apache.ibatis.annotations.Param; 6 | import java.util.List; 7 | 8 | /** 9 | * Created by CrowHawk on 17/4/3. 10 | */ 11 | public interface OrderdetailMapper { 12 | int countByExample(OrderdetailExample example); 13 | 14 | int deleteByExample(OrderdetailExample example); 15 | 16 | int deleteByPrimaryKey(Integer id); 17 | 18 | int insert(Orderdetail record); 19 | 20 | int insertSelective(Orderdetail record); 21 | 22 | List selectByExample(OrderdetailExample example); 23 | 24 | Orderdetail selectByPrimaryKey(Integer id); 25 | 26 | int updateByExampleSelective(@Param("record") Orderdetail record, @Param("example") OrderdetailExample example); 27 | 28 | int updateByExample(@Param("record") Orderdetail record, @Param("example") OrderdetailExample example); 29 | 30 | int updateByPrimaryKeySelective(Orderdetail record); 31 | 32 | int updateByPrimaryKey(Orderdetail record); 33 | } 34 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/java/com/crow/ssm/mapper/OrdersMapper.java: -------------------------------------------------------------------------------- 1 | package com.crow.ssm.mapper; 2 | 3 | import com.crow.ssm.po.Orders; 4 | import com.crow.ssm.po.OrdersExample; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by CrowHawk on 17/4/3. 11 | */ 12 | public interface OrdersMapper { 13 | int countByExample(OrdersExample example); 14 | 15 | int deleteByExample(OrdersExample example); 16 | 17 | int deleteByPrimaryKey(Integer id); 18 | 19 | int insert(Orders record); 20 | 21 | int insertSelective(Orders record); 22 | 23 | List selectByExample(OrdersExample example); 24 | 25 | Orders selectByPrimaryKey(Integer id); 26 | 27 | int updateByExampleSelective(@Param("record") Orders record, @Param("example") OrdersExample example); 28 | 29 | int updateByExample(@Param("record") Orders record, @Param("example") OrdersExample example); 30 | 31 | int updateByPrimaryKeySelective(Orders record); 32 | 33 | int updateByPrimaryKey(Orders record); 34 | } 35 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/java/com/crow/ssm/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.crow.ssm.mapper; 2 | 3 | import com.crow.ssm.po.User; 4 | import com.crow.ssm.po.UserExample; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | 10 | /** 11 | * Created by CrowHawk on 17/4/3. 12 | */ 13 | public interface UserMapper { 14 | int countByExample(UserExample example); 15 | 16 | int deleteByExample(UserExample example); 17 | 18 | int deleteByPrimaryKey(Integer id); 19 | 20 | int insert(User record); 21 | 22 | int insertSelective(User record); 23 | 24 | List selectByExample(UserExample example); 25 | 26 | User selectByPrimaryKey(Integer id); 27 | 28 | int updateByExampleSelective(@Param("record") User record, @Param("example") UserExample example); 29 | 30 | int updateByExample(@Param("record") User record, @Param("example") UserExample example); 31 | 32 | int updateByPrimaryKeySelective(User record); 33 | 34 | int updateByPrimaryKey(User record); 35 | } 36 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/java/com/crow/ssm/po/Items.java: -------------------------------------------------------------------------------- 1 | package com.crow.ssm.po; 2 | 3 | import com.crow.ssm.controller.converter.validation.ValidGroup1; 4 | 5 | import javax.validation.constraints.NotNull; 6 | import javax.validation.constraints.Size; 7 | import java.util.Date; 8 | 9 | public class Items { 10 | private Integer id; 11 | 12 | //校验名称在1到30字符中间 13 | //message是提示校验出错显示的信息 14 | //groups:此校验属于哪个分组,groups可以定义多个分组 15 | @Size(min = 1, max = 30, message = "{items.name.length.error}", groups = {ValidGroup1.class}) 16 | private String name; 17 | 18 | private Float price; 19 | 20 | private String pic; 21 | 22 | //非空校验 23 | @NotNull(message = "{items.createtime.isNUll}") 24 | private Date createtime; 25 | 26 | private String detail; 27 | 28 | public Integer getId() { 29 | return id; 30 | } 31 | 32 | public void setId(Integer id) { 33 | this.id = id; 34 | } 35 | 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name == null ? null : name.trim(); 42 | } 43 | 44 | public Float getPrice() { 45 | return price; 46 | } 47 | 48 | public void setPrice(Float price) { 49 | this.price = price; 50 | } 51 | 52 | public String getPic() { 53 | return pic; 54 | } 55 | 56 | public void setPic(String pic) { 57 | this.pic = pic == null ? null : pic.trim(); 58 | } 59 | 60 | public Date getCreatetime() { 61 | return createtime; 62 | } 63 | 64 | public void setCreatetime(Date createtime) { 65 | this.createtime = createtime; 66 | } 67 | 68 | public String getDetail() { 69 | return detail; 70 | } 71 | 72 | public void setDetail(String detail) { 73 | this.detail = detail == null ? null : detail.trim(); 74 | } 75 | } -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/java/com/crow/ssm/po/ItemsCustom.java: -------------------------------------------------------------------------------- 1 | package com.crow.ssm.po; 2 | 3 | 4 | public class ItemsCustom extends Items { 5 | 6 | //添加商品信息的扩展属性 7 | 8 | } 9 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/java/com/crow/ssm/po/ItemsQueryVo.java: -------------------------------------------------------------------------------- 1 | package com.crow.ssm.po; 2 | 3 | 4 | public class ItemsQueryVo { 5 | 6 | //商品信息 7 | private Items items; 8 | 9 | //为了系统 可扩展性,对原始生成的po进行扩展 10 | private ItemsCustom itemsCustom; 11 | 12 | public Items getItems() { 13 | return items; 14 | } 15 | 16 | public void setItems(Items items) { 17 | this.items = items; 18 | } 19 | 20 | public ItemsCustom getItemsCustom() { 21 | return itemsCustom; 22 | } 23 | 24 | public void setItemsCustom(ItemsCustom itemsCustom) { 25 | this.itemsCustom = itemsCustom; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/java/com/crow/ssm/po/Orderdetail.java: -------------------------------------------------------------------------------- 1 | package com.crow.ssm.po; 2 | 3 | public class Orderdetail { 4 | private Integer id; 5 | 6 | private Integer ordersId; 7 | 8 | private Integer itemsId; 9 | 10 | private Integer itemsNum; 11 | 12 | public Integer getId() { 13 | return id; 14 | } 15 | 16 | public void setId(Integer id) { 17 | this.id = id; 18 | } 19 | 20 | public Integer getOrdersId() { 21 | return ordersId; 22 | } 23 | 24 | public void setOrdersId(Integer ordersId) { 25 | this.ordersId = ordersId; 26 | } 27 | 28 | public Integer getItemsId() { 29 | return itemsId; 30 | } 31 | 32 | public void setItemsId(Integer itemsId) { 33 | this.itemsId = itemsId; 34 | } 35 | 36 | public Integer getItemsNum() { 37 | return itemsNum; 38 | } 39 | 40 | public void setItemsNum(Integer itemsNum) { 41 | this.itemsNum = itemsNum; 42 | } 43 | } -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/java/com/crow/ssm/po/Orders.java: -------------------------------------------------------------------------------- 1 | package com.crow.ssm.po; 2 | 3 | import java.util.Date; 4 | 5 | public class Orders { 6 | private Integer id; 7 | 8 | private Integer userId; 9 | 10 | private String number; 11 | 12 | private Date createtime; 13 | 14 | private String note; 15 | 16 | public Integer getId() { 17 | return id; 18 | } 19 | 20 | public void setId(Integer id) { 21 | this.id = id; 22 | } 23 | 24 | public Integer getUserId() { 25 | return userId; 26 | } 27 | 28 | public void setUserId(Integer userId) { 29 | this.userId = userId; 30 | } 31 | 32 | public String getNumber() { 33 | return number; 34 | } 35 | 36 | public void setNumber(String number) { 37 | this.number = number == null ? null : number.trim(); 38 | } 39 | 40 | public Date getCreatetime() { 41 | return createtime; 42 | } 43 | 44 | public void setCreatetime(Date createtime) { 45 | this.createtime = createtime; 46 | } 47 | 48 | public String getNote() { 49 | return note; 50 | } 51 | 52 | public void setNote(String note) { 53 | this.note = note == null ? null : note.trim(); 54 | } 55 | } -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/java/com/crow/ssm/po/User.java: -------------------------------------------------------------------------------- 1 | package com.crow.ssm.po; 2 | 3 | import java.util.Date; 4 | 5 | public class User { 6 | private Integer id; 7 | 8 | private String username; 9 | 10 | private Date birthday; 11 | 12 | private String sex; 13 | 14 | private String address; 15 | 16 | public Integer getId() { 17 | return id; 18 | } 19 | 20 | public void setId(Integer id) { 21 | this.id = id; 22 | } 23 | 24 | public String getUsername() { 25 | return username; 26 | } 27 | 28 | public void setUsername(String username) { 29 | this.username = username == null ? null : username.trim(); 30 | } 31 | 32 | public Date getBirthday() { 33 | return birthday; 34 | } 35 | 36 | public void setBirthday(Date birthday) { 37 | this.birthday = birthday; 38 | } 39 | 40 | public String getSex() { 41 | return sex; 42 | } 43 | 44 | public void setSex(String sex) { 45 | this.sex = sex == null ? null : sex.trim(); 46 | } 47 | 48 | public String getAddress() { 49 | return address; 50 | } 51 | 52 | public void setAddress(String address) { 53 | this.address = address == null ? null : address.trim(); 54 | } 55 | } -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/java/com/crow/ssm/service/ItemsService.java: -------------------------------------------------------------------------------- 1 | package com.crow.ssm.service; 2 | 3 | import com.crow.ssm.po.ItemsCustom; 4 | import com.crow.ssm.po.ItemsQueryVo; 5 | 6 | import java.util.List; 7 | 8 | 9 | 10 | public interface ItemsService { 11 | 12 | //商品查询列表 13 | List findItemsList(ItemsQueryVo itemsQueryVo) throws Exception; 14 | 15 | //根据id查询商品信息 16 | ItemsCustom findItemsById(Integer id) throws Exception; 17 | 18 | //修改商品信息 19 | void updateItems(Integer id, ItemsCustom itemsCustom) throws Exception; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/java/com/crow/ssm/service/impl/ItemsServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.crow.ssm.service.impl; 2 | 3 | 4 | import com.crow.ssm.mapper.ItemsMapper; 5 | import com.crow.ssm.mapper.ItemsMapperCustom; 6 | import com.crow.ssm.po.Items; 7 | import com.crow.ssm.po.ItemsCustom; 8 | import com.crow.ssm.po.ItemsQueryVo; 9 | import com.crow.ssm.service.ItemsService; 10 | import org.springframework.beans.BeanUtils; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * Created by CrowHawk on 17/4/3. 16 | */ 17 | public class ItemsServiceImpl implements ItemsService{ 18 | 19 | private ItemsMapperCustom itemsMapperCustom; 20 | 21 | 22 | private ItemsMapper itemsMapper; 23 | 24 | public ItemsMapper getItemsMapper() { 25 | return itemsMapper; 26 | } 27 | 28 | public void setItemsMapper(ItemsMapper itemsMapper) { 29 | this.itemsMapper = itemsMapper; 30 | } 31 | 32 | public ItemsMapperCustom getItemsMapperCustom() { 33 | 34 | return itemsMapperCustom; 35 | } 36 | 37 | public void setItemsMapperCustom(ItemsMapperCustom itemsMapperCustom) { 38 | this.itemsMapperCustom = itemsMapperCustom; 39 | } 40 | 41 | public List findItemsList(ItemsQueryVo itemsQueryVo) throws Exception { 42 | return itemsMapperCustom.findItemsList(itemsQueryVo); 43 | } 44 | 45 | public ItemsCustom findItemsById(Integer id) throws Exception { 46 | Items items = itemsMapper.selectByPrimaryKey(id); 47 | /* if (items == null) { 48 | throw new CustomException("修改的商品信息不存在!"); 49 | }*/ 50 | //中间对商品信息进行业务处理 51 | //.... 52 | //返回ItemsCustom 53 | ItemsCustom itemsCustom = null; 54 | //将items的属性值拷贝到itemsCustom 55 | if (items != null) { 56 | itemsCustom = new ItemsCustom(); 57 | BeanUtils.copyProperties(items, itemsCustom); 58 | } 59 | 60 | return itemsCustom; 61 | } 62 | 63 | public void updateItems(Integer id, ItemsCustom itemsCustom) throws Exception { 64 | //添加业务校验,通常在service接口对关键参数进行校验 65 | //校验 id是否为空,如果为空抛出异常 66 | 67 | //更新商品信息使用updateByPrimaryKeyWithBLOBs根据id更新items表中所有字段,包括 大文本类型字段 68 | //updateByPrimaryKeyWithBLOBs要求必须转入id 69 | itemsCustom.setId(id); 70 | itemsMapper.updateByPrimaryKeyWithBLOBs(itemsCustom); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/resources/CustomValidationMessages.properties: -------------------------------------------------------------------------------- 1 | #\u6dfb\u52a0\u6821\u9a8c\u9519\u8bef\u63d0\u4ea4\u4fe1\u606f 2 | items.name.length.error=\u8bf7\u8f93\u51651\u523030\u4e2a\u5b57\u7b26\u7684\u5546\u54c1\u540d\u79f0 3 | items.createtime.isNUll=\u8bf7\u8f93\u5165 \u5546\u54c1\u7684\u751f\u4ea7\u65e5\u671f -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/resources/com/crow/ssm/mapper/ItemsMapperCustom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | items.name LIKE '%${itemsCustom.name}%' 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 28 | 29 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/resources/db.properties: -------------------------------------------------------------------------------- 1 | jdbc.driver=com.mysql.jdbc.Driver 2 | jdbc.url=jdbc:mysql://localhost:3306/OrderForm?characterEncoding=utf-8 3 | jdbc.username=root 4 | jdbc.password=wyj 5 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # Global logging configuration 2 | # 在开发环境下日志级别设置成DEBUG,在生产环境下才设置为ERROR和INFO 3 | log4j.rootLogger=DEBUG, stdout 4 | # MyBatis logging configuration... 5 | log4j.logger.org.mybatis.example.BlogMapper=TRACE 6 | # Console output... 7 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 8 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 9 | log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n 10 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/resources/mybatis/sqlMapConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 19 | 20 | 23 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/resources/spring/applicationContext-dao.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/resources/spring/applicationContext-service.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/resources/spring/applicationContext-transaction.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/resources/spring/springmvc.xml: -------------------------------------------------------------------------------- 1 | 15 | 16 | 20 | 21 | 22 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 40 | 43 | 44 | 45 | 48 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 63 | 64 | 65 | 66 | 67 | 69 | 70 | 71 | 5242880 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/webapp/WEB-INF/jsp/error.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: Brian 4 | Date: 2016/3/4 5 | Time: 10:51 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | 10 | 11 | 错误提示 12 | 13 | 14 | ${message} 15 | 16 | 17 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/webapp/WEB-INF/jsp/items/editItems.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" %> 3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 5 | 6 | 7 | 8 | 9 | 修改商品信息 10 | 11 | 12 | 13 | 14 | 15 | 16 | ${ error.defaultMessage}
17 |
18 |
19 |
20 | 21 | 修改商品信息: 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 35 | 36 | 37 | 38 | 45 | 46 | 47 | 48 | 51 | 52 | 53 | 55 | 56 |
商品名称
商品价格
商品生产日期"/> 34 |
商品图片 39 | 40 | 41 |
42 |
43 | 44 |
商品简介 49 | 50 |
54 |
57 | 58 |
59 | 60 | 61 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/webapp/WEB-INF/jsp/items/editItemsQuery.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" %> 3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 5 | 6 | 7 | 8 | 9 | 查询商品列表 10 | 22 | 23 | 24 |
25 | 查询条件: 26 | 27 | 28 | 29 | 33 | 34 |
商品名称: 30 | 31 | 32 |
35 | 商品列表: 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 51 | 52 | 53 | 54 | 55 | 56 |
商品名称商品价格生产日期商品描述操作
"/>
57 |
58 | 59 | 60 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/webapp/WEB-INF/jsp/items/itemsList.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" %> 3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 5 | 6 | 7 | 8 | 9 | 查询商品列表 10 | 22 | 23 | 24 | 当前用户:${username }, 25 | 26 | 退出 27 | 28 |
29 | 查询条件: 30 | 31 | 32 | 41 | 45 | 46 |
33 | 商品名称: 34 | 商品类型: 35 | 40 | 42 | 43 | 44 |
47 | 商品列表: 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
选择商品名称商品价格生产日期商品描述操作
${item.name }${item.price }${item.detail }修改
71 |
72 | 73 | 74 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/webapp/WEB-INF/jsp/login.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: brian 4 | Date: 2016/3/8 5 | Time: 0:13 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | 10 | 11 | 系统登陆 12 | 13 | 14 |
15 | 用户账号:
16 | 用户密码 :
17 | 18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/webapp/WEB-INF/jsp/success.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: Brian 4 | Date: 2016/3/4 5 | Time: 10:51 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | 10 | 11 | 成功提示 12 | 13 | 14 | 操作成功! 15 | 16 | 17 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | ssm 7 | 8 | 9 | contextConfigLocation 10 | classpath:spring/applicationContext-*.xml 11 | 12 | 13 | 14 | org.springframework.web.context.ContextLoaderListener 15 | 16 | 17 | 18 | 19 | springmvc 20 | org.springframework.web.servlet.DispatcherServlet 21 | 24 | 25 | contextConfigLocation 26 | classpath:spring/springmvc.xml 27 | 28 | 29 | 30 | 31 | springmvc 32 | 39 | *.action 40 | 41 | 42 | 43 | 44 | springmvc_rest 45 | org.springframework.web.servlet.DispatcherServlet 46 | 47 | 48 | contextConfigLocation 49 | classpath:spring/springmvc.xml 50 | 51 | 52 | 53 | 54 | springmvc_rest 55 | / 56 | 57 | 58 | 59 | 60 | CharacterEncodingFilter 61 | org.springframework.web.filter.CharacterEncodingFilter 62 | 63 | encoding 64 | utf-8 65 | 66 | 67 | 68 | CharacterEncodingFilter 69 | /* 70 | 71 | 72 | 73 | index.html 74 | index.htm 75 | index.jsp 76 | default.html 77 | default.htm 78 | default.jsp 79 | 80 | 81 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/webapp/index.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Hello World!

4 | 5 | 6 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/src/main/webapp/jsonTest.jsp: -------------------------------------------------------------------------------- 1 | jquery-1.4.4.min.js<%-- 2 | Created by IntelliJ IDEA. 3 | User: brian 4 | Date: 2016/3/7 5 | Time: 20:49 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | 10 | 11 | 12 | json交互测试 13 | 14 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/CustomValidationMessages.properties: -------------------------------------------------------------------------------- 1 | #\u6dfb\u52a0\u6821\u9a8c\u9519\u8bef\u63d0\u4ea4\u4fe1\u606f 2 | items.name.length.error=\u8bf7\u8f93\u51651\u523030\u4e2a\u5b57\u7b26\u7684\u5546\u54c1\u540d\u79f0 3 | items.createtime.isNUll=\u8bf7\u8f93\u5165 \u5546\u54c1\u7684\u751f\u4ea7\u65e5\u671f -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/controller/ItemsController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/controller/ItemsController.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/controller/JsonTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/controller/JsonTest.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/controller/LoginController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/controller/LoginController.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/controller/converter/CustomDateConverter.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/controller/converter/CustomDateConverter.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/controller/converter/validation/ValidGroup1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/controller/converter/validation/ValidGroup1.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/controller/converter/validation/ValidGroup2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/controller/converter/validation/ValidGroup2.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/exception/CustomException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/exception/CustomException.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/exception/CustomExceptionResolver.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/exception/CustomExceptionResolver.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/interceptor/HandlerInterceptor1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/interceptor/HandlerInterceptor1.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/interceptor/HandlerInterceptor2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/interceptor/HandlerInterceptor2.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/interceptor/LoginInterceptor.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/interceptor/LoginInterceptor.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/mapper/ItemsMapper.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/mapper/ItemsMapper.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/mapper/ItemsMapperCustom.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/mapper/ItemsMapperCustom.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/mapper/ItemsMapperCustom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | items.name LIKE '%${itemsCustom.name}%' 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 28 | 29 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/mapper/OrderdetailMapper.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/mapper/OrderdetailMapper.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/mapper/OrdersMapper.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/mapper/OrdersMapper.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/mapper/UserMapper.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/mapper/UserMapper.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/po/Items.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/po/Items.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/po/ItemsCustom.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/po/ItemsCustom.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/po/ItemsExample$Criteria.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/po/ItemsExample$Criteria.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/po/ItemsExample$Criterion.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/po/ItemsExample$Criterion.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/po/ItemsExample$GeneratedCriteria.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/po/ItemsExample$GeneratedCriteria.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/po/ItemsExample.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/po/ItemsExample.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/po/ItemsQueryVo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/po/ItemsQueryVo.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/po/Orderdetail.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/po/Orderdetail.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/po/OrderdetailExample$Criteria.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/po/OrderdetailExample$Criteria.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/po/OrderdetailExample$Criterion.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/po/OrderdetailExample$Criterion.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/po/OrderdetailExample$GeneratedCriteria.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/po/OrderdetailExample$GeneratedCriteria.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/po/OrderdetailExample.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/po/OrderdetailExample.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/po/Orders.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/po/Orders.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/po/OrdersExample$Criteria.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/po/OrdersExample$Criteria.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/po/OrdersExample$Criterion.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/po/OrdersExample$Criterion.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/po/OrdersExample$GeneratedCriteria.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/po/OrdersExample$GeneratedCriteria.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/po/OrdersExample.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/po/OrdersExample.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/po/User.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/po/User.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/po/UserExample$Criteria.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/po/UserExample$Criteria.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/po/UserExample$Criterion.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/po/UserExample$Criterion.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/po/UserExample$GeneratedCriteria.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/po/UserExample$GeneratedCriteria.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/po/UserExample.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/po/UserExample.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/service/ItemsService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/service/ItemsService.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/com/crow/ssm/service/impl/ItemsServiceImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/classes/com/crow/ssm/service/impl/ItemsServiceImpl.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/db.properties: -------------------------------------------------------------------------------- 1 | jdbc.driver=com.mysql.jdbc.Driver 2 | jdbc.url=jdbc:mysql://localhost:3306/OrderForm?characterEncoding=utf-8 3 | jdbc.username=root 4 | jdbc.password=wyj 5 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/log4j.properties: -------------------------------------------------------------------------------- 1 | # Global logging configuration 2 | # 在开发环境下日志级别设置成DEBUG,在生产环境下才设置为ERROR和INFO 3 | log4j.rootLogger=DEBUG, stdout 4 | # MyBatis logging configuration... 5 | log4j.logger.org.mybatis.example.BlogMapper=TRACE 6 | # Console output... 7 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 8 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 9 | log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n 10 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/mybatis/sqlMapConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 19 | 20 | 23 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/spring/applicationContext-dao.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/spring/applicationContext-service.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/spring/applicationContext-transaction.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/classes/spring/springmvc.xml: -------------------------------------------------------------------------------- 1 | 15 | 16 | 19 | 20 | 21 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 39 | 42 | 43 | 44 | 47 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 62 | 63 | 64 | 65 | 66 | 68 | 69 | 70 | 5242880 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: CrowHawk 3 | Created-By: IntelliJ IDEA 4 | Build-Jdk: 1.8.0_66 5 | 6 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/CustomValidationMessages.properties: -------------------------------------------------------------------------------- 1 | #\u6dfb\u52a0\u6821\u9a8c\u9519\u8bef\u63d0\u4ea4\u4fe1\u606f 2 | items.name.length.error=\u8bf7\u8f93\u51651\u523030\u4e2a\u5b57\u7b26\u7684\u5546\u54c1\u540d\u79f0 3 | items.createtime.isNUll=\u8bf7\u8f93\u5165 \u5546\u54c1\u7684\u751f\u4ea7\u65e5\u671f -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/controller/ItemsController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/controller/ItemsController.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/controller/JsonTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/controller/JsonTest.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/controller/LoginController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/controller/LoginController.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/controller/converter/CustomDateConverter.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/controller/converter/CustomDateConverter.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/controller/converter/validation/ValidGroup1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/controller/converter/validation/ValidGroup1.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/controller/converter/validation/ValidGroup2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/controller/converter/validation/ValidGroup2.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/exception/CustomException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/exception/CustomException.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/exception/CustomExceptionResolver.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/exception/CustomExceptionResolver.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/interceptor/HandlerInterceptor1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/interceptor/HandlerInterceptor1.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/interceptor/HandlerInterceptor2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/interceptor/HandlerInterceptor2.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/interceptor/LoginInterceptor.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/interceptor/LoginInterceptor.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/mapper/ItemsMapper.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/mapper/ItemsMapper.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/mapper/ItemsMapperCustom.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/mapper/ItemsMapperCustom.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/mapper/ItemsMapperCustom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | items.name LIKE '%${itemsCustom.name}%' 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 28 | 29 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/mapper/OrderdetailMapper.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/mapper/OrderdetailMapper.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/mapper/OrdersMapper.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/mapper/OrdersMapper.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/mapper/UserMapper.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/mapper/UserMapper.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/Items.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/Items.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/ItemsCustom.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/ItemsCustom.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/ItemsExample$Criteria.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/ItemsExample$Criteria.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/ItemsExample$Criterion.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/ItemsExample$Criterion.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/ItemsExample$GeneratedCriteria.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/ItemsExample$GeneratedCriteria.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/ItemsExample.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/ItemsExample.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/ItemsQueryVo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/ItemsQueryVo.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/Orderdetail.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/Orderdetail.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/OrderdetailExample$Criteria.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/OrderdetailExample$Criteria.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/OrderdetailExample$Criterion.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/OrderdetailExample$Criterion.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/OrderdetailExample$GeneratedCriteria.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/OrderdetailExample$GeneratedCriteria.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/OrderdetailExample.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/OrderdetailExample.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/Orders.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/Orders.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/OrdersExample$Criteria.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/OrdersExample$Criteria.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/OrdersExample$Criterion.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/OrdersExample$Criterion.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/OrdersExample$GeneratedCriteria.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/OrdersExample$GeneratedCriteria.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/OrdersExample.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/OrdersExample.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/User.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/User.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/UserExample$Criteria.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/UserExample$Criteria.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/UserExample$Criterion.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/UserExample$Criterion.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/UserExample$GeneratedCriteria.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/UserExample$GeneratedCriteria.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/UserExample.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/po/UserExample.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/service/ItemsService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/service/ItemsService.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/service/impl/ItemsServiceImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/com/crow/ssm/service/impl/ItemsServiceImpl.class -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/db.properties: -------------------------------------------------------------------------------- 1 | jdbc.driver=com.mysql.jdbc.Driver 2 | jdbc.url=jdbc:mysql://localhost:3306/OrderForm?characterEncoding=utf-8 3 | jdbc.username=root 4 | jdbc.password=wyj 5 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/log4j.properties: -------------------------------------------------------------------------------- 1 | # Global logging configuration 2 | # 在开发环境下日志级别设置成DEBUG,在生产环境下才设置为ERROR和INFO 3 | log4j.rootLogger=DEBUG, stdout 4 | # MyBatis logging configuration... 5 | log4j.logger.org.mybatis.example.BlogMapper=TRACE 6 | # Console output... 7 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 8 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 9 | log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n 10 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/mybatis/sqlMapConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 19 | 20 | 23 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/spring/applicationContext-dao.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/spring/applicationContext-service.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/spring/applicationContext-transaction.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/classes/spring/springmvc.xml: -------------------------------------------------------------------------------- 1 | 15 | 16 | 19 | 20 | 21 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 39 | 42 | 43 | 44 | 47 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 62 | 63 | 64 | 65 | 66 | 68 | 69 | 70 | 5242880 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/jsp/error.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: Brian 4 | Date: 2016/3/4 5 | Time: 10:51 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | 10 | 11 | 错误提示 12 | 13 | 14 | ${message} 15 | 16 | 17 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/jsp/items/editItems.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" %> 3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 5 | 6 | 7 | 8 | 9 | 修改商品信息 10 | 11 | 12 | 13 | 14 | 15 | 16 | ${ error.defaultMessage}
17 |
18 |
19 |
20 | 21 | 修改商品信息: 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 35 | 36 | 37 | 38 | 45 | 46 | 47 | 48 | 51 | 52 | 53 | 55 | 56 |
商品名称
商品价格
商品生产日期"/> 34 |
商品图片 39 | 40 | 41 |
42 |
43 | 44 |
商品简介 49 | 50 |
54 |
57 | 58 |
59 | 60 | 61 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/jsp/items/editItemsQuery.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" %> 3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 5 | 6 | 7 | 8 | 9 | 查询商品列表 10 | 22 | 23 | 24 |
25 | 查询条件: 26 | 27 | 28 | 29 | 33 | 34 |
商品名称: 30 | 31 | 32 |
35 | 商品列表: 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 51 | 52 | 53 | 54 | 55 | 56 |
商品名称商品价格生产日期商品描述操作
"/>
57 |
58 | 59 | 60 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/jsp/items/itemsList.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" %> 3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 5 | 6 | 7 | 8 | 9 | 查询商品列表 10 | 22 | 23 | 24 | 当前用户:${username }, 25 | 26 | 退出 27 | 28 |
29 | 查询条件: 30 | 31 | 32 | 41 | 45 | 46 |
33 | 商品名称: 34 | 商品类型: 35 | 40 | 42 | 43 | 44 |
47 | 商品列表: 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
选择商品名称商品价格生产日期商品描述操作
${item.name }${item.price }${item.detail }修改
71 |
72 | 73 | 74 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/jsp/login.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: brian 4 | Date: 2016/3/8 5 | Time: 0:13 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | 10 | 11 | 系统登陆 12 | 13 | 14 |
15 | 用户账号:
16 | 用户密码 :
17 | 18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/jsp/success.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: Brian 4 | Date: 2016/3/4 5 | Time: 10:51 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | 10 | 11 | 成功提示 12 | 13 | 14 | 操作成功! 15 | 16 | 17 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/aopalliance-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/aopalliance-1.0.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/aspectjweaver-1.8.7.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/aspectjweaver-1.8.7.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/classmate-1.1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/classmate-1.1.0.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/commons-dbcp-1.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/commons-dbcp-1.4.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/commons-fileupload-1.3.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/commons-fileupload-1.3.1.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/commons-io-2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/commons-io-2.2.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/commons-logging-1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/commons-logging-1.2.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/commons-pool-1.5.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/commons-pool-1.5.4.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/hibernate-validator-5.2.4.Final.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/hibernate-validator-5.2.4.Final.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/jackson-annotations-2.7.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/jackson-annotations-2.7.0.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/jackson-core-2.7.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/jackson-core-2.7.2.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/jackson-core-asl-1.9.13.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/jackson-core-asl-1.9.13.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/jackson-databind-2.7.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/jackson-databind-2.7.2.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/jackson-mapper-asl-1.9.13.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/jackson-mapper-asl-1.9.13.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/javax.servlet-api-3.1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/javax.servlet-api-3.1.0.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/jboss-logging-3.2.1.Final.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/jboss-logging-3.2.1.Final.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/jsp-api-2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/jsp-api-2.2.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/jstl-1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/jstl-1.2.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/log4j-1.2.17.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/log4j-1.2.17.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/mybatis-3.3.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/mybatis-3.3.1.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/mybatis-spring-1.2.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/mybatis-spring-1.2.4.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/mysql-connector-java-5.1.38.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/mysql-connector-java-5.1.38.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/slf4j-api-1.7.18.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/slf4j-api-1.7.18.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/spring-aop-4.2.4.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/spring-aop-4.2.4.RELEASE.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/spring-aspects-4.2.4.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/spring-aspects-4.2.4.RELEASE.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/spring-beans-4.2.4.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/spring-beans-4.2.4.RELEASE.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/spring-context-4.2.4.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/spring-context-4.2.4.RELEASE.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/spring-core-4.2.4.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/spring-core-4.2.4.RELEASE.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/spring-expression-4.2.4.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/spring-expression-4.2.4.RELEASE.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/spring-jdbc-4.2.4.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/spring-jdbc-4.2.4.RELEASE.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/spring-orm-4.2.4.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/spring-orm-4.2.4.RELEASE.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/spring-test-4.2.4.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/spring-test-4.2.4.RELEASE.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/spring-tx-4.2.4.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/spring-tx-4.2.4.RELEASE.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/spring-web-4.2.4.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/spring-web-4.2.4.RELEASE.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/spring-webmvc-4.2.4.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/spring-webmvc-4.2.4.RELEASE.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/standard-1.1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/standard-1.1.2.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/validation-api-1.1.0.Final.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianshb/SpringMVC-MyBatis-Learning/052aac3723f3170dcdc19f1e93cc90770fa09efa/springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/lib/validation-api-1.1.0.Final.jar -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | ssm 7 | 8 | 9 | contextConfigLocation 10 | classpath:spring/applicationContext-*.xml 11 | 12 | 13 | 14 | org.springframework.web.context.ContextLoaderListener 15 | 16 | 17 | 18 | 19 | springmvc 20 | org.springframework.web.servlet.DispatcherServlet 21 | 24 | 25 | contextConfigLocation 26 | classpath:spring/springmvc.xml 27 | 28 | 29 | 30 | 31 | springmvc 32 | 39 | *.action 40 | 41 | 42 | 43 | 44 | springmvc_rest 45 | org.springframework.web.servlet.DispatcherServlet 46 | 47 | 48 | contextConfigLocation 49 | classpath:spring/springmvc.xml 50 | 51 | 52 | 53 | 54 | springmvc_rest 55 | / 56 | 57 | 58 | 59 | 60 | CharacterEncodingFilter 61 | org.springframework.web.filter.CharacterEncodingFilter 62 | 63 | encoding 64 | utf-8 65 | 66 | 67 | 68 | CharacterEncodingFilter 69 | /* 70 | 71 | 72 | 73 | index.html 74 | index.htm 75 | index.jsp 76 | default.html 77 | default.htm 78 | default.jsp 79 | 80 | 81 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/index.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Hello World!

4 | 5 | 6 | -------------------------------------------------------------------------------- /springmvc-mybatis-start/target/springmvc-mybatis-start-1.0-SNAPSHOT/jsonTest.jsp: -------------------------------------------------------------------------------- 1 | jquery-1.4.4.min.js<%-- 2 | Created by IntelliJ IDEA. 3 | User: brian 4 | Date: 2016/3/7 5 | Time: 20:49 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | 10 | 11 | 12 | json交互测试 13 | 14 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /sql/create.sql: -------------------------------------------------------------------------------- 1 | /* 2 | SQLyog v10.2 3 | MySQL - 5.1.72-community : Database - mybatis 4 | ********************************************************************* 5 | */ 6 | 7 | 8 | /*!40101 SET NAMES utf8 */; 9 | 10 | /*!40101 SET SQL_MODE=''*/; 11 | 12 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 13 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 14 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 15 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 16 | /*Table structure for table `items` */ 17 | 18 | CREATE TABLE `items` ( 19 | `id` int(11) NOT NULL AUTO_INCREMENT, 20 | `name` varchar(32) NOT NULL COMMENT '商品名称', 21 | `price` float(10,1) NOT NULL COMMENT '商品定价', 22 | `detail` text COMMENT '商品描述', 23 | `pic` varchar(64) DEFAULT NULL COMMENT '商品图片', 24 | `createtime` datetime NOT NULL COMMENT '生产日期', 25 | PRIMARY KEY (`id`) 26 | ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; 27 | 28 | /*Table structure for table `orderdetail` */ 29 | 30 | CREATE TABLE `orderdetail` ( 31 | `id` int(11) NOT NULL AUTO_INCREMENT, 32 | `orders_id` int(11) NOT NULL COMMENT '订单id', 33 | `items_id` int(11) NOT NULL COMMENT '商品id', 34 | `items_num` int(11) DEFAULT NULL COMMENT '商品购买数量', 35 | PRIMARY KEY (`id`), 36 | KEY `FK_orderdetail_1` (`orders_id`), 37 | KEY `FK_orderdetail_2` (`items_id`), 38 | CONSTRAINT `FK_orderdetail_1` FOREIGN KEY (`orders_id`) REFERENCES `orders` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, 39 | CONSTRAINT `FK_orderdetail_2` FOREIGN KEY (`items_id`) REFERENCES `items` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION 40 | ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; 41 | 42 | /*Table structure for table `orders` */ 43 | 44 | CREATE TABLE `orders` ( 45 | `id` int(11) NOT NULL AUTO_INCREMENT, 46 | `user_id` int(11) NOT NULL COMMENT '下单用户id', 47 | `number` varchar(32) NOT NULL COMMENT '订单号', 48 | `createtime` datetime NOT NULL COMMENT '创建订单时间', 49 | `note` varchar(100) DEFAULT NULL COMMENT '备注', 50 | PRIMARY KEY (`id`), 51 | KEY `FK_orders_1` (`user_id`), 52 | CONSTRAINT `FK_orders_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION 53 | ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; 54 | 55 | /*Table structure for table `user` */ 56 | 57 | CREATE TABLE `user` ( 58 | `id` int(11) NOT NULL AUTO_INCREMENT, 59 | `username` varchar(32) NOT NULL COMMENT '用户名称', 60 | `birthday` date DEFAULT NULL COMMENT '生日', 61 | `sex` char(1) DEFAULT NULL COMMENT '性别', 62 | `address` varchar(256) DEFAULT NULL COMMENT '地址', 63 | PRIMARY KEY (`id`) 64 | ) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8; 65 | 66 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 67 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 68 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 69 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -------------------------------------------------------------------------------- /sql/data.sql: -------------------------------------------------------------------------------- 1 | /* 2 | SQLyog v10.2 3 | MySQL - 5.1.72-community : Database - mybatis 4 | ********************************************************************* 5 | */ 6 | 7 | 8 | /*!40101 SET NAMES utf8 */; 9 | 10 | /*!40101 SET SQL_MODE=''*/; 11 | 12 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 13 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 14 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 15 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 16 | /*Data for the table `items` */ 17 | 18 | insert into `items`(`id`,`name`,`price`,`detail`,`pic`,`createtime`) values (1,'台式机',3000.0,'该电脑质量非常好!!!!',NULL,'2015-02-03 13:22:53'),(2,'笔记本',6000.0,'笔记本性能好,质量好!!!!!',NULL,'2015-02-09 13:22:57'),(3,'背包',200.0,'名牌背包,容量大质量好!!!!',NULL,'2015-02-06 13:23:02'); 19 | 20 | /*Data for the table `orderdetail` */ 21 | 22 | insert into `orderdetail`(`id`,`orders_id`,`items_id`,`items_num`) values (1,3,1,1),(2,3,2,3),(3,4,3,4),(4,4,2,3); 23 | 24 | /*Data for the table `orders` */ 25 | 26 | insert into `orders`(`id`,`user_id`,`number`,`createtime`,`note`) values (3,1,'1000010','2015-02-04 13:22:35',NULL),(4,1,'1000011','2015-02-03 13:22:41',NULL),(5,10,'1000012','2015-02-12 16:13:23',NULL); 27 | 28 | /*Data for the table `user` */ 29 | 30 | insert into `user`(`id`,`username`,`birthday`,`sex`,`address`) values (1,'王五',NULL,'2',NULL),(10,'张三','2014-07-10','1','北京市'),(16,'张小明',NULL,'1','河南郑州'),(22,'陈小明',NULL,'1','河南郑州'),(24,'张三丰',NULL,'1','河南郑州'),(25,'陈小明',NULL,'1','河南郑州'),(26,'王五',NULL,NULL,NULL); 31 | 32 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 33 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 34 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 35 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --------------------------------------------------------------------------------