mybatis的快速入門以及spring boot整合mybatis(二)

需要用到的SQL腳本:

CREATE TABLE dept (id int unsigned PRIMARY KEY AUTO_INCREMENT COMMENT 'ID, 主鍵',name varchar(10) NOT NULL UNIQUE COMMENT '部門名稱',create_time datetime DEFAULT NULL COMMENT '創建時間',update_time datetime DEFAULT NULL COMMENT '修改時間'
) COMMENT '部門表';INSERT INTO dept VALUES (1,'學工部','2023-09-25 09:47:40','2023-09-25 09:47:40'),(2,'教研部','2023-09-25 09:47:40','2023-10-09 15:17:04'),(3,'咨詢部2','2023-09-25 09:47:40','2023-11-30 21:26:24'),(4,'就業部','2023-09-25 09:47:40','2023-09-25 09:47:40'),(5,'人事部','2023-09-25 09:47:40','2023-09-25 09:47:40'),(15,'行政部','2023-11-30 20:56:37','2023-11-30 20:56:37');create table emp(id int unsigned primary key auto_increment comment 'ID,主鍵',username varchar(20) not null unique comment '用戶名',password varchar(50) default '123456' comment '密碼',name varchar(10) not null comment '姓名',gender tinyint unsigned not null comment '性別, 1:男, 2:女',phone char(11) not null unique comment '手機號',job tinyint unsigned comment '職位, 1 班主任, 2 講師 , 3 學工主管, 4 教研主管, 5 咨詢師',salary int unsigned comment '薪資',image varchar(300) comment '頭像',entry_date date comment '入職日期',dept_id int unsigned comment '部門ID',create_time datetime comment '創建時間',update_time datetime comment '修改時間'
) comment '員工表';INSERT INTO emp VALUES 
(1,'shinaian','123456','施耐庵',1,'13309090001',4,15000,'5.png','2000-01-01',2,'2023-10-20 16:35:33','2023-11-16 16:11:26'),
(2,'songjiang','123456','宋江',1,'13309090002',2,8600,'01.png','2015-01-01',2,'2023-10-20 16:35:33','2023-10-20 16:35:37'),
(3,'lujunyi','123456','盧俊義',1,'13309090003',2,8900,'01.png','2008-05-01',2,'2023-10-20 16:35:33','2023-10-20 16:35:39'),
(4,'wuyong','123456','吳用',1,'13309090004',2,9200,'01.png','2007-01-01',2,'2023-10-20 16:35:33','2023-10-20 16:35:41'),
(5,'gongsunsheng','123456','公孫勝',1,'13309090005',2,9500,'01.png','2012-12-05',2,'2023-10-20 16:35:33','2023-10-20 16:35:43'),
(6,'huosanniang','123456','扈三娘',2,'13309090006',3,6500,'01.png','2013-09-05',1,'2023-10-20 16:35:33','2023-10-20 16:35:45'),
(7,'chaijin','123456','柴進',1,'13309090007',1,4700,'01.png','2005-08-01',1,'2023-10-20 16:35:33','2023-10-20 16:35:47'),
(8,'likui','123456','李逵',1,'13309090008',1,4800,'01.png','2014-11-09',1,'2023-10-20 16:35:33','2023-10-20 16:35:49'),
(9,'wusong','123456','武松',1,'13309090009',1,4900,'01.png','2011-03-11',1,'2023-10-20 16:35:33','2023-10-20 16:35:51'),
(10,'linchong','123456','林沖',1,'13309090010',1,5000,'01.png','2013-09-05',1,'2023-10-20 16:35:33','2023-10-20 16:35:53'),
(11,'huyanzhuo','123456','呼延灼',1,'13309090011',2,9700,'01.png','2007-02-01',2,'2023-10-20 16:35:33','2023-10-20 16:35:55'),
(12,'xiaoliguang','123456','小李廣',1,'13309090012',2,10000,'01.png','2008-08-18',2,'2023-10-20 16:35:33','2023-10-20 16:35:57'),
(13,'yangzhi','123456','楊志',1,'13309090013',1,5300,'01.png','2012-11-01',1,'2023-10-20 16:35:33','2023-10-20 16:35:59'),
(14,'shijin','123456','史進',1,'13309090014',2,10600,'01.png','2002-08-01',2,'2023-10-20 16:35:33','2023-10-20 16:36:01'),
(15,'sunerniang','123456','孫二娘',2,'13309090015',2,10900,'01.png','2011-05-01',2,'2023-10-20 16:35:33','2023-10-20 16:36:03'),
(16,'luzhishen','123456','魯智深',1,'13309090016',2,9600,'01.png','2010-01-01',2,'2023-10-20 16:35:33','2023-10-20 16:36:05'),
(17,'liying','12345678','李應',1,'13309090017',1,5800,'01.png','2015-03-21',1,'2023-10-20 16:35:33','2023-10-20 16:36:07'),
(18,'shiqian','123456','時遷',1,'13309090018',2,10200,'01.png','2015-01-01',2,'2023-10-20 16:35:33','2023-10-20 16:36:09'),
(19,'gudasao','123456','顧大嫂',2,'13309090019',2,10500,'01.png','2008-01-01',2,'2023-10-20 16:35:33','2023-10-20 16:36:11'),
(20,'ruanxiaoer','123456','阮小二',1,'13309090020',2,10800,'01.png','2018-01-01',2,'2023-10-20 16:35:33','2023-10-20 16:36:13'),
(21,'ruanxiaowu','123456','阮小五',1,'13309090021',5,5200,'01.png','2015-01-01',3,'2023-10-20 16:35:33','2023-10-20 16:36:15'),
(22,'ruanxiaoqi','123456','阮小七',1,'13309090022',5,5500,'01.png','2016-01-01',3,'2023-10-20 16:35:33','2023-10-20 16:36:17'),
(23,'ruanji','123456','阮籍',1,'13309090023',5,5800,'01.png','2012-01-01',3,'2023-10-20 16:35:33','2023-10-20 16:36:19'),
(24,'tongwei','123456','童威',1,'13309090024',5,5000,'01.png','2006-01-01',3,'2023-10-20 16:35:33','2023-10-20 16:36:21'),
(25,'tongmeng','123456','童猛',1,'13309090025',5,4800,'01.png','2002-01-01',3,'2023-10-20 16:35:33','2023-10-20 16:36:23'),
(26,'yanshun','123456','燕順',1,'13309090026',5,5400,'01.png','2011-01-01',3,'2023-10-20 16:35:33','2023-11-08 22:12:46'),
(27,'lijun','123456','李俊',1,'13309090027',2,6600,'8.png','2004-01-01',2,'2023-10-20 16:35:33','2023-11-16 17:56:59'),
(28,'lizhong','123456','李忠',1,'13309090028',5,5000,'6.png','2007-01-01',3,'2023-10-20 16:35:33','2023-11-17 16:34:22'),
(30,'liyun','123456','李云',1,'13309090030',NULL,NULL,'01.png','2020-03-01',NULL,'2023-10-20 16:35:33','2023-10-20 16:36:31'),
(36,'linghuchong','123456','令狐沖',1,'18809091212',2,6800,'1.png','2023-10-19',2,'2023-10-20 20:44:54','2023-11-09 09:41:04');

