竹笋

注册

 

发新话题 回复该主题

数据库原理课程设计 [复制链接]

1#
老牌白癜风专业医院 https://wapjbk.39.net/yiyuanzaixian/bjzkbdfyy/xcxbdf/
老牌白癜风专业医院 https://wapjbk.39.net/yiyuanzaixian/bjzkbdfyy/xcxbdf/

一、需求分析

1.1面向用户及需求分析:

本系统着重面向于公司得员工以及接受货物得司机

本系统着重于对物流公司的货物信息与车辆信息进行设计。最主要功能在于将货物的信息与车辆信息相匹配。如一类货物是否已经被运输,而运输这批货物的车辆信息是否是正确匹配的;又或者对于尚未发出的闲置货物,可以及时找到未调派的空闲运输车辆与之匹配派送,并在货物派送后及时对车辆与货物的状态信息进行修改。货物编号,待发货时间,是否发送,送货路途状况等信息都可以作为货物对象的属性进行采集记录。同时另外分出车辆模块专门对物流公司的车辆信息进行管理,将车辆编号,车辆使用情况等信息整合于数据库中

1.2项目拟实现功能模块

数据库管理模块:

用于对数据库的操作,包括导入数据,数据转存,数据修改,数据清除等综合性功能。

基础资料管理模块:

1、用于对车辆资料信息以及物流货物有关资料的记录整理与维护

2、用于对司机基础资料进行整理

托运信息匹配模块:

对车辆调度信息、托运申请信息、验收信息的管理更新,并对两边的信息进行筛选匹配,确保货物都有车辆进行配送,未指派的车辆也能合理有效的调用。

二.概念结构设计

2.1系统功能分析

该系统面向于公司员工以及司机

1、可以进行司机得登录和注册

2、登录完成后,司机可以查询货物得数量以及状态

3、司机可以根据状态进行接单

4、接单完成后司机可以进行任务完成选项,并可以查询自己任务和任务状态

2.2实体对应关系

司机与货物:1:n

车辆与货物:1:n

司机与车辆:1:1

司机与登录日志:1:n

2.3E-R图

图2.1

三.逻辑结构设计

3.1实体与数据

司机(司机编号,司机名称,司机电话,司机车牌)

货物(货物编号,货物名称,始发地,目的地,状态)

3.2约束条件

1、编号不能为空,并且由系统自动分配

2、司机和车辆为一比一的关系

3、接过单的货物不允许在接单

4、已完成的任务的状态不允许更改

四.物理结构设计

3.1表汇总

3.2Goods

3.3Driver

3.4SmallCarsDriver

3.5LCCargos

四.数据库应用系统的软件说明

4.1软件开发的主要工具

数据库的选择:MySql的8.2.3版本

优点:它使用的核心线程是完全多线程,支持多处理器。

1.有多种列类型:1、2、3、4、和8字节长度自有符号/无符号整数、FLOAT、DOUBLE、CHAR、VARCHAR、TEXT、BLOB、DATE、TIME、DATETIME、TIMESTAMP、YEAR、和ENUM类型。

2.它通过一个高度优化的类库实现SQL函数库并像他们能达到的一样快速,通常在查询初始化后不该有任何内存分配。没有内存漏洞。

开发软件:netbeans

NetBeans在图形化建立时会更加的简单,并支持JAVA语言

4.2应用系统实现

4.2.1源代码

/*

*Tochangethislicenseheader,chooseLicenseHeadersinProjectProperties.

*Tochangethistemplatefile,chooseTools

Templates

*andopenthetemplateintheeditor.

*/

packagedrivertaskmanager;

importjava.awt.event.WindowAdapter;

importjava.awt.event.WindowEvent;

importjavax.swing.JOptionPane;

/**

*

*

authorAdministrator

*/

publicclassLoginJFrameextendsjavax.swing.JFrame{

DataBaseSqlm_dataBase;

Stringm_return="";

MainJFramem_parent;

/**

*CreatesnewformLoginJFrame

*/

publicLoginJFrame(){

initComponents();

setLocationRelativeTo(null);

m_dataBase=newDataBaseSql();

m_dataBase.init("root","a");

addWindowListener(newWindowAdapter(){

publicvoidwindowClosing(WindowEvente){

super.windowClosing(e);

//加入动作

m_dataBase.close();

}

});

}

/**

*Thismethodiscalledfromwithintheconstructortoinitializetheform.

*WARNINGoNOTmodifythiscode.Thecontentofthismethodisalways

*regeneratedbytheFormEditor.

*/

SuppressWarnings("unchecked")

//editor-folddefaultstate="collapsed"desc="GeneratedCode"//GEN-BEGIN:initComponents

privatevoidinitComponents(){

jPanel1=newjavax.swing.JPanel();

jLabel1=newjavax.swing.JLabel();

jLabel2=newjavax.swing.JLabel();

textField_id=newjava.awt.TextField();

textField_password=newjava.awt.TextField();

jButton_login=newjavax.swing.JButton();

jButton_register=newjavax.swing.JButton();

jButton_modify=newjavax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

setTitle("登录");

jLabel1.setText("编号:");

jLabel2.setText("密码:");

jButton_login.setText("登录");

jButton_login.addActionListener(newjava.awt.event.ActionListener(){

publicvoidactionPerformed(java.awt.event.ActionEventevt){

jButton_loginActionPerformed(evt);

}

});

jButton_register.setText("注册");

jButton_register.addActionListener(newjava.awt.event.ActionListener(){

publicvoidactionPerformed(java.awt.event.ActionEventevt){

jButton_registerActionPerformed(evt);

}

});

jButton_modify.setText("修改");

jButton_modify.addActionListener(newjava.awt.event.ActionListener(){

publicvoidactionPerformed(java.awt.event.ActionEventevt){

jButton_modifyActionPerformed(evt);

}

});

javax.swing.GroupLayoutjPanel1Layout=newjavax.swing.GroupLayout(jPanel1);

jPanel1.setLayout(jPanel1Layout);

jPanel1Layout.setHorizontalGroup(

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel1Layout.createSequentialGroup()

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jLabel1)

.addComponent(jLabel2))

.addGap(26,26,26)

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(textField_id,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,Short.MAX_VALUE)

.addComponent(textField_password,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,Short.MAX_VALUE)))

