From ad2364307d2a8b3da9d9a420c60ec6dfbcabb453 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B7=AF=E7=8E=B2?= <1516489926@qq.com>
Date: Tue, 19 Dec 2023 22:04:02 +0800
Subject: [PATCH 1/3] maven
---
...en\347\232\204\351\205\215\347\275\256.md" | 33 +++++++++++++++++++
1 file changed, 33 insertions(+)
create mode 100644 "29 \350\267\257\347\216\262/20231219 Maven\347\232\204\351\205\215\347\275\256.md"
diff --git "a/29 \350\267\257\347\216\262/20231219 Maven\347\232\204\351\205\215\347\275\256.md" "b/29 \350\267\257\347\216\262/20231219 Maven\347\232\204\351\205\215\347\275\256.md"
new file mode 100644
index 0000000..d9da269
--- /dev/null
+++ "b/29 \350\267\257\347\216\262/20231219 Maven\347\232\204\351\205\215\347\275\256.md"
@@ -0,0 +1,33 @@
+Maven是专门用于管理和构建Java项目的工具,它的主要功能有:
+
+提供了一套标准化的项目结构
+
+提供了一套标准化的构建流程(编译,测试,打包,发布……)
+
+提供了一套依赖管理机制
+
+
+
+**1.4.2 Maven** **坐标详解**
+
+**什么是坐标?**
+
+Maven 中的坐标是==资源的唯一标识==
+
+使用坐标来定义项目或引入项目中需要的依赖
+
+**Maven** **坐标主要组成**groupId:定义当前Maven项目隶属组织名称(通常是域名反写,例如:
+
+com.mdd)
+
+artifactId:定义当前Maven项目名称(通常是模块名称,例如 order-service、
+
+goods-service)
+
+version:定义当前项目版本号
+
+
+
+**1.4.3 IDEA** **创建** **Maven****项目**
+
+创建模块,选择Maven,点击Next
\ No newline at end of file
--
Gitee
From 2f00ce72cdbcf85e1f2d085595de4378ae180369 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B7=AF=E7=8E=B2?= <1516489926@qq.com>
Date: Fri, 22 Dec 2023 00:07:44 +0800
Subject: [PATCH 2/3] mydatis02
---
.../20231220 mybatis01.md" | 39 +++++
.../20231221 mydatis02.md" | 141 ++++++++++++++++++
2 files changed, 180 insertions(+)
create mode 100644 "29 \350\267\257\347\216\262/20231220 mybatis01.md"
create mode 100644 "29 \350\267\257\347\216\262/20231221 mydatis02.md"
diff --git "a/29 \350\267\257\347\216\262/20231220 mybatis01.md" "b/29 \350\267\257\347\216\262/20231220 mybatis01.md"
new file mode 100644
index 0000000..f9647bc
--- /dev/null
+++ "b/29 \350\267\257\347\216\262/20231220 mybatis01.md"
@@ -0,0 +1,39 @@
+**Mybatis****概念**
+
+MyBatis 是一款优秀的==持久层框架==,用于简化 JDBC 开发
+
+MyBatis 本是 Apache 的一个开源项目iBatis, 2010年这个项目由apache
+
+software foundation 迁移到了google code,并且改名为MyBatis 。2013
+
+年11月迁移到Github
+
+官网:https://mybatis.org/mybatis-3/zh/index.html
+
+**持久层:**
+
+负责将数据到保存到数据库的那一层代码。
+
+以后开发我们会将操作数据库的Java代码作为持久层。而Mybatis就是对jdbc代
+
+码进行了封装。
+
+JavaEE三层架构:表现层、业务层、持久层
+
+三层架构在后期会给大家进行讲解,今天先简单的了解下即可。
+
+**框架:**
+
+框架就是一个半成品软件,是一套可重用的、通用的、软件基础代码模型
+
+在框架的基础之上构建软件编写更加高效、规范、通用、可扩展
+
+**几个概念:**
+
+\1. 文档官网:https://mybatis.org/mybatis-3/zh_CN/index.html
+
+或 http://mybatis.net.cn(建议用这个)
+
+\2. 核心配置文件:mybatis-config.xml
+
+\3. SQL 映射文件:xxMapper.xml --> 统一管理sql语句,解决硬编码问题
\ No newline at end of file
diff --git "a/29 \350\267\257\347\216\262/20231221 mydatis02.md" "b/29 \350\267\257\347\216\262/20231221 mydatis02.md"
new file mode 100644
index 0000000..8a799c1
--- /dev/null
+++ "b/29 \350\267\257\347\216\262/20231221 mydatis02.md"
@@ -0,0 +1,141 @@
+```java
+
+package com.xioalu.pojo;
+
+public class Brand {
+
+
+
+ private Integer id;
+ private String brandName;
+ private String companyName;
+ private Integer ordered;
+ private String description;
+ private Integer status ;
+
+ public Brand(Integer id, String brandName, String companyName, Integer ordered, String description, Integer status) {
+ this.id = id;
+ this.brandName = brandName;
+ this.companyName = companyName;
+ this.ordered = ordered;
+ this.description = description;
+ this.status = status;
+ }
+
+ public Brand(Integer id) {
+ this.id = id;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getBrandName() {
+ return brandName;
+ }
+
+ public void setBrandName(String brandName) {
+ this.brandName = brandName;
+ }
+
+ public String getCompanyName() {
+ return companyName;
+ }
+
+ public void setCompanyName(String companyName) {
+ this.companyName = companyName;
+ }
+
+ public Integer getOrdered() {
+ return ordered;
+ }
+
+ public void setOrdered(Integer ordered) {
+ this.ordered = ordered;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Integer getStatus() {
+ return status;
+ }
+
+ public void setStatus(Integer status) {
+ this.status = status;
+ }
+
+ @Override
+ public String toString() {
+ return "Brand{" +
+ "id=" + id +
+ ", brandName='" + brandName + '\'' +
+ ", companyName='" + companyName + '\'' +
+ ", ordered=" + ordered +
+ ", description='" + description + '\'' +
+ ", status=" + status +
+ '}';
+ }
+}
+Brand.java
+```
+
+BrandMapper.xml
+
+```java
+
+
+
+
+
+```
+
+mybatis.config.xml
+
+```java
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
+
+jdbc.properties
+
+```java
+jdbc.driver = com.mysql.cj.jdbc.Driver
+jdbc.url = jdbc:mysql:///myBatis?useSSL = false
+jdbc.username = root
+jdbc.password = root
+```
+
--
Gitee
From 21dd73a6867af1fe88b32152986a363e89d1c61b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B7=AF=E7=8E=B2?= <1516489926@qq.com>
Date: Mon, 25 Dec 2023 23:33:22 +0800
Subject: [PATCH 3/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=A0=E9=99=A4?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...40\351\231\244\344\277\256\346\224\271.md" | 244 ++++++++++++++++++
1 file changed, 244 insertions(+)
create mode 100644 "29 \350\267\257\347\216\262/20231222 \345\242\236\345\212\240\345\210\240\351\231\244\344\277\256\346\224\271.md"
diff --git "a/29 \350\267\257\347\216\262/20231222 \345\242\236\345\212\240\345\210\240\351\231\244\344\277\256\346\224\271.md" "b/29 \350\267\257\347\216\262/20231222 \345\242\236\345\212\240\345\210\240\351\231\244\344\277\256\346\224\271.md"
new file mode 100644
index 0000000..36d7da5
--- /dev/null
+++ "b/29 \350\267\257\347\216\262/20231222 \345\242\236\345\212\240\345\210\240\351\231\244\344\277\256\346\224\271.md"
@@ -0,0 +1,244 @@
+```java
+
+
+ 4.0.0
+
+ com.xiaolu
+ ssm03
+ 1.0-SNAPSHOT
+
+
+ 8
+ 8
+ UTF-8
+
+
+
+ com.mysql
+ mysql-connector-j
+ 8.1.0
+
+
+
+ org.mybatis
+ mybatis
+ 3.5.13
+
+
+
+ junit
+ junit
+ 4.13.2
+ test
+
+
+
+
+
+
+```
+
+
+
+```java
+package com.xiaolu.mapper;
+
+import com.xiaolu.pojo.Brand;
+
+import java.util.List;
+
+public interface BrandMapper {
+
+ List selectAll();
+
+}
+```
+
+```java
+package com.xiaolu.pojo;
+
+public class Brand {
+
+
+
+ private Integer id;
+ private String brandName;
+ private String companyName;
+ private Integer ordered;
+ private String description;
+ private Integer status ;
+
+ public Brand(Integer id, String brandName, String companyName, Integer ordered, String description, Integer status) {
+ this.id = id;
+ this.brandName = brandName;
+ this.companyName = companyName;
+ this.ordered = ordered;
+ this.description = description;
+ this.status = status;
+ }
+
+ public Brand(Integer id) {
+ this.id = id;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getBrandName() {
+ return brandName;
+ }
+
+ public void setBrandName(String brandName) {
+ this.brandName = brandName;
+ }
+
+ public String getCompanyName() {
+ return companyName;
+ }
+
+ public void setCompanyName(String companyName) {
+ this.companyName = companyName;
+ }
+
+ public Integer getOrdered() {
+ return ordered;
+ }
+
+ public void setOrdered(Integer ordered) {
+ this.ordered = ordered;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Integer getStatus() {
+ return status;
+ }
+
+ public void setStatus(Integer status) {
+ this.status = status;
+ }
+
+ @Override
+ public String toString() {
+ return "Brand{" +
+ "id=" + id +
+ ", brandName='" + brandName + '\'' +
+ ", companyName='" + companyName + '\'' +
+ ", ordered=" + ordered +
+ ", description='" + description + '\'' +
+ ", status=" + status +
+ '}';
+ }
+}
+
+```
+
+```java
+
+
+
+
+
+
+
+
+
+
+```
+
+```java
+jdbc.driver = com.mysql.cj.jdbc.Driver
+jdbc.url = jdbc:mysql:///myBatis?useSSL = false
+jdbc.username = root
+jdbc.password = root
+```
+
+```java
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
+
+```java
+package com.xiaolu;
+
+import com.xiaolu.mapper.BrandMapper;
+import com.xiaolu.pojo.Brand;
+import org.apache.ibatis.io.Resources;
+import org.apache.ibatis.session.SqlSession;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.apache.ibatis.session.SqlSessionFactoryBuilder;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.List;
+
+public class MybatisTest {
+ @Test
+ public void findAll() throws IOException {
+
+ //1.sqlSessionfactory
+// Resources.getResourceAsStream("mybatis-config.xml")
+ SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(Resources.getResourceAsStream("mybatis-config.xml"));
+
+// 2. SqlSession
+ SqlSession sqlSession = sessionFactory.openSession();
+
+// 3.获取代理对象
+ BrandMapper mapper = sqlSession.getMapper(BrandMapper.class);
+
+// 4.执行sql语句
+ List brands = mapper.selectAll();
+ System.out.println(brands);
+
+// 5.释放资源
+ sqlSession.close();
+
+ }
+
+
+}
+
+```
+
--
Gitee