1.課程介紹
愛慕課OA系統
前置條件:Mybatis、Spring、SpringMVC、Mysql
主要技術:Spring IOC、 Mybatis+Spring整合、聲明式事務、Spring標簽庫、Spring攔截器
開發環境
操作系統:win10
數據庫:Mysql-5.7
Web容器:Tomcat-8.5
開發工具:IntelliJ IDEA
2.案例展示
用例分析
功能模塊
部門信息管理
員工信息管理
報銷單處理
主要角色
員工
部門經理
總經理
財務
相關材料
Spring:5.2.4.RELEASE
Mybatis:3.5.1
文檔:配置文件模板、頁面原型
項目結構
三層架構
持久層-Mybatis
表現層-SpringMVC
業務層-JavaBean
基於MVC模式
視圖-JSP
模型-JavaBean
控制器-Spring Controller
3.項目搭建
創建(搭建數據庫)

1 drop database if exists oa; 2 3 create database oa; 4 use oa; 5 6 /*==============================================================*/ 7 /* Table: claim_voucher */ 8 /*==============================================================*/ 9 create table claim_voucher 10 ( 11 id int not null auto_increment, 12 cause varchar(100), 13 create_sn char(5), 14 create_time datetime, 15 next_deal_sn char(5), 16 total_amount double, 17 status varchar(20), 18 primary key (id) 19 ); 20 21 /*==============================================================*/ 22 /* Table: claim_voucher_item */ 23 /*==============================================================*/ 24 create table claim_voucher_item 25 ( 26 id int not null auto_increment, 27 claim_voucher_id int, 28 item varchar(20), 29 amount double, 30 comment varchar(100), 31 primary key (id) 32 ); 33 34 /*==============================================================*/ 35 /* Table: deal_record */ 36 /*==============================================================*/ 37 create table deal_record 38 ( 39 id int not null auto_increment, 40 claim_voucher_id int, 41 deal_sn char(5), 42 deal_time datetime, 43 deal_way varchar(20), 44 deal_result varchar(20), 45 comment varchar(100), 46 primary key (id) 47 ); 48 49 /*==============================================================*/ 50 /* Table: department */ 51 /*==============================================================*/ 52 create table department 53 ( 54 sn char(5) not null, 55 name varchar(20), 56 address varchar(100), 57 primary key (sn) 58 ); 59 60 /*==============================================================*/ 61 /* Table: employee */ 62 /*==============================================================*/ 63 create table employee 64 ( 65 sn char(5) not null, 66 password varchar(20), 67 name varchar(20), 68 department_sn char(5), 69 post varchar(20), 70 primary key (sn) 71 ); 72 73 alter table claim_voucher add constraint FK_Reference_2 foreign key (next_deal_sn) 74 references employee (sn) on delete restrict on update restrict; 75 76 alter table claim_voucher add constraint FK_Reference_3 foreign key (create_sn) 77 references employee (sn) on delete restrict on update restrict; 78 79 alter table claim_voucher_item add constraint FK_Reference_4 foreign key (claim_voucher_id) 80 references claim_voucher (id) on delete restrict on update restrict; 81 82 alter table deal_record add constraint FK_Reference_5 foreign key (claim_voucher_id) 83 references claim_voucher (id) on delete restrict on update restrict; 84 85 alter table deal_record add constraint FK_Reference_6 foreign key (deal_sn) 86 references employee (sn) on delete restrict on update restrict; 87 88 alter table employee add constraint FK_Reference_1 foreign key (department_sn) 89 references department (sn) on delete restrict on update restrict; 90 91 insert into department values('10001','總經理辦公室','星星大廈E座1201'); 92 insert into department values('10002','財務部','星星大廈E座1202'); 93 insert into department values('10003','事業部','星星大廈E座1101'); 94 95 insert into employee values('10001','000000','劉備','10001','總經理'); 96 insert into employee values('10002','000000','孫尚香','10002','財務'); 97 insert into employee values('10003','000000','關羽','10003','部門經理'); 98 insert into employee values('10004','000000','周倉','10003','員工');
4.功能實現
5.課程總結