.addGroup(jPanel1Layout.createSequentialGroup()

.addComponent(jButton_modify)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,43,Short.MAX_VALUE)

.addComponent(jButton_login,javax.swing.GroupLayout.PREFERRED_SIZE,57,javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(42,42,42)

.addComponent(jButton_register))

);

jPanel1Layout.setVerticalGroup(

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel1Layout.createSequentialGroup()

.addContainerGap(20,Short.MAX_VALUE)

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addComponent(jLabel1)

.addComponent(textField_id,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(26,26,26)

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addComponent(jLabel2)

.addComponent(textField_password,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(23,23,23)

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jButton_login)

.addComponent(jButton_register)

.addComponent(jButton_modify))

.addContainerGap())

);

javax.swing.GroupLayoutlayout=newjavax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,layout.createSequentialGroup()

.addContainerGap(43,Short.MAX_VALUE)

.addComponent(jPanel1,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(40,40,40))

);

layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGap(29,29,29)

.addComponent(jPanel1,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE)

.addContainerGap(29,Short.MAX_VALUE))

);

pack();

}///editor-fold//GEN-END:initComponents

privatevoidjButton_loginActionPerformed(java.awt.event.ActionEventevt){//GEN-FIRST:event_jButton_loginActionPerformed

//TODOaddyourhandlingcodehere/p>

if(login_succeed()){

this.dispose();

MainJFramemainfrm=newMainJFrame(m_dataBase);

Integerdriver_id=Integer.valueOf(textField_id.getText());

mainfrm.setDriverId(driver_id);

mainfrm.setVisible(true);

}

}//GEN-LAST:event_jButton_loginActionPerformed

privatebooleanlogin_succeed(){

//TODOaddyourhandlingcodehere/p>

if(textField_id.getText().isEmpty())

JOptionPane.showMessageDialog(this,"请输入司机编号!");

elseif(textField_password.getText().isEmpty())

JOptionPane.showMessageDialog(this,"请输入密码!");

else{

Integerdriver_id=Integer.valueOf(textField_id.getText());

if(driver_id==null)

JOptionPane.showMessageDialog(this,"司机编号需要是数字!");

Stringresult=m_dataBase.verifyUserPassword(driver_id,textField_password.getText());

if(result.equals("OK")==false){

JOptionPane.showMessageDialog(this,result);

returnfalse;

}

returntrue;

}

returnfalse;

}

privatevoidjButton_registerActionPerformed(java.awt.event.ActionEventevt){//GEN-FIRST:event_jButton_registerActionPerformed

//TODOaddyourhandlingcodehere/p>

this.dispose();

RegisterJFramere_frame=newRegisterJFrame(-1,m_dataBase);

re_frame.setVisible(true);

}//GEN-LAST:event_jButton_registerActionPerformed

privatevoidjButton_modifyActionPerformed(java.awt.event.ActionEventevt){//GEN-FIRST:event_jButton_modifyActionPerformed

//TODOaddyourhandlingcodehere/p>

if(login_succeed()){

this.dispose();

Integerdriver_id=Integer.valueOf(textField_id.getText());

RegisterJFramere_frame=newRegisterJFrame(driver_id,m_dataBase);

re_frame.setVisible(true);

}

}//GEN-LAST:event_jButton_modifyActionPerformed

publicstaticvoidmain(Stringargs[]){

newLoginJFrame().setVisible(true);

}

//Variablesdeclaration-donotmodify//GEN-BEGIN:variables

privatejavax.swing.JButtonjButton_login;

privatejavax.swing.JButtonjButton_modify;

privatejavax.swing.JButtonjButton_register;

privatejavax.swing.JLabeljLabel1;

privatejavax.swing.JLabeljLabel2;

privatejavax.swing.JPaneljPanel1;

privatejava.awt.TextFieldtextField_id;

privatejava.awt.TextFieldtextField_password;

//Endofvariablesdeclaration//GEN-END:variables

}

4.2.2运行截图

分享 转发
TOP
发新话题 回复该主题