首页 > 其他分享 >MyBatis框架

MyBatis框架

时间:2023-02-27 12:12:53浏览次数:28  
标签:20 框架 uname 查询 mybatis MyBatis null

MyBatis第一步创建Maven

不用模板

 

 

 

 修改id软件的

 

 添加依赖

 

 其中所有内容改为



 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);

 

 

 

 

 

标签:20,框架,uname,查询,mybatis,MyBatis,null
From: https://www.cnblogs.com/TokaiTeio32/p/17159124.html

相关文章

  • Mybatis参数传递
    一、多个参数以后接口参数是多个时,在每个参数上都使用@Param注解。这样代码的可读性更高。二、单个参数POJO类型:直接使用。要求属性名和参数占位符名称一致。M......
  • 【MyBatis】配置Mybatis项目
    一、maven中添加依赖1<dependencies>2<dependency>3<groupId>org.mybatis</groupId>4<artifactId>mybatis</artifactId>5......
  • Mybatis增删改查
    基本增删改查增第一步在mapper接口中加入方法packagecom.mapper;publicinterfaceUserMapper{//表--实体类mapper接口--映射文件intinsertUser();/......
  • mybatis-关联查询2-多对一关联查询
          或者多表单独查询方式 ......
  • slate源码解析(二)- 基本框架与数据模型
    源码架构首先来看下最核心的slate包下的目录:可以看到,作为一个开源富文本库,其源码是相当之少。在第一篇文章中说过,Slate没有任何开箱即用的功能,只提供给开发者用于构建富......
  • 一文搞懂java日志框架
    发展历史总结标准接口实现产品JCLlog4j、julSlf4jlogbacklog4j-api(log4j2)log4j-core(log4j2)发展System.out最早最简单的打印方式,不可配置日......
  • mybatis-plus 时间查询
    QueryWrapperuserquery=newQueryWrapper<>();user.and(true,wrapper->wrapper.ge("CREATE_DATE",begin)).and(true,wrapper->wrapper.le("CREATE_DATE",end))beg......
  • 登峰造极,师出造化,Pytorch人工智能AI图像增强框架ControlNet绘画实践,基于Python3.10
    人工智能太疯狂,传统劳动力和内容创作平台被AI枪毙,弃尸尘埃。并非空穴来风,也不是危言耸听,人工智能AI图像增强框架ControlNet正在疯狂地改写绘画艺术的发展进程,你问我绘画行......
  • Mybatis
    项目中常用对于日期java中日期属性使用String类型也可以插入Msyql 打印sql语句插件mybatislogfree需开启设置    插入单条插入<insertid="c......
  • scrapy框架图片爬取案例——以堆糖网为例
    本节主要分享的是scrapy框架中关于图片类的简单爬取方法,在这里只需要用到三个文件:1.setting.py进行scrapy抓取图片所用到的基础。2.duitang_spider.py实现获取多出url进......