MyBatis框架

MyBatis第一步创建Maven

不用模板

 

 

 

 修改id软件的添加maven插件

 

 添加依赖

 

 其中所有内容改为


复制代码
 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <project xmlns="http://maven.apache.org/POM/4.0.0"
 3          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 4          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 5     <modelVersion>4.0.0</modelVersion>
 6 
 7     <groupId>com.itheima</groupId>
 8     <artifactId>mybatistest</artifactId>
 9     <version>1.0-SNAPSHOT</version>
10 
11     <dependencies>
12         <dependency>
13             <groupId>org.mybatis</groupId>
14             <artifactId>mybatis</artifactId>
15             <version>3.5.2</version>
16         </dependency>
17         <dependency>
18             <groupId>mysql</groupId>
19             <artifactId>mysql-connector-java</artifactId>
20             <version>8.0.11</version>
21         </dependency>
22         <dependency>
23             <groupId>junit</groupId>
24             <artifactId>junit</artifactId>
25             <version>4.12</version>
26             <!--               <scope>test</scope>-->
27             <scope>compile</scope>
28         </dependency>
29     </dependencies>
30     <build>
31         <resources>
32             <resource>
33                 <directory>src/main/java</directory>
34                 <includes>
35                     <include>**/*.properties</include>
36                     <include>**/*.xml</include>
37                 </includes>
38                 <filtering>true</filtering>
39             </resource>
40         </resources>
41     </build>
42 
43 </project>
复制代码

之后打开Navicat for MySQL
新建连接
name:xxx
密码:1234

右键空白区域新建数据库 数据库名mybatis 字符集utf8 utf-8 排序规则utf8_general
再选择查询→新建查询

 

 查询代码

use mybatis;
create table users(
uid int primary key auto_increment,
uname varchar(20) not null,
uage int not null
);
insert into users(uid,uname,uage) values(null,'张三',20),(null,'李四',18);

 

posted @   Tokaitei32  阅读(14)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
点击右上角即可分享
微信分享提示