員工列表查詢:

基本查詢:

需求:查詢員工信息,并查詢出部門名稱。(涉及到的表:emp,dept)

基本查詢的SQL語句:

select e.*, d.name deptName from emp e left join dept d on e.dept_id = d.id ;

?查詢結果的封裝,需要保證查詢返回的字段名與類中的屬性名保持一致。

在empController編寫查詢全部的方法,調用service層

?

    /*** 基本查詢* @return*/@GetMapping("/list")public Result getList(){List<Emp> empList =  empService.list();return Result.success(empList);}

編寫 empService

  List<Emp> list();

編寫empServiceImpl實現類:

    @Overridepublic List<Emp> list() {return empMapper.getList();}

編寫empMapper

?

    @Select("select e.*,d.name deptName from emp e left join dept d on e.dept_id = d.id")List<Emp> getList();

在Apifox里面測試:

分頁查詢:
原始的分頁查詢:

原始的分頁查詢會執行兩條SQL語句

select * from emp e left join dept d on e.dept_id = d.id limit; 分頁查詢

select count(*)??from emp e left join dept d e.dept_id = d.id;? 查詢數量

前端如何傳遞數據給后端:

當前頁面:page

每頁顯示記錄數: pageSize?

在empController編寫方法:

    @GetMappingpublic Result list(Integer page,Integer pageSize){PageBean pageBean =  empService.getList(page,pageSize);return Result.success(pageBean);}

