diff --git "a/\345\215\242\346\257\224\344\274\246/20241217\346\225\260\346\215\256\346\272\220\350\207\252\345\212\250\350\243\205\351\205\215/.idea/.gitignore" "b/\345\215\242\346\257\224\344\274\246/20241217\346\225\260\346\215\256\346\272\220\350\207\252\345\212\250\350\243\205\351\205\215/.idea/.gitignore" new file mode 100644 index 0000000000000000000000000000000000000000..35410cacdc5e87f985c93a96520f5e11a5c822e4 --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241217\346\225\260\346\215\256\346\272\220\350\207\252\345\212\250\350\243\205\351\205\215/.idea/.gitignore" @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git "a/\345\215\242\346\257\224\344\274\246/20241217\346\225\260\346\215\256\346\272\220\350\207\252\345\212\250\350\243\205\351\205\215/.idea/20241217\346\225\260\346\215\256\346\272\220\350\207\252\345\212\250\350\243\205\351\205\215.iml" "b/\345\215\242\346\257\224\344\274\246/20241217\346\225\260\346\215\256\346\272\220\350\207\252\345\212\250\350\243\205\351\205\215/.idea/20241217\346\225\260\346\215\256\346\272\220\350\207\252\345\212\250\350\243\205\351\205\215.iml" new file mode 100644 index 0000000000000000000000000000000000000000..9fcbf081e2c04c826ceea39cfa78684c983adcb1 --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241217\346\225\260\346\215\256\346\272\220\350\207\252\345\212\250\350\243\205\351\205\215/.idea/20241217\346\225\260\346\215\256\346\272\220\350\207\252\345\212\250\350\243\205\351\205\215.iml" @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\345\215\242\346\257\224\344\274\246/20241217\346\225\260\346\215\256\346\272\220\350\207\252\345\212\250\350\243\205\351\205\215/.idea/misc.xml" "b/\345\215\242\346\257\224\344\274\246/20241217\346\225\260\346\215\256\346\272\220\350\207\252\345\212\250\350\243\205\351\205\215/.idea/misc.xml" new file mode 100644 index 0000000000000000000000000000000000000000..b0af9cdcefb613a217f7eff4d214c61895c0f9cd --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241217\346\225\260\346\215\256\346\272\220\350\207\252\345\212\250\350\243\205\351\205\215/.idea/misc.xml" @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git "a/\345\215\242\346\257\224\344\274\246/20241217\346\225\260\346\215\256\346\272\220\350\207\252\345\212\250\350\243\205\351\205\215/.idea/modules.xml" "b/\345\215\242\346\257\224\344\274\246/20241217\346\225\260\346\215\256\346\272\220\350\207\252\345\212\250\350\243\205\351\205\215/.idea/modules.xml" new file mode 100644 index 0000000000000000000000000000000000000000..63eca9a13759cf581d85d1269d411d179e7765ff --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241217\346\225\260\346\215\256\346\272\220\350\207\252\345\212\250\350\243\205\351\205\215/.idea/modules.xml" @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git "a/\345\215\242\346\257\224\344\274\246/20241217\346\225\260\346\215\256\346\272\220\350\207\252\345\212\250\350\243\205\351\205\215/.idea/vcs.xml" "b/\345\215\242\346\257\224\344\274\246/20241217\346\225\260\346\215\256\346\272\220\350\207\252\345\212\250\350\243\205\351\205\215/.idea/vcs.xml" new file mode 100644 index 0000000000000000000000000000000000000000..b2bdec2d71b6a5ce4ae49efc37516809c50e4d5e --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241217\346\225\260\346\215\256\346\272\220\350\207\252\345\212\250\350\243\205\351\205\215/.idea/vcs.xml" @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git "a/\345\215\242\346\257\224\344\274\246/20241217\346\225\260\346\215\256\346\272\220\350\207\252\345\212\250\350\243\205\351\205\215/jdbc.properties" "b/\345\215\242\346\257\224\344\274\246/20241217\346\225\260\346\215\256\346\272\220\350\207\252\345\212\250\350\243\205\351\205\215/jdbc.properties" new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git "a/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/03 Spring\345\256\266\346\227\217\357\274\214\344\270\200\345\240\206\347\232\204\346\241\206\346\236\266.md" "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/03 Spring\345\256\266\346\227\217\357\274\214\344\270\200\345\240\206\347\232\204\346\241\206\346\236\266.md" new file mode 100644 index 0000000000000000000000000000000000000000..34fa36c995aa3d90f2de24f58c2bd8cd9d8ca716 --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/03 Spring\345\256\266\346\227\217\357\274\214\344\270\200\345\240\206\347\232\204\346\241\206\346\236\266.md" @@ -0,0 +1,239 @@ +## 一、初体验 +1. 官网:https://spring.io/ +2. Spring要和,JDK版本对应得上,否则会报错信息类似:Failed to read candidate component class,也就是注解扫描不了,这是版本兼容问题引起的,根据Spring官网Spring Framework与JDK版本对应表: + +| Spring Framework版本 | JDK版本 | +| -------------------- | --------- | +| 6.0.x | JDK 17-21 | +| 5.3.x | JDK 8-19 | +| 5.2.x | JDK 8-15 | +| 5.1.x | JDK 8-12 | +| 5.0.x | JDK 8-10 | +| 4.3.x | JDK 6-8 | +3. Spring Framework的特点 + 1. 控制反转:IoC,反转资源获取方向;把自己创建的资源、向环境索取资源变为环境将资源准备好,我们享受资源注入。 + 2. 面向切面编程:AOP,在不修改源代码的基础上增强代码功能。 + 3. 容器:Spring IoC是一个容器,因为它包含并管理组件对象的生命周期;组件享受到了容器化的管理,替程序员屏蔽了组件创建过程中的大量细节,极大降低了使用门槛,大幅度提高了开发效率。 + 4. 一站式:在IOC和AOP的基础上可以整合各种企业应用的开源框架和优秀的第三方库,而且在Spring旗下的项目已经覆盖了广泛领域,很多方面的功能性需求可以在Spring Framework 的基础上全部使用Spring来实现。 +4. 入门案例 + 1. 环境要求: + - JDK : 1.8 + - Spring : 5.3.39 + 2. 构建工程项目 + 3. pom.xml中引入相关依赖,并 刷新maven +-------------------------- +```xml + + + org.springframework + spring-context + 5.3.39 + + + junit + junit + 4.13.2 + test + + +``` +------------------------- + 4. 创建软件包 + ![image.png](https://gitee.com/onesheet/images_backup/raw/master/images/20241215222659.png) + 5. 创建用于测试的实体类Teacher + ![image.png](https://gitee.com/onesheet/images_backup/raw/master/images/20241215222947.png) + 6. **创建spring配置文件:resources目录下创建bean.xml** +![image.png](https://gitee.com/onesheet/images_backup/raw/master/images/20241215223246.png) +![image.png](https://gitee.com/onesheet/images_backup/raw/master/images/202412191016646.png) +![image.png](https://gitee.com/onesheet/images_backup/raw/master/images/202412191016805.png) +![image.png](https://gitee.com/onesheet/images_backup/raw/master/images/20241215223436.png) + 7. **在bean.xml中用标签完成对象创建** +------------------- +```xml + + + + + +``` +---------------------------- + 8. **创建测试类com.md.test.TestTeacher进行测试** +------------ +```java +public class TestTeacher { + @Test + public void t1() { + // 1.加载spring配置文件,得到IOC容器context + ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml"); + // 2.从IOC容器获取spring创建好的对象 + Teacher teacher = (Teacher) context.getBean("teacher"); + // 3.使用对象调用方法测试 + System.out.println("teacher = " + teacher); + teacher.teach(); + } +} +``` +![image.png](https://gitee.com/onesheet/images_backup/raw/master/images/20241215224418.png) + +----------------------- +## 二、一些术语概念 +### 1. IoC容器 +1. IoC 是 Inversion of Control 的简写,译为 控制反转。 +2. IoC容器 + 1. 管理着所有的Java对象的实例化和初始化, + 2. 控制着对象与对象之间的依赖关系。 + 3. IoC容器管理的Java对象称为 Spring Bean, + 4. 它与使用关键字 new 创建的Java对象没有任何区别。 +3. IoC容器是Spring框架中最重要的核心组件之一,它贯穿了Spring从诞生到成长的整个过程。 + +### 2. 控制反转( IoC ) +> 控制反转是一种思想 + +1. 将对象的创建权利交出去,交给第三方容器(IOC容器)负责 +2. 将对象和对象之间的关系维护权交出去,交给第三方容器负责 + +>如何实现控制反转 + +- 通过依赖注入DI的方式实现 + +### 3. 依赖注入( DI ) +DI (Dependency Injection):依赖注入,依赖注入实现了控制反转的思想,是指Spring创建对象的过程中,将对象依赖属性通过配置进行注入。 + +>依赖注入常见的实现方式有两种: + +1. set注入 ,常用 +2. 构造器注入 + +>结论: IoC 是一种控制反转的思想,而 DI 是对IoC的一种具体实现。 + +Bean管理:指对IOC容器中的Bean对象的创建,以及Bean对象中属性的赋值(或Bean对象之间关系的维护) + +### 4. IoC容器的实现 +>Spring中的IoC容器就是IoC思想的一个落地产品实现。IoC容器中管理的组件也叫做bean。在创建bean之前,首先需要创建IoC容器,Spring提供了IoC容器的两种实现方式 + +① BeanFactory + +这是IoC容器的基本实现,是Spring内部使用的接口。面向Spring本身,不提供给开发人员使用。 + +② ApplicationContext + +BeanFactory的子接口,提供了更多高级特性,面向Spring的使用者,几乎所有场合都使用 ApplicationContext,而不是底层的BeanFactory + +③ ApplicationContext的主要实现类 +![image.png](https://gitee.com/onesheet/images_backup/raw/master/images/20241215230030.png) + +--------------- +| 类型 | 说明 | 路径示例 | +| ------------------------------ | -------------------------------------------------- | -------------------------------------------- | +| ClassPathXmlApplicationContext | 通过读取类路径下的xml格式配置文件创建IoC容器对象 | appcontext.xml | +| FileSystemApplicationContext | 通过文件系统路径读取xml格式配置文件创建IoC容器对象 | file:F:/workspace/example/src/appcontext.xml | +--------------- + +## 三、如何通过XML管理Bean + +1. 还是 com.mdd.entity.Teacher 为例,来演示 +2. 获取bean方式 + 1. 根据id获取: + 1. id属性是bean的唯一标识,所以根据bean标签的id属性可以精确获取到一个组件对象。 + 2. ![](https://gitee.com/onesheet/images_backup/raw/master/images/202412191016571.png) + 2. 根据类型获取 + 1. ![image.png](https://gitee.com/onesheet/images_backup/raw/master/images/202412191016728.png) + + 3. 根据id和类型获取 + 1. ![image.png](https://gitee.com/onesheet/images_backup/raw/master/images/20241215231631.png) + + + +>注意: 当根据类型获取bean时,要求IoC容器中指定类型的bean只能有一个,当配置两个时会抛出异常 + + +### * 依赖注入的两种常见方式 +>类是有属性的,创建对象过程中,如何向属性注入具体的值? + +1. 方式1:使用set方法完成(使用xml中的标签实现) +2. 方式2:基于构造器完成 + + +1. 使用set方法完成 + 1. 类中补充setter toString + 1. ![image.png](https://gitee.com/onesheet/images_backup/raw/master/images/202412191016811.png) + + 2. 修改bean.xml,进行属性值注入 + 1. ![image.png](https://gitee.com/onesheet/images_backup/raw/master/images/20241215232345.png) + 2. 测试: + 1. ![image.png](https://gitee.com/onesheet/images_backup/raw/master/images/20241215232424.png) + + +3. 基于构造器依赖注入 + 1. 补全类中的构造器 + 1. ![image.png](https://gitee.com/onesheet/images_backup/raw/master/images/202412191016440.png) + + 2. 修改bean.xml + 1. ![image.png](https://gitee.com/onesheet/images_backup/raw/master/images/202412191016644.png) + + 3. 测试 + 1. !![image.png](https://gitee.com/onesheet/images_backup/raw/master/images/202412191016926.png)[image.png](https://gitee.com/onesheet/images_backup/raw/master/images/20241215232915.png) + + +4. 不同类型的属性有不同的表示方式 + 1. 简单类型 : value + 2. 对象引用类型 : ref + 3. 数组 \value或ref\ + 4. 集合\value或ref\ + 5. 空值 \\ + + + +5. 练习 + 1. 使用spring框架完成以下操作 + 2. 分别创建老师,课程,学生三个类,每个类要有三个属性,做成javabean + 3. 配置bean.xml进入Bean管理,分别创建老师,课程,学生的bean + 4. 老师有:姓名,多门课程(数组),多个学生(集合) + 5. 课程有:课程名称,学分 + 6. 学生有:姓名,年龄,一个任课老师。 + 7. 编写测试类,对每种bean进行测试。 + + +## 进阶一: +1. 使用lombok 快速创建javabean的类 +2. 特殊类型的注入,实体符< > +3. ]]> +4. 4. druid数据源 https://zhuanlan.zhihu.com/p/690241776 +5. 外部属性文件的引入, +6. 自动装配 +7. 三层架构:dao,service,controller + 1. 详解三层架构 是什么? 为什么? 怎么做? + 2. ![image.png](https://gitee.com/onesheet/images_backup/raw/master/images/20241219150430.png) + + 3. https://blog.csdn.net/S_yyuan/article/details/121554927 + 5. 步骤 + 1. 创建好各个软件包:entity->dao->service->controller + 2. 创建实体类 User(用来封装数据),(相当于做菜品材料) + 3. 创建数据访问层 (采购员) + 1. UserDao 接口 ,相当于采购员岗位,接口中的方法。相当于岗位职责 + 2. UserDao 接口的实现类UserDaoImpl,相当于聘请的具体采购员,要符合岗位职责,所以要实现所有方法 + 3. 在UserDaoImpl实现类中,写操作数据库的具体逻辑(具体的采购办法) + 4. 创建业务逻辑层 (厨师) + 1. UserService 接口,明确厨师的岗位职责,编写业务层要实现的功能方法 + 2. UserService 接口的实现类UserServiceImpl,相当于根据厨师岗位职责招聘来的厨师,所有要具备厨师岗位所有技巧,即实现接口的所有方法 + 3. 在UserServiceImpl实现类中,厨师做菜,要有材料,所以依赖于采购员,把采购员UserDao做为一个类属性注入进来 + 4. 在UserServiceImpl实现类中,对UserDao传过来的数据,做进一步处理。相当于加工材料做成菜。 + 1. 厨师做菜的材料,是依赖采购员来采购的。所以 + 2. 在UserServiceImpl实现类中要定义一个UserDao的属性 + 3. 在Bean中将UserDao对象入注入进来 + 5. 创建表示层 (服务员) + 1. UserController 类, + 1. 负责接收用户请求,并转发给UserServiceImpl:相当于服务员接收顾客点菜后,将菜单订单转发给厨师,厨师会根据这个订单开始做菜 + 2. 负责接收UserServiceImpl的响应,将转发给用户:相当于服务员将厨师做好的菜。端给前面点菜的顾客。 + 3. 因为厨师做好了菜之后,服务员才能将菜端给顾客,所以服务员的工作是依赖于厨师的。 + 1. controller 类中要定义一个 UserService的属性 + 2. 在Bean中将UserServicec对象注入进来 + 6. 总结 + 1. Controller依赖Service,Service依赖Dao + 2. 所以controller的bean要注入Service,Service的bean要注入Dao +8. 注解开发 diff --git "a/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/.idea/.gitignore" "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/.idea/.gitignore" new file mode 100644 index 0000000000000000000000000000000000000000..35410cacdc5e87f985c93a96520f5e11a5c822e4 --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/.idea/.gitignore" @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git "a/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/.idea/compiler.xml" "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/.idea/compiler.xml" new file mode 100644 index 0000000000000000000000000000000000000000..cfb07e51ee58c08cd6ccff06bc251a52f5fe4122 --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/.idea/compiler.xml" @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/.idea/jarRepositories.xml" "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/.idea/jarRepositories.xml" new file mode 100644 index 0000000000000000000000000000000000000000..abb532ab355ddfa5ec01bd4393fcda38f88224b0 --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/.idea/jarRepositories.xml" @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git "a/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/.idea/misc.xml" "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/.idea/misc.xml" new file mode 100644 index 0000000000000000000000000000000000000000..d5cd61439e42be16778fe0d90f206a2b02d987e8 --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/.idea/misc.xml" @@ -0,0 +1,12 @@ + + + + + + + + \ No newline at end of file diff --git "a/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/pom.xml" "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/pom.xml" new file mode 100644 index 0000000000000000000000000000000000000000..7627e019c5ebc70ba733b5aec4da6ab0c8edc53a --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/pom.xml" @@ -0,0 +1,44 @@ + + + 4.0.0 + + org.example + spring04 + 1.0-SNAPSHOT + + + + org.springframework + spring-context + 5.3.39 + + + + junit + junit + 4.13.2 + test + + + org.projectlombok + lombok + 1.18.36 + compile + + + + com.alibaba + druid + 1.1.21 + + + + com.mysql + mysql-connector-j + 8.3.0 + + + + \ No newline at end of file diff --git "a/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/src/main/java/com/kfc/controller/TeacherController.java" "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/src/main/java/com/kfc/controller/TeacherController.java" new file mode 100644 index 0000000000000000000000000000000000000000..eb3c21a702cd3b610a5061a2d7c6b2020a2f64db --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/src/main/java/com/kfc/controller/TeacherController.java" @@ -0,0 +1,27 @@ +package com.kfc.controller; + +import com.kfc.entity.Teacher; +import com.kfc.service.TeacherService; +import lombok.Data; + +// 服务员 +@Data +public class TeacherController { + // 从厨师那里得到菜品 + // 菜品的获取是依赖厨师 + private TeacherService teacherService; // 接口 + + // 服务员,可以接收顾客的点菜数据,id + public Teacher orderTeacher(int id) { + Teacher teacher = teacherService.getOneTeacherById(id); + return teacher; + } + + // id =1 + public String deleteById(int id) { + Boolean rs = teacherService.deleteById(id); + return rs ? "删除成功" : "删除失败"; + } + + +} diff --git "a/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/src/main/java/com/kfc/dao/TeacherDao.java" "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/src/main/java/com/kfc/dao/TeacherDao.java" new file mode 100644 index 0000000000000000000000000000000000000000..1de95e55adf72628745352f3bd355a6c6f7c67db --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/src/main/java/com/kfc/dao/TeacherDao.java" @@ -0,0 +1,18 @@ +package com.kfc.dao; + +import com.kfc.entity.Teacher; +// 数据处理层,类比采购员 +// 接口,好比,拟定采购员岗位职责 +public interface TeacherDao { + // 增 + + // 删 + int deleteTeacherById(int id); // int 表示的是sql语句执行后,数据库中受影响的行数 + + + // 换,改 + + // 查 + // 根据编号查询 + Teacher selectOneById(int id); +} diff --git "a/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/src/main/java/com/kfc/dao/TeacherDaoImpl.java" "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/src/main/java/com/kfc/dao/TeacherDaoImpl.java" new file mode 100644 index 0000000000000000000000000000000000000000..59daae67d2bdc2d5950a1b1a481e143d8cbf0957 --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/src/main/java/com/kfc/dao/TeacherDaoImpl.java" @@ -0,0 +1,56 @@ +package com.kfc.dao; + +import com.alibaba.druid.pool.DruidDataSource; +import com.alibaba.druid.pool.DruidPooledConnection; +import com.kfc.entity.Teacher; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; + +// 具体招聘来的采购 +public class TeacherDaoImpl implements TeacherDao{ + @Override + public int deleteTeacherById(int id) { + // 真实从数据库拿数据,通过druid连接池 + ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml"); + DruidDataSource dataSource = context.getBean(DruidDataSource.class); + DruidPooledConnection conn = null; + try { + conn = dataSource.getConnection(); + Statement st = conn.createStatement(); + int i = st.executeUpdate("delete from student01 where id =" + id); + return i; + } catch (SQLException e) { + throw new RuntimeException(e); + } + + } + + @Override + public Teacher selectOneById(int id) { + + // 这个采购,会去超市采购对应的食材 + // 假设 一个数组是一个超市 + Teacher[] teachers = {new Teacher(1,"张三"),new Teacher(2,"李四")}; + + // 真实从数据库拿数据,通过druid连接池 + ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml"); + DruidDataSource dataSource = context.getBean(DruidDataSource.class); + try { + DruidPooledConnection conn = dataSource.getConnection(); + Statement st = conn.createStatement(); + ResultSet rs = st.executeQuery("select * from mybatis.teacher where teacher_id=" + id); + while (rs.next()){ + Teacher teacher = new Teacher(rs.getInt("teacher_id"), rs.getString("teacher_name")); + return teacher; + } + } catch (SQLException e) { + throw new RuntimeException(e); + } + + return null; + } +} diff --git "a/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/src/main/java/com/kfc/entity/Teacher.java" "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/src/main/java/com/kfc/entity/Teacher.java" new file mode 100644 index 0000000000000000000000000000000000000000..8225bb5cfe66802aa60002d73782bfad8630b17c --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/src/main/java/com/kfc/entity/Teacher.java" @@ -0,0 +1,13 @@ +package com.kfc.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class Teacher { + private int teacherId; + public String teacherName; +} diff --git "a/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/src/main/java/com/kfc/service/TeacherService.java" "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/src/main/java/com/kfc/service/TeacherService.java" new file mode 100644 index 0000000000000000000000000000000000000000..bb723d01c6a39feabc2b91225fc18f7228cb6aff --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/src/main/java/com/kfc/service/TeacherService.java" @@ -0,0 +1,14 @@ +package com.kfc.service; + +import com.kfc.entity.Teacher; + +// 指定厨师的岗位职责 +public interface TeacherService { + // 能根据采购员给的食材,进行加工 + + // 根据编号查询(根据客户订单加工食材),得到一个加工过的售票,得到菜品 + Teacher getOneTeacherById(int id); + + // 根据id删除 + Boolean deleteById(int id); // 根据dao反馈的结果,进一步处理,0false 1 true +} diff --git "a/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/src/main/java/com/kfc/service/TeacherServiceImpl.java" "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/src/main/java/com/kfc/service/TeacherServiceImpl.java" new file mode 100644 index 0000000000000000000000000000000000000000..2ffa70fa750798ccf668f2358e797fc7b6911de5 --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/src/main/java/com/kfc/service/TeacherServiceImpl.java" @@ -0,0 +1,30 @@ +package com.kfc.service; + +import com.kfc.dao.TeacherDao; +import com.kfc.entity.Teacher; +import lombok.Data; + +@Data +public class TeacherServiceImpl implements TeacherService{ + // 厨师要加工食材,首先得到有食材,由采购员提供,就是要依赖采购员 + private TeacherDao teacherDao; // 接口 + + + @Override + public Teacher getOneTeacherById(int id) { + // 从采购员那里得到食材 + Teacher teacher = teacherDao.selectOneById(id); + // 加工食材 +// teacher.setTeacherName("王老五"); +// if (teacher==null){ +// teacher= new Teacher(10086, "佚名"); +// } + return teacher; // 返回菜品 + } + + @Override + public Boolean deleteById(int id) { + int i = teacherDao.deleteTeacherById(id); + return i>0; + } +} diff --git "a/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/src/main/resources/bean.xml" "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/src/main/resources/bean.xml" new file mode 100644 index 0000000000000000000000000000000000000000..4e313b2e3372874a917a0cc9900db429586917db --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/src/main/resources/bean.xml" @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/src/test/java/com/kfc/test/TestTeacher.java" "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/src/test/java/com/kfc/test/TestTeacher.java" new file mode 100644 index 0000000000000000000000000000000000000000..50e7c8a3196a8d648e2465ad3ea0df4c0a487ed8 --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/src/test/java/com/kfc/test/TestTeacher.java" @@ -0,0 +1,26 @@ +package com.kfc.test; + +import com.kfc.controller.TeacherController; +import com.kfc.entity.Teacher; +import org.junit.Test; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; +// 顾客 +public class TestTeacher { + @Test + public void t1(){ + // 模拟客户点菜,勾了菜单中,编号为1的菜 + int id = 10; + // Spring框架,不自己new,从IOC容器拿 + ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml"); + TeacherController controller = context.getBean(TeacherController.class); +// Teacher teacher = controller.orderTeacher(id); +// System.out.println("teacher = " + teacher); + String s = controller.deleteById(id); + System.out.println(s); + } + + + + +} diff --git "a/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/target/classes/bean.xml" "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/target/classes/bean.xml" new file mode 100644 index 0000000000000000000000000000000000000000..4e313b2e3372874a917a0cc9900db429586917db --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/target/classes/bean.xml" @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/target/classes/com/kfc/controller/TeacherController.class" "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/target/classes/com/kfc/controller/TeacherController.class" new file mode 100644 index 0000000000000000000000000000000000000000..a11fd5f69676cfbe11daff310506639a1f3ff59d Binary files /dev/null and "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/target/classes/com/kfc/controller/TeacherController.class" differ diff --git "a/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/target/classes/com/kfc/dao/TeacherDao.class" "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/target/classes/com/kfc/dao/TeacherDao.class" new file mode 100644 index 0000000000000000000000000000000000000000..00e60600f4383281c14be22c54181b4479f83d77 Binary files /dev/null and "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/target/classes/com/kfc/dao/TeacherDao.class" differ diff --git "a/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/target/classes/com/kfc/dao/TeacherDaoImpl.class" "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/target/classes/com/kfc/dao/TeacherDaoImpl.class" new file mode 100644 index 0000000000000000000000000000000000000000..8967c0fb6e81a3fad807ee416ba10d48cfd61f22 Binary files /dev/null and "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/target/classes/com/kfc/dao/TeacherDaoImpl.class" differ diff --git "a/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/target/classes/com/kfc/entity/Teacher.class" "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/target/classes/com/kfc/entity/Teacher.class" new file mode 100644 index 0000000000000000000000000000000000000000..8479c1876b610b8dffe790ccc51fe8f52c254d38 Binary files /dev/null and "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/target/classes/com/kfc/entity/Teacher.class" differ diff --git "a/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/target/classes/com/kfc/service/TeacherService.class" "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/target/classes/com/kfc/service/TeacherService.class" new file mode 100644 index 0000000000000000000000000000000000000000..c6da88830107b077f2ff4f08f781e55de3e2aae0 Binary files /dev/null and "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/target/classes/com/kfc/service/TeacherService.class" differ diff --git "a/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/target/classes/com/kfc/service/TeacherServiceImpl.class" "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/target/classes/com/kfc/service/TeacherServiceImpl.class" new file mode 100644 index 0000000000000000000000000000000000000000..ac6fc9427bb8126e53a35a7525290a9a4cca2cd2 Binary files /dev/null and "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/target/classes/com/kfc/service/TeacherServiceImpl.class" differ diff --git "a/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/target/test-classes/com/kfc/test/TestTeacher.class" "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/target/test-classes/com/kfc/test/TestTeacher.class" new file mode 100644 index 0000000000000000000000000000000000000000..86e9ad4c2952ef073bf17f633989d1a04a69e0b5 Binary files /dev/null and "b/\345\215\242\346\257\224\344\274\246/20241219 \344\270\211\345\261\202\346\236\266\346\236\204/spring04/target/test-classes/com/kfc/test/TestTeacher.class" differ diff --git "a/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/pom.xml" "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/pom.xml" new file mode 100644 index 0000000000000000000000000000000000000000..535b4481fdbba5ca3d15e3076d6757b3a7bbe402 --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/pom.xml" @@ -0,0 +1,80 @@ + + + 4.0.0 + + com.pdd + spring05 + 1.0-SNAPSHOT + + + + org.projectlombok + lombok + 1.18.36 + compile + + + + org.mybatis + mybatis + 3.5.16 + + + + + com.mysql + mysql-connector-j + 8.3.0 + + + + junit + junit + 4.13.2 + test + + + + org.springframework + spring-context + 5.3.39 + + + + + org.springframework + spring-jdbc + 5.3.39 + + + + + + + com.alibaba + druid + 1.1.21 + + + + + + org.mybatis + mybatis-spring + 2.0.6 + + + + + org.springframework + spring-test + 5.3.39 + + + + + + + \ No newline at end of file diff --git "a/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/src/main/java/com/md/Dao/DeptDao.java" "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/src/main/java/com/md/Dao/DeptDao.java" new file mode 100644 index 0000000000000000000000000000000000000000..69c57ca99e98466677d3e6f3d92fcd428330ff16 --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/src/main/java/com/md/Dao/DeptDao.java" @@ -0,0 +1,23 @@ +package com.md.Dao; + +import com.md.entity.Dept; +import org.apache.ibatis.annotations.Delete; +import org.apache.ibatis.annotations.Insert; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; + +import java.util.Date; + +public interface DeptDao { + @Select("select dept_id deptId,dept_name deptName from dept where dept_id = #{id}") + Dept deptOneId(int id); + + @Delete("delete from dept where dept_id = #{id}") + int deleteById(int id); + + @Insert("insert into dept(dept_name) values (#{deptName})") + int insert(Dept dept); + + @Update("update dept set dept_name = #{deptName} where dept_id = #{deptId}") + int update(Dept dept); +} diff --git "a/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/src/main/java/com/md/coll/DeptColl.java" "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/src/main/java/com/md/coll/DeptColl.java" new file mode 100644 index 0000000000000000000000000000000000000000..27955747b630d1ffbaa46494acc03a3c16a5dc2b --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/src/main/java/com/md/coll/DeptColl.java" @@ -0,0 +1,26 @@ +package com.md.coll; + +import com.md.entity.Dept; +import com.md.service.DeptService; +import lombok.Data; + +@Data +public class DeptColl { + private DeptService deptService; + + public Dept deptOneId(int id) { + return deptService.deptOneId(id); + } + + public int deleteById(int id){ + return deptService.deleteById(id); + }; + + public int update(Dept dept){ + return deptService.update(dept); + }; + + public int insert(Dept dept){ + return deptService.insert(dept); + }; +} diff --git "a/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/src/main/java/com/md/entity/Dept.java" "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/src/main/java/com/md/entity/Dept.java" new file mode 100644 index 0000000000000000000000000000000000000000..f4b1604c50fdf36f824caee31b3d63db1c1700c5 --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/src/main/java/com/md/entity/Dept.java" @@ -0,0 +1,13 @@ +package com.md.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class Dept { + private int deptId; + private String deptName; +} diff --git "a/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/src/main/java/com/md/service/DeptService.java" "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/src/main/java/com/md/service/DeptService.java" new file mode 100644 index 0000000000000000000000000000000000000000..d3f39b2edfcc5ac676715eaf1cb29d5d9f879fca --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/src/main/java/com/md/service/DeptService.java" @@ -0,0 +1,15 @@ +package com.md.service; + +import com.md.entity.Dept; + +import java.util.Date; + +public interface DeptService { + Dept deptOneId(int id); + + int deleteById(int id); + + int insert(Dept dept); + + int update(Dept dept); +} diff --git "a/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/src/main/java/com/md/service/DeptServiceImp.java" "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/src/main/java/com/md/service/DeptServiceImp.java" new file mode 100644 index 0000000000000000000000000000000000000000..23da11ed99b9a60d5d4b151def4ce4c338a73d5b --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/src/main/java/com/md/service/DeptServiceImp.java" @@ -0,0 +1,32 @@ +package com.md.service; + +import com.md.Dao.DeptDao; +import com.md.entity.Dept; +import lombok.Data; + +import java.util.Date; + + +@Data +public class DeptServiceImp implements DeptService{ + private DeptDao deptDao; + @Override + public Dept deptOneId(int id) { + return deptDao.deptOneId(id); + } + + @Override + public int deleteById(int id) { + return deptDao.deleteById(id); + } + + @Override + public int insert(Dept dept) { + return deptDao.insert(dept); + } + + @Override + public int update(Dept dept) { + return deptDao.update(dept); + } +} diff --git "a/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/src/main/java/org/example/Main.java" "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/src/main/java/org/example/Main.java" new file mode 100644 index 0000000000000000000000000000000000000000..407f157bcb0852a527a500994d9e16a54f520f3f --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/src/main/java/org/example/Main.java" @@ -0,0 +1,7 @@ +package org.example; + +public class Main { + public static void main(String[] args) { + System.out.println("Hello world!"); + } +} \ No newline at end of file diff --git "a/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/src/main/resources/javabean.xml" "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/src/main/resources/javabean.xml" new file mode 100644 index 0000000000000000000000000000000000000000..e31dad119d6508da1bd4fa8fc014acd408df5f5d --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/src/main/resources/javabean.xml" @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/src/main/resources/jdbc.properties" "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/src/main/resources/jdbc.properties" new file mode 100644 index 0000000000000000000000000000000000000000..ab17b57b1ea4caece5c73f76ca95be66d80f9217 --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/src/main/resources/jdbc.properties" @@ -0,0 +1,4 @@ +jdbc.driver = com.mysql.jdbc.Driver +jdbc.url = jdbc:mysql:///student +jdbc.username = root +jdbc.password = 462709894 \ No newline at end of file diff --git "a/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/src/test/java/TextDept.java" "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/src/test/java/TextDept.java" new file mode 100644 index 0000000000000000000000000000000000000000..909fb29a8f5478d8e863f7f91040b7a555dff375 --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/src/test/java/TextDept.java" @@ -0,0 +1,38 @@ +import com.md.coll.DeptColl; +import com.md.entity.Dept; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations = "classpath:javabean.xml") +public class TextDept { + @Autowired + private DeptColl deptColl; + @Test + public void t1(){ + Dept date = deptColl.deptOneId(1); + System.out.println(date); + } + @Test + public void t2(){ + int i = deptColl.deleteById(1); + System.out.println(i); + } + + @Test + public void t3(){ + Dept dept = new Dept(); + dept.setDeptName("小黑"); + int insert = deptColl.insert(dept); + System.out.println(insert); + } + + @Test + public void t4(){ + Dept dept = new Dept(2,"xiaoabai"); + int update = deptColl.update(dept); + System.out.println(update); + } +} diff --git "a/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/target/classes/com/md/Dao/DeptDao.class" "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/target/classes/com/md/Dao/DeptDao.class" new file mode 100644 index 0000000000000000000000000000000000000000..04def18924062ece89e4bbb0f59e44b54028f86b Binary files /dev/null and "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/target/classes/com/md/Dao/DeptDao.class" differ diff --git "a/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/target/classes/com/md/coll/DeptColl.class" "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/target/classes/com/md/coll/DeptColl.class" new file mode 100644 index 0000000000000000000000000000000000000000..488761581d586ae4eaa0520647e6d93115d54214 Binary files /dev/null and "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/target/classes/com/md/coll/DeptColl.class" differ diff --git "a/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/target/classes/com/md/entity/Dept.class" "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/target/classes/com/md/entity/Dept.class" new file mode 100644 index 0000000000000000000000000000000000000000..2664ad4b680f8256257a65f59970f24562295031 Binary files /dev/null and "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/target/classes/com/md/entity/Dept.class" differ diff --git "a/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/target/classes/com/md/service/DeptService.class" "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/target/classes/com/md/service/DeptService.class" new file mode 100644 index 0000000000000000000000000000000000000000..ab0f449406bee0bf3cbb4f6fc235f11e4726f8fd Binary files /dev/null and "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/target/classes/com/md/service/DeptService.class" differ diff --git "a/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/target/classes/com/md/service/DeptServiceImp.class" "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/target/classes/com/md/service/DeptServiceImp.class" new file mode 100644 index 0000000000000000000000000000000000000000..586830146b443093df1598c4e49bf324aac56f04 Binary files /dev/null and "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/target/classes/com/md/service/DeptServiceImp.class" differ diff --git "a/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/target/classes/javabean.xml" "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/target/classes/javabean.xml" new file mode 100644 index 0000000000000000000000000000000000000000..e31dad119d6508da1bd4fa8fc014acd408df5f5d --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/target/classes/javabean.xml" @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/target/classes/jdbc.properties" "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/target/classes/jdbc.properties" new file mode 100644 index 0000000000000000000000000000000000000000..ab17b57b1ea4caece5c73f76ca95be66d80f9217 --- /dev/null +++ "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/target/classes/jdbc.properties" @@ -0,0 +1,4 @@ +jdbc.driver = com.mysql.jdbc.Driver +jdbc.url = jdbc:mysql:///student +jdbc.username = root +jdbc.password = 462709894 \ No newline at end of file diff --git "a/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/target/classes/org/example/Main.class" "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/target/classes/org/example/Main.class" new file mode 100644 index 0000000000000000000000000000000000000000..a605efc8a3f19bec6b72a7bb509f975771a926ce Binary files /dev/null and "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/target/classes/org/example/Main.class" differ diff --git "a/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/target/test-classes/TextDept.class" "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/target/test-classes/TextDept.class" new file mode 100644 index 0000000000000000000000000000000000000000..932fe29bf2ea54a9e27bbeeb0d8f95c25d1f0587 Binary files /dev/null and "b/\345\215\242\346\257\224\344\274\246/20241220 spring\346\225\264\345\220\210mybatis/target/test-classes/TextDept.class" differ