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.课程总结