編寫empService接口:

?

    /*** 分頁查詢* @param page* @param pageSize* @return*/PageBean getList(Integer page, Integer pageSize);

編寫empServiceImpl實現類:

    @Overridepublic PageBean getList(Integer page, Integer pageSize) {//計算起始索引Integer start = (page - 1) * pageSize;//查詢全部數據List<Emp> empList = empMapper.list(start,pageSize);//查詢總的記錄數Long count = empMapper.getCount();return new PageBean(count,empList);}

編寫empMapper接口:

    @Select("select e.*,d.name deptName from emp e left join dept d on e.dept_id = d.id limit #{start},#{pageSize}")List<Emp> list(Integer start, Integer pageSize);@Select("select count(*) from emp left join dept on emp.dept_id = dept.id")Long getCount();

后端給前端返回的數據:

數據列表: List rows;

總記錄數: Long total;

PageHelper分頁插件:

PageHelper 是第三方提供的在mybatis框架中用來實現分頁的插件,用來簡化分頁操作,提高開發效率。?

PageHelper實現機制:

?

使用步驟:
  • ?引入PageHelper的依賴
  • 定義Mapper接口的查詢方法(無需考慮分頁)
  • 在Service方法中實現分頁查詢?

引入依賴:

<!--        分頁插件--><dependency><groupId>com.github.pagehelper</groupId><artifactId>pagehelper-spring-boot-starter</artifactId><version>1.4.7</version></dependency>

?編寫 EmpController層:

    @GetMappingpublic Result list(Integer page,Integer pageSize){PageBean pageBean =  empService.getList(page,pageSize);return Result.success(pageBean);}

編寫EmpService接口:

?

    PageBean getList(Integer page, Integer pageSize);

編寫 EmpServiceImpl實現類:

    /*** PageHeloer分頁查詢* @param page* @param pageSize* @return*/@Overridepublic PageBean getList(Integer page, Integer pageSize) {PageHelper.startPage(page,pageSize);List<Emp> empList = empMapper.PageList();Page<Emp> emps = (Page<Emp>) empList;return new PageBean(emps.getTotal(),emps.getResult());}

編寫EmpMapper接口:

    /*** pageHelper分頁查詢*/@Select("select e.*,d.name deptName from emp e left join dept d on e.dept_id = d.id ")List<Emp> PageList();

?調用Apifox測試:

控制臺:

使用PageHelper分頁插件的注意事項:
  • SQL語句結尾不要加分號(;)
  • PageHelper只會對緊跟在其后的第一條SQL語句進行分頁處理

測試 在SQL語句結尾加分號(;)

    <select id="wherePage" resultType="com.sde.pojo.Emp">select e.*,d.name deptName from emp e left join dept d on e.dept_id = d.id<where><if test="name != null and name != ''">e.name like concat('%',#{name},'%')</if><if test="gender != null">and e.gender = #{gender}</if><if test="begin != null and end != null">and e.entry_date between #{begin} and #{end}</if></where>order by e.update_time desc;</select>

然后啟動項目運行在Apifox測試:

?

控制臺輸出:

因為我們在后面加了分號,所以在最后執行 limit分頁的時候,前面多了一個分號,所以SQL語句就報錯了。

解決辦法:去掉SQL語句后面最后面的一個分號(;)?

2,測試PageHelper之后執行,緊跟在后面的第一條SQL語句進行處理

?我把empMapper.PageList();方法復制一行寫在下面,然后把它執行的SQL語句,強轉成page,最后return出去。

在ApiFox里面測試:

?看看控制臺:

條件分頁查詢:
  • select * from emp e ... where e.name like ?
  • select * from emp e ... where e.gender = ?
  • select * from emp e ... where e.name like ? and e.gender = ?

?接收請求參數:

接收條件分頁查詢的請求參數:GET /emps?name=張&gender=1&begin=2007-09-01&end=2022-09-01&page=1&pageSize=1

通過方法多形參,接收多參數:

就是前端在傳遞條件分頁數據時,有多少參數就,在這個方法里面定義多少形參。

編寫 EmpController

    /*** 條件分頁查詢--多參數接收* @param* @param* @return*/@GetMapping("/getByList")public Result list(String name,Integer gender,@DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate begin,@DateTimeFormat(pattern = "yyyy-MM-dd")  LocalDate end,@RequestParam(defaultValue = "1") Integer page,@RequestParam(defaultValue = "10") Integer pageSize){log.info("接收到前端傳遞來的參數:{},{},{},{},{},{}",name,gender,begin,end,page,pageSize);PageBean pageBean =  empService.moreQuery(name,gender,begin,end,page,pageSize);return Result.success(pageBean);}

編寫EmpService接口:

PageBean moreQuery(String name, Integer gender, LocalDate begin, LocalDate end, Integer page, Integer pageSize);

編寫 EmpServiceImpl實現類:

    @Overridepublic PageBean moreQuery(String name, Integer gender, LocalDate begin, LocalDate end, Integer page, Integer pageSize) {PageHelper.startPage(page,pageSize);List<Emp> empList =  empMapper.getByWhere(name,gender,begin,end);Page p = (Page) empList;return new PageBean(p.getTotal(),p.getResult());}

編寫 EmpMapper接口:

  List<Emp> getByWhere(String name, Integer gender, LocalDate begin, LocalDate end);

EmpMapper.xml配置文件:

在Apifox里面測試:

場景:如果參數個數比較少,建議直接接收即可。 如果參數個數較多,不便于維護和管理

在Controller方法中,通過實體對象接收。

在Controller方法中通過實體對象封裝多個參數。(實體屬性與請求參數名保持一致)

前端的請求:

GET /emps?name=張&gender=1&begin=2007-09-01&end=2022-09-01&page=1&pageSize=10

?定義一個 EmpQuery的實體類:

@Data
public class EmpQuery {private String name;private Integer gender;@DateTimeFormat(pattern = "yyyy-MM-dd")private LocalDate begin;@DateTimeFormat(pattern = "yyyy-MM-dd")private LocalDate end;private Integer page = 1;private Integer pageSize = 10;
}

編寫 EmpController

/*** 條件分頁查詢用對象接收* @param empQuery* @return*/
@GetMapping
public Result listQuery(EmpQuery empQuery){log.info("接收到前端傳遞來的參數:{}",empQuery);PageBean pageBean =  empService.wherePage(empQuery);return Result.success(pageBean);
}

編寫EmpService接口:

    /*** 條件分頁查詢* @param empQuery* @return*/PageBean wherePage(EmpQuery empQuery);

EmpServiceImpl實現類:

    /*** 條件分頁查詢* @param empQuery* @return*/@Overridepublic PageBean wherePage(EmpQuery empQuery) {//設置分壓查詢的參數PageHelper.startPage(empQuery.getPage(), empQuery.getPageSize());// 調用mapper接口,進行條件查詢List<Emp> empList =  empMapper.wherePage(empQuery);//強轉為page類型Page<Emp> page = (Page<Emp>) empList;return new PageBean(page.getTotal(),page.getResult());}

編寫 EmpMapper接口:

    /*** 條件分頁查詢* @param empQuery* @return*/List<Emp> wherePage(EmpQuery empQuery);

EmpMapper.xml配置文件:

    <select id="getByWhere" resultType="com.sde.pojo.Emp">select e.*,d.name deptName from emp e left join dept d on e.dept_id = d.id<where><if test="name != null and name != ''">e.name like concat('%',#{name},'%')</if><if test="gender != null">and e.gender = #{gender}</if><if test="begin != bull and end != null ">and e.entry_date between #{begin} and #{end}</if></where></select>

在Apifox里面測試:

接收時間日期的參數:

@LocalDateTime 這個注解,有一個pattern屬性,可以指定接收前端的數據格式。

@LocalDateTime(pattern="yyyy-MM-dd")

where 標簽的作用:
  • 自動根據條件判定是否添加 where 關鍵字
  • 可以去除掉第一個前面多余的and或or

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/210087.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/210087.shtml
英文地址,請注明出處:http://en.pswp.cn/news/210087.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

極智芯 | 解讀國產AI算力 靈汐產品矩陣

歡迎關注我的公眾號 [極智視界],獲取我的更多經驗分享 大家好,我是極智視界,本文分享一下 解讀國產AI算力 靈汐產品矩陣。 邀您加入我的知識星球「極智視界」,星球內有超多好玩的項目實戰源碼和資源下載,鏈接:https://t.zsxq.com/0aiNxERDq [系列聲明:最近寫了十余篇 &…

低多邊形建筑3D模型紋理貼圖

在線工具推薦&#xff1a; 3D數字孿生場景編輯器 - GLTF/GLB材質紋理編輯器 - 3D模型在線轉換 - Three.js AI自動紋理開發包 - YOLO 虛幻合成數據生成器 - 三維模型預覽圖生成器 - 3D模型語義搜索引擎 當談到游戲角色的3D模型風格時&#xff0c;有幾種不同的風格&#xf…

基于SSM的鞍山職業技術學院圖書借閱管理系統

文章目錄 項目介紹主要功能截圖:部分代碼展示設計總結項目獲取方式?? 作者主頁:超級無敵暴龍戰士塔塔開 ?? 簡介:Java領域優質創作者??、 簡歷模板、學習資料、面試題庫【關注我,都給你】 ??文末獲取源碼聯系?? 項目介紹 基于SSM的鞍山職業技術學院圖書借閱管理…

樹莓派CSI攝像頭在新系統(23年12月)中的不用設置了,沒有開關,也沒有raspistill

網上都是老信息&#xff0c;用的raspistill命令&#xff0c;至少新系統沒有這個東西了&#xff0c;也不會在sudo raspi-config里面也沒有攝像頭的開關了。 ls /dev/video* 能看到攝像頭video0&#xff0c;但是vcgencmd get_camera supported0&#xff0c; detected0&#xff0…

【python】閉包和裝飾器

前置知識&#xff1a; 函數的本質就是變量名可以把函數作為參數傳遞&#xff0c;例如&#xff1a; def func():print("我是func")# 接收的fn是個函數 def handle(fn): # 調用函數fn()handle(func)可以把函數作為返回值返回&#xff0c;例如 def func():def func2(…

CPU的三大調度

計算機系統中的調度可以分為不同層次&#xff0c;包括作業調度、內存調度和進程調度。這三種調度分別負責管理和優化計算機系統中不同層次的資源分配和執行順序。 高級調度&#xff1a;作業調度&#xff08;Job Scheduling&#xff09;&#xff1a; 作業調度是指對提交到計算…

了解c++11中的新增

一&#xff0c;統一的初始化列表 在引入c11后&#xff0c;我們得出計劃都可以用初始化列表進行初始化。 C11 擴大了用大括號括起的列表 ( 初始化列表 ) 的使用范圍&#xff0c;使其可用于所有的內置類型和用戶自 定義的類型&#xff0c; 使用初始化列表時&#xff0c;可添加等…

Vue學習計劃-Vue2--VueCLi(二)vuecli腳手架創建的項目內部主要文件分析

1. 文件分析 1. 補充&#xff1a; 什么叫單文件組件&#xff1f; 一個文件中只有一個組件 vue-cli創建的項目中&#xff0c;.vue的文件都是單文件組件&#xff0c;例如App.vue 2. 進入分析 1. package.json: 項目依賴配置文件&#xff1a; 如圖&#xff0c;我們說主要的屬性…

性能測試經典面試題(帶答案)!

概述一下性能測試流程&#xff1f; 1.分析性能需求。挑選用戶使用最頻繁的場景來測試。確定性能指標&#xff0c;比如&#xff1a;事務通過率 為100%&#xff0c;TOP99%是5秒&#xff0c;最大并發用戶為1000人&#xff0c;CPU和內存的使用率在70%以下2.制定性能測試計劃&…

Ubuntu20.04使用cephadm部署ceph集群

文章目錄 Requirements環境安裝Cephadm部署Ceph單機集群引導&#xff08;bootstrap&#xff09;建立新集群 管理OSD列出可用的OSD設備部署OSD刪除OSD 管理主機列出主機信息添加主機到集群從集群中刪除主機 部署Ceph集群 Cephadm通過在單個主機上創建一個Ceph單機集群&#xff0…

游戲開發庫

整理了38個Python游戲開發庫 https://zhuanlan.zhihu.com/p/505095419 https://zhuanlan.zhihu.com/p/262012936 2023 年最佳游戲引擎推薦 https://zhuanlan.zhihu.com/p/624771157 十大開源游戲引擎深入比較之美 https://blog.51cto.com/u_15273495/2915535 panda3d https:…

【EI會議征稿中】第三屆網絡安全、人工智能與數字經濟國際學術會議(CSAIDE 2024)

第三屆網絡安全、人工智能與數字經濟國際學術會議&#xff08;CSAIDE 2024&#xff09; 2024 3rd International Conference on Cyber Security, Artificial Intelligence and Digital Economy 第二屆網絡安全、人工智能與數字經濟國際學術會議&#xff08;CSAIDE 2023&…

Verilog基礎:寄存器輸出的兩種風格

相關文章 Verilog基礎https://blog.csdn.net/weixin_45791458/category_12263729.html?spm1001.2014.3001.5482 Verilog中的寄存器操作一般指的是那些對時鐘沿敏感而且使用非阻塞賦值的操作。例如狀態機中的狀態轉移&#xff0c;實際上就是一種寄存器操作&#xff0c;因為這相…

聽GPT 講Rust源代碼--src/tools(10)

File: rust/src/tools/rust-analyzer/crates/ide-assists/src/handlers/generate_is_empty_from_len.rs 在Rust源代碼中&#xff0c;rust-analyzer是一個Rust語言的IDE插件和代碼分析器。其中&#xff0c;generate_is_empty_from_len.rs是rust-analyzer中的一個處理程序&#x…

終于有人把tcp、http、rpc和grpc總結完整了

隨著微服務的迅速發展&#xff0c;各大互聯網企業也投入到微服務的?使用種。微服務最大的特點是&#xff0c;跨進程、跨服務、跨語言之間的調用&#xff0c;使得我們能夠像調用本地類、函數一樣。當微服務具備該特點&#xff0c;將我們復雜的業務拆分成不同的服務&#xff0c;…

CentOS7安裝Docker,DockerCompose

安裝docker 1、卸載docker 查看是否有舊版本docker docker info首先檢測我們虛擬機是否已經安裝過Docker&#xff0c;如果安裝則需卸載。代碼中“\”符號為換行符&#xff0c;相當于一行內容分為多行&#xff0c;這是檢測docker的各種組件 yum remove docker \docker-clien…

VGG模型

概念&#xff1a; CNN感受野 在卷積神經網絡中&#xff0c;決定某一層輸出結果中的一個元素所對應的輸入層的區域大小&#xff0c;被稱作感受野&#xff08;receptive field&#xff09;。通俗的解釋是&#xff0c;輸出feature map上的一個單元對應輸入層上的區域大小。 VGG…

協同過濾算法springboot+java+ssm高校圖書館圖書借閱管理系統k32vr

課題主要分為四大模塊&#xff1a;即管理員模塊&#xff0c;員工模塊&#xff0c;教師模塊和學生模塊&#xff0c;主要功能包括&#xff1a;首頁&#xff0c;個人中心&#xff0c;員工管理&#xff0c;學生管理&#xff0c;教師管理&#xff0c;圖書分類管理&#xff0c;圖書信…

wsl2 ubuntu上搭建OpenIM

文檔 踩坑 版本要選擇好&#xff0c;不要直接main來跑&#xff0c;目前版本OpenIMServer 有release-v3.3和release-v3.4&#xff0c;對應Chat版本的release-v1.4和release-v1.4。但我跑3.4是有問題的&#xff0c;切到3.3可以跑通。export OPENIM_IP"http://ip:10002"…

HNU計算機結構體系-實驗2:CPU動態指令調度Tomasulo

文章目錄 實驗2 CPU動態指令調度Tomasulo一、實驗目的二、實驗說明三、實驗內容問題1&#xff1a;問題2&#xff1a;問題3&#xff1a;問題4&#xff1a;問題5&#xff1a; 四、思考題問題1&#xff1a;問題2&#xff1a; 五、實驗總結 實驗2 CPU動態指令調度Tomasulo 一、實驗…