校园卡管理系统数据库设计 - read.ppt
* * * * 校园卡管理系统数据库设计 2007级电子商务071班 李国鹏 2009-7-5 * Outline 一、系统总体概况 二、主要的存储过程 三、两个重要的触发器 * 一、系统总体概况 * 设计目的: 集管理、消费、身份认证“三位一体” 方便学生食堂消费、超市消费 方便老师上课考勤 方便宿舍进出管理 方便学校各类奖助学金的发放 可扩充其他功能 * 系统总体E_R图: * 系统实现的主要功能: 查询和更新: 1、各种类型充值信息 2、每个食堂、超市月收入信息 3、持卡学生在校月消费信息 4、持卡学生上课考勤信息 5、持卡学生回宿舍信息 * 二、主要的存储过程 1、各种类型充值查询 * 2、每个食堂、超市月收入信息 查询各个食堂、超市七月份的收入情况 create proc Din___Sup_Month As select Place,Pno,sum(Pmoney) 七月份的收入 from PressInf where Ptime>='2009-07-01 12:00:00.000' and Ptime<='2009-07-31 23:00:00.000' group by Place,Pno 调用存储过程: exec Din___Sup_Month * 2、每个食堂、超市月收入信息 * 3、持卡学生在校月消费信息 查询所有学生某个时间段内(七月份)的食堂和超市消费总额 create proc student_month_Din_Sup_Press @starttime datetime,@endtime datetime as select student.Sno,student.Sname,student_Din_Sup_Press.Cardno,sum(Pmoney)month_Totalmoney from student_Din_Sup_Press,student where student_Din_Sup_Press.Sno=student.Sno and Ptime>=@starttime and Ptime<=@endtime group by student.Sno,student.Sname,student_Din_Sup_Press.Cardno 调用存储过程: exec student_month_Din_Sup_Press1 '2009-07-01 12:00:00.000','2009-07-31 12:00:00.000' * 3、学生在食堂超市月消费情况 * 4、高飞七月份在超市刷卡消费的信息 create proc one_student_month_Din_Sup_Press @starttime datetime,@endtime datetime,@sname char(10),@place char(10) as select student.Sno,student.Sname,student_Din_Sup_Press.Cardno,sum(Pmoney)month_Totalmoney from student_Din_Sup_Press,student where student_Din_Sup_Press.Sname=@sname and student_Din_Sup_Press.Place=@place and student_Din_Sup_Press.Sno=student.Sno and Ptime>=@starttime and Ptime<=@endtime group by student.Sno,student.Sname,student_Din_Sup_Press.Cardno 调用存储过程: exec one_student_month_Din_Sup_Press '2009-07-01 12:00:00.000','2009-07-31 12:00:00.000','高飞','超市' * 4、高飞七月份在超市消费总额 * 5、持卡学生上课考勤信息 各门课程某次(某一天)上课时学生到课考勤记录情况(每次上课每个学生只刷一次卡) create proc each_course_Press as select Cname,count(distinct Classno) 到课人数 from courPress where Classtime>='2009-06-29 14:20:00.000' and Classtime<='2009-6-29 14:25:00' group by Cname 调用存储过程: exec each_course_Press