创建MyBatis工程
一、分析接口式编程的原理
1、将映射文件配置到全局配置文件中
2、将获取到的结果集进行封装
二、MySQL数据库表创建
1、创建名为 mybatis_dba 的数据库
2、执行sql语句
或者将以下代码,打包成 mybatis_dba.sql 文件并运行
/*
Navicat MySQL Data Transfer
Source Server : localhost
Source Server Version : 80020
Source Host : localhost:3306
Source Database : mybatis_dba
Target Server Type : MYSQL
Target Server Version : 80020
File Encoding : 65001
Date: 2021-04-14 00:02:13
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for tb1_employee
-- ----------------------------
DROP TABLE IF EXISTS `tb1_employee`;
CREATE TABLE `tb1_employee` (
`id` int NOT NULL AUTO_INCREMENT,
`last_name` varchar(255) DEFAULT NULL,
`gender` char(1) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of tb1_employee
-- ----------------------------
INSERT INTO `tb1_employee` VALUES ('3', 'jerry', '0', '[email protected],');
INSERT INTO `tb1_employee` VALUES ('4', 'jerry', '1', '[email protected]');
三、创建项目
1、创建Maven项目