数据库概论课程设计-汽车租赁公司数据库系统的设计

1.需求分析

1.1系统需求

进入新的世纪以来,经济的快速发展,让很多东西都快速的淘汰了,好多新型的东西也逐渐进入我的视野,而更有好多以前很贵的东西,渐渐降价普及了,汽车逐渐走进了千家万户。而汽车作为一种高价位消费品,结合我国低购买力的国情,很多人就买不起汽车了,所以公司推出了一种新的业务: 汽车租赁。汽车租赁主要就是给需要用车的客户提供租车业务,前台主要包括客户注册、查看车辆信息、租车服务等,后台主要包括车辆信息的管理、客户的基本信息、门店的管理等,真正使车辆租赁变得更加便利,快捷。为了使客户租用汽车更加方便快捷,租赁公司员工减少工作量。主要要考虑最基本的车辆信息需求,应该具有如下功能: 用户注册、租车业务、还车业务、车辆信息的管理等等。一个汽车租赁系统有了这些功能的话本质上就能够形成一个规模不大的汽车租赁公司,让客户进行租用汽车更加便捷,租赁公司工作量也大大减少。

1.1.1功能需求

汽车租赁系统是为了让客户进行租用汽车更加便捷,使租赁公司管理更加规范,工作量大大减少。本系统主要是针对租赁公司租赁汽车需求所设计的,可以很好的管理数据。本系统的主要功能由以下几个部分组成:

经过调研及分析,汽车租赁系统主要完成以下功能:

(1)员工基本信息模块:员工的基本信息。

(2)部门信息管理模块:公司部门信息管理。

(3)角色信息、资源信息、角色资源权限管理:对系统所有涉及角色、资源、角色资源权限进行统一分配管理。

(4)客户可通过登录系统,交互系统录入租车城市、目的地城市、车辆需求、是否需要驾驶员、使用天数等信息筛选浏览出可选车型、报价、注意事项等。客户自行选择,进行下单,并提交相关资料(身份证、驾驶证等)系统形成订单。最后到下单门店进行租赁、还车。

(5)客户在发生故障问题过程中,联系客服进行车辆维修换车。

(6)客户信息管理,平台对平台注册客户信息、等级等信息全部统一管理。

(6)公司门店统一管理,对门店人员、车辆情况等统一进行管理。

(7) For vehicle supplier management, it is necessary to conduct unified management of the supplier information of the purchased vehicles, so as to facilitate the processing of business problems in the later stage.

(8) Employee salary management module: that is, adding, deleting, modifying and querying employee salary information.

1.1.2 Structural requirements

Client needs:

Background management requirements:

 1.1.3 Conclusion

This section analyzes the various requirements of the car rental system, and clarifies the overall requirements of the system. 

1.2 User Design

According to the requirements, the system divides users into two types: employees of the leasing company and customers, and each type of user has its own authority and responsibility.

1.2.1 Clients

Customer authority is limited to front-end operations, new user registration is possible, and existing account can also be used to log in directly: you can view information about vehicles that can be rented, such as vehicle license plate number, model, color, brand, displacement, daily rent, photos, etc. Information, customers can also rent a car, return a car, view historical car rental records and other operations.

1.2.2 Lease company employees

Employees of the leasing company can perform background operations, and need to be able to manage basic vehicle information, customer personal information, delivery provider information, use information management, store information, rental information, management of various departments of the company, roles, employee personal information and salary management, and Management of data.

1.3 Character Design

According to research and analysis, the role setting of the system needs to be divided according to the front and back ends. The roles of the background management system are divided into: the reception staff of the leasing company, the administrator of the leasing company, the vehicle maintenance personnel of the leasing company, and the driver of the leasing company. Customers of the front desk leasing system are divided into platinum card customers, gold card customers, silver card customers and general customers.

(1) The role of the background management system

·Leasing company reception staff: receive customers who come to pick up the car.

·Leasing company administrator: manage information such as users, departments, and vehicles of the system.

·Leasing company vehicle maintenance personnel: maintain and repair the vehicles.

·Leasing company drivers: provide services for customers who need to provide driving services.

(2) The role of the front desk leasing system 

Leasing vehicles on the platform provides different services for different customers.

1.4 Conclusion

This section mainly designs and divides the users and roles of the system in detail. First, it introduces the users of the system, and then introduces the front and back roles of the system, and also gives their respective role responsibilities.

2. Concept and logic design

This chapter mainly introduces the functions of the system as a whole, so that we can have a comprehensive understanding of the system. Let us have a comprehensive grasp of the system.

2.1 Functional Design

(1) Before designing a system, you must first come up with an idea. You must first think about what kind of system you want to build, then analyze the requirements of the system and the functions to be realized, and then make a plan. First of all, we need to analyze the system. The purpose of system analysis is to formulate the most practical and effective system according to the needs of users. At the same time, we will see whether it is feasible to make this system, whether it is economically acceptable, whether the cost will be too large and technically. Is it feasible, can the system be made, so cost control must be carried out, and time must be limited at the same time, so that it cannot take too long. First, we need to build a model. According to the requirements of our system, the system structure is shown in Figure 2.1:

(2) The front desk of the car rental system is mainly used to rent cars to customers, and it mainly includes two aspects: the user's personal information and car rental services. Among them, personal information is divided into addition of personal information and modification of personal information. The car rental service is divided into four parts: browsing vehicle information, renting a car, viewing car rental records and returning the car. As shown in Figure 2.2:

(3) The background management system staff manages, followed by the management of role information, department information, resource permissions, customer information, car rental information, car information, store information, supplier information, car rental information, etc., including adding them, Modify, query, delete and other operations. As shown in Figure 2.3:

2.1.1 Sub-ER Diagram

ER diagrams, also known as entity-relationship diagrams (Entity Relationship Diagram), provide methods for representing entity types, attributes, and connections, and are used to describe the conceptual model of the real world. The ER diagrams of this system mainly include employee information ER diagrams, department information ER diagrams, role information ER diagrams, authority information ER diagrams, customer information ER diagrams, car rental information ER diagrams, maintenance information ER diagrams, vehicle information ER diagrams, suppliers Information ER diagram, insurance information ER diagram, employee salary ER diagram.

(1) User employee information ER diagram:

 (2) Department information ER diagram

(3) Role information ER diagram

(4) Permission information ER diagram

(5) Driver's detailed information ER diagram

(6) Customer information ER diagram

(7) Vehicle information ER diagram

(8) ER diagram of usage information

 

(9) Supplier information ER diagram

 (10) Store information ER diagram

(11) Maintenance information ER diagram

(12) ER diagram of rental vehicle information

(13) ER diagram of employee salary information

2.1.2 Overall ER Diagram

 2.1.3 Conclusion

This section mainly divides the functional pages of the system in detail. First, it introduces the overall structure diagram of the system, and then introduces the foreground function diagram and background function diagram of the system, and draws the ER of each part of the system. diagram and its total ER diagram. 

2.2 Logic Design

Logical structure design is to transform the conceptual model completed in the conceptual structure design stage into a data model that can be supported by the selected database management system (DBMS). Here, the ER model is mainly converted into a relational model. It is necessary to specify the global logical structure of the database after decomposing and merging the original data, including the determined keywords and attributes, the re-determined record structure and file structure, and the relationship between the established files. The database administrator's view of this database. The general logic design is divided into the following three steps: initial relational schema design, relational schema design, and schema analysis.

2.2.1 Relational schema design

Relationship model: user information (user number, contact information, home address, entry time, user name,

password, gender, department, role, status, login time, belonging store)

Mode determination: user information ∈ 2NF, and each non-primary attribute does not transfer function depends on user information

The primary relationship key of information, so user information ∈ 3NF

Relationship schema: department information (department name, department number, department supervisor, enabled status)

Mode determination: departmental information ∈ 2NF, and each non-primary attribute does not transfer function depends on departmental information

The primary relationship key of information, so department information ∈ 3NF

Relationship mode: role information (role name, role number, enabled status)

Mode judgment: role information ∈ 2NF, and no transfer function of each non-primary attribute depends on salary information

The primary relationship key of the information, so the role information ∈ 3NF

Relationship mode: resource information (resource name, resource URL, parent resource, serial number)

Mode judgment: resource information ∈ 2NF, and each non-primary attribute does not transfer function dependent on the primary relationship key of attendance information, so resource information ∈ 3NF

Relationship model: customer information (customer name (or unit name), home address (or business address), contact number, e-mail, user login name, password, ID number, driver's license number, business license, customer type, customer level ,Remark)

Mode determination: customer information ∈ 2NF, and each non-primary attribute does not transfer function depends on allowance information

The primary relationship key of information, so customer information ∈ 3NF

Relationship model: vehicle information (vehicle number, license plate number, color, brand, model, displacement, mileage traveled, photos, daily rent, vehicle introduction, lease status, supplier, remarks)

Mode determination: vehicle information ∈ 2NF, and each non-primary attribute does not transfer function dependent on the primary relationship key of subsidy information, so vehicle information ∈ 3NF

Relationship mode: usage information (purpose id, usage, enabled status)

Mode determination: use information ∈ 2NF, and each non-primary attribute does not transfer function dependent on the primary relationship key of allowance information, so use information ∈ 3NF

Relationship model: vehicle supplier information (manufacturer name, manufacturer contact person, manufacturer contact number, vehicle quantity, purchase time, vehicle unit price, vehicle total price, contract photo, other agreements)

Mode determination: vehicle supplier information ∈ 2NF, and each non-primary attribute does not transfer function depends on subsidy information

The primary relationship key of the information, so the vehicle supplier information ∈ 3NF

Relationship model: store information (store name, province, city, county, detailed location, store phone number, store manager, store manager phone number, store establishment time, store introduction)

Mode determination: store information ∈ 2NF, and each non-primary attribute does not transfer function dependent on the primary relationship key of subsidy information, so store information ∈ 3NF

Relationship model: rental vehicle record information (car rental time, return time, rental vehicle, whether there is a driver, number of days of rental, car rental store, rental unit price, total rental price, ID number, ID photo, driver’s license photo, car, car return store, customer service tracker, order time, whether to pick up the car, driver)

Mode determination: rental vehicle record information ∈ 2NF, and each non-primary attribute does not have a transfer function dependent on the primary relationship key of the subsidy information, so the rental vehicle record information ∈ 3NF

Relationship mode: employee salary information (employee id, basic salary, performance salary, deduction salary, seniority salary, remarks)

Mode determination: employee salary information ∈ 2NF, and each non-primary attribute does not transfer function dependent on the primary relationship key of allowance information, so employee salary information ∈ 3NF

Relationship model: maintenance information (maintenance vehicle, maintenance person, maintenance content, maintenance time, remarks)

Mode judgment: maintenance information ∈ 2NF, and each non-primary attribute does not transfer the primary relationship key of the subsidy information, so the maintenance information ∈ 3NF

No matter what kind of system it is, there must be a database, and the database is an indispensable part of system design, so let's introduce the database of this system below. A database refers to a collection of data that is stored together in a certain way, can be shared by multiple users, has as little redundancy as possible, and is independent of the application program. According to the ER diagram and its relationship model design, the following database table structure is obtained.

The database table structure is as follows:

Table 2.1 User table s_user

attribute name

field name

type of data

length

Is it allowed to be empty

Whether primary key

table id

id

int

10

not allowed

yes

user's real name

realname

varchar

40

not allowed

no

Contact information

phone

varchar

11

not allowed

no

family address

address

varchar

100

not allowed

no

Entry Time

lastLogin

varchar

30

not allowed

no

username

username

varchar

40

not allowed

no

password

pwd

varchar

10

not allowed

no

Gender (1 male 0 female)

sex

int

10

not allowed

no

Belonging department

deptId

int

10

not allowed

no

Affiliated role

roleId

int

10

not allowed

no

Status (1 working 0 leaving)

status

int

10

not allowed

no

last login time

lastLogin

varchar

30

allow

no

Belonging store

isLong

int

10

not allowed

no

Table 2.2 Department table s_dept

attribute name

field name

type of data

length

Is it allowed to be empty

Whether primary key

table id

id

int

10

not allowed

yes

Department name

deptName

varchar

20

not allowed

no

Department Number

deptCode

varchar

10

not allowed

no

Enable status (1 enable 0 disable)

status

int

10

not allowed

no

director

userId

int

10

not allowed

no

Table 2.3 role table s_role

attribute name

field name

type of data

length

Is it allowed to be empty

Whether primary key

table id

id

int

10

not allowed

yes

Role Name

roleName

varchar

20

not allowed

no

role number

roleCode

varchar

10

not allowed

no

Enable status (1 enable 0 disable)

status

int

10

not allowed

no

Table 2.4 resource table s_resource

attribute name

field name

type of data

length

Is it allowed to be empty

Whether primary key

table id

id

int

10

not allowed

yes

Resource Name

resourceName

varchar

20

not allowed

no

Resource URL

resourceUrl

varchar

30

not allowed

no

superior id

pid

int

10

not allowed

no

serial number

icon

int

10

not allowed

no

Table 2.5 Resource permission table s_roleresource

attribute name

field name

type of data

length

Is it allowed to be empty

Whether primary key

table id

id

int

10

not allowed

yes

role id

roleId

int

20

not allowed

no

resource id

resourceId

int

30

not allowed

no

Table 2.6 Driver Information Supplementary Table s_detail

attribute name

field name

type of data

length

Is it allowed to be empty

Whether primary key

table id

id

int

10

not allowed

yes

user id

userId

int

10

not allowed

no

driving age

age

int

10

not allowed

no

driver's license picture

url

varchar

30

not allowed

no

ID photo

card_url

varchar

30

not allowed

no

Experience introduction

introduce

text

255

not allowed

no

Table 2.7 Customer information table c_customer

attribute name

field name

type of data

length

Is it allowed to be empty

Whether primary key

table id

id

int

10

not allowed

yes

Customer name (or unit name)

customerName

varchar

30

not allowed

no

Home address (or business address)

customerAddress

varchar

200

not allowed

no

contact number

phone

varchar

11

not allowed

no

email

email

varchar

30

not allowed

no

user login name

loginName

varchar

30

not allowed

no

password

pwd

varchar

20

not allowed

no

ID photo

cardPic

varchar

100

not allowed

no

driver license

jashiPic

varchar

100

not allowed

no

Business license (required for businesses)

picUrl

varchar

100

allow

no

Customer type (1 enterprise 0 individual)

flag

int

10

not allowed

no

customer registration

grade

int

10

not allowed

no

Remark

other

text

255

allow

no

Table 2.7 Vehicle information table c_vehicle

attribute name

field name

type of data

length

Is it allowed to be empty

Whether primary key

table id

id

int

10

not allowed

yes

vehicle number

vehicleCode

varchar

10

not allowed

no

number plate

vehicleNumber

varchar

10

not allowed

no

color

color

varchar

10

not allowed

no

brand

brand

varchar

40

not allowed

no

car model

cardType

varchar

10

not allowed

no

Displacement

displacement

varchar

10

not allowed

no

Kilometers traveled

kilometers

varchar

20

not allowed

no

photo

picUrl

varchar

100

not allowed

no

daily rent

dailyRent

varchar

10

not allowed

no

vehicle introduction

introduce

text

255

not allowed

no

Lease status (1 leased, 0 not leased)

status

int

10

not allowed

no

supplier

supplierId

int

19

not allowed

no

Remark

other

text

255

allow

no

Table 2.8 Purpose information table c_purpose

attribute name

field name

type of data

length

Is it allowed to be empty

Whether primary key

table id

id

int

10

not allowed

yes

use

vehicleCode

varchar

10

not allowed

no

Enabled status (1 enabled, 0 disabled)

status

int

10

not allowed

no

Table 2.9 Vehicle purpose label table c_card_purpose

attribute name

field name

type of data

length

Is it allowed to be empty

Whether primary key

table id

id

int

10

not allowed

yes

purpose id

bid

int

10

not allowed

no

vehicle id

car_id

int

10

not allowed

no

表2.10车辆供货商表c_vehicle_supplier

属性名

字段名

数据类型

长度

是否允许为空

是否主键

表id

id

int

10

不允许

厂商名称

supplierName

varchar

50

不允许

厂商联系人

contacts

varchar

30

不允许

厂商联系电话

phone

varchar

11

允许

汽车数量

sum

int

10

不允许

采购时间

buyTime

varchar

11

允许

车辆单价

unitPrice

varchar

20

允许

车辆总价

allPrice

varchar

20

允许

合同照片

contactPic

varchar

100

允许

其他约定

other

text

255

允许

表2.11门店信息表c_store_information

属性名

字段名

数据类型

长度

是否允许为空

是否主键

表id

id

int

10

不允许

门店名称

storeName

varchar

50

不允许

所在省

province

varchar

30

不允许

所在市

city

varchar

30

不允许

所在县区

area

varchar

30

不允许

详细地点

address

varchar

200

不允许

门店电话

storeTelephone

varchar

11

不允许

门店店长id

userId

int

10

不允许

店长电话

phone

varchar

11

不允许

门店成立时间

establishment

varchar

30

不允许

门店介绍

introduce

text

255

不允许

表2.12出租车辆记录表c_rental_record

属性名

字段名

数据类型

长度

是否允许为空

是否主键

表id

id

int

10

不允许

租车人

cus_id

int

10

不允许

租车时间

carRentalTime

varchar

30

不允许

还车时间

ReturnTime

varchar

30

不允许

车辆id

vehicleId

int

10

不允许

是否有驾驶员(1是0否)

isDriver

int

10

允许

租赁天数

day

int

10

不允许

租车门店id

rentId

int

10

不允许

租赁单价

rentUnitPrice

varchar

30

不允许

租赁总价

rentAllPrice

varchar

30

不允许

身份证号

idCard

varchar

20

允许

身份证照片

idCardPic

varchar

100

不允许

驾驶证照片

driverdPic

varchar

100

不允许

是否还车(1还0未还)

status

int

10

不允许

还车门店id

returnId

int

10

不允许

客服跟踪人

cusService

int

10

不允许

下单时间

orderTime

varchar

30

不允许

是否提车(1是0未)

isCollectCar

int

10

不允许

驾驶员id

driverId

int

10

不允许

表2.13员工工资表c_employee_wages

属性名

字段名

数据类型

长度

是否允许为空

是否主键

表id

id

int

10

不允许

员工id

carRentalTime

int

30

不允许

基本工资

baseWages

varchar

30

不允许

绩效工资

achievements

varchar

30

不允许

扣除工资

deduction

varchar

30

不允许

工龄工资

workingYears

varchar

30

不允许

备注

remarks

text

255

不允许

表2.14维修信息表c_repair

属性名

字段名

数据类型

长度

是否允许为空

是否主键

表id

id

int

10

不允许

车辆id

carRentalTime

varchar

30

不允许

维修人id

repairId

int

10

不允许

维修内容

repairContent

int

10

不允许

维修时间

repairTime

int

10

不允许

备注

remarks

text

255

允许

表2.15租车费用表c_money

属性名

字段名

数据类型

长度

是否允许为空

是否主键

表id

id

int

10

不允许

订单id

rent_id

int

10

不允许

总费用

sum_money

int

10

不允许

支付状态

flag

int

10

不允许

支付时间

zf_time

int

10

不允许

备注

remarks

text

255

允许

表2.17租车交接记录表c_return_record

属性名

字段名

数据类型

长度

是否允许为空

是否主键

表id

id

int

10

不允许

订单id

rent_id

int

10

不允许

交接地点

address

int

10

不允许

交接人

user_id

int

10

不允许

交接时间

jj_time

int

10

不允许

备注

remarks

text

255

允许

2.2.2​​​​​​创建关系模式

根据上述表结构进行关系模式创建:

(1)用户表s_user

CREATE TABLE `s_user` (

  `id` int NOT NULL AUTO_INCREMENT,

  `realname` varchar(40)  NOT NULL,

  `phone` varchar(11) NOT NULL,

  `address` varchar(100) NOT NULL,

  `inLogin` varchar(30)  NOT NULL,

  `username` varchar(40) NOT NULL,

  `pwd` varchar(10)  NOT NULL,

  `sex` int NOT NULL,

  `deptId` int NOT NULL,

  `roleId` int NOT NULL,

  `status` int NOT NULL,

  `lastLogin` varchar(30)  NULL,

  `isLong` int NOT NULL,

  PRIMARY KEY (`id`)

)

(2)部门表s_dept

CREATE TABLE `s_dept` (

  `id` int NOT NULL AUTO_INCREMENT,

  `deptName` varchar(20) NOT NULL,

  `deptCode` varchar(10) NOT NULL,

  `status` int NOT NULL,

  `userId` int NOT NULL,

  PRIMARY KEY (`id`)

)

(3)角色表s_role

CREATE TABLE `s_role` (

  `id` int NOT NULL AUTO_INCREMENT,

  `roleName` varchar(20) NOT NULL,

  `roleCode` varchar(10) NOT NULL,

  `status` int NOT NULL,

  PRIMARY KEY (`id`)

)

(4)资源表s_resource

CREATE TABLE `s_resource` (

  `id` int NOT NULL AUTO_INCREMENT,

  `resourceName` varchar(20) NOT NULL,

  `resourceUrl` varchar(30) NOT NULL,

  `pid` int NOT NULL,

  `icon` int NOT NULL,

  PRIMARY KEY (`id`)

)

(5)资源权限表s_roleresource

CREATE TABLE `s_roleresource` (

  `id` int NOT NULL AUTO_INCREMENT,

  `roleId` int NOT NULL,

  `resourceId` int NOT NULL,

  PRIMARY KEY (`id`)

)

(6)驾驶员信息补充表s_detail

CREATE TABLE `s_detail` (

  `id` int NOT NULL AUTO_INCREMENT,

  `roleId` int NOT NULL,

  `age` int NOT NULL,

  `url` varchar(30) NOT NULL,

  `card_url` varchar(30) NOT NULL,

  `introduce` text NOT NULL,

  PRIMARY KEY (`id`)

)

(7)客户信息表c_customer

CREATE TABLE `c_customer` (

  `id` int NOT NULL AUTO_INCREMENT,

  `customerName` varchar(30) NOT NULL,

  `customerAddress` varchar(200) NOT NULL,

  `phone` varchar(11)  NOT NULL,

  `email` varchar(30)  NOT NULL,

  `loginName` varchar(30) NOT NULL,

  `pwd` varchar(20)  NOT NULL,

  `cardPic` varchar(100) NOT NULL,

  `jashiPic` varchar(100)  NOT NULL,

  `picUrl` varchar(100)  DEFAULT NULL,

  `flag` int NOT NULL,

  `grade` int NOT NULL,

  `other` text  ,

  PRIMARY KEY (`id`)

)

(8)车辆信息表c_vehicle

CREATE TABLE `c_vehicle` (

  `id` int NOT NULL AUTO_INCREMENT,

  `vehicleCode` varchar(10)  NOT NULL,

  `vehicleNumber` varchar(10)  NOT NULL,

  `color` varchar(10) NOT NULL,

  `brand` varchar(40)  NOT NULL,

  `cardType` varchar(10)  NOT NULL,

  `displacement` varchar(10)  NOT NULL,

  `kilometers` varchar(20)  NOT NULL,

  `picUrl` varchar(100)  NOT NULL,

  `dailyRent` varchar(10)   NOT NULL,

  `introduce` text   NOT NULL,

  `status` int NOT NULL,

  `supplierId` int NOT NULL,

  `other` text  ,

  PRIMARY KEY (`id`)

)

(9)用途信息表c_purpose

CREATE TABLE `c_purpose` (

  `id` int NOT NULL AUTO_INCREMENT,

  `vehicleCode` varchar(10)   NOT NULL,

  `status` int NOT NULL,

  PRIMARY KEY (`id`)

)

(10)车辆用途标签表c_card_purpose

CREATE TABLE `c_card_purpose` (

  `id` int NOT NULL AUTO_INCREMENT,

  `bid` int NOT NULL,

  PRIMARY KEY (`id`)

)

(11)车辆供货商表c_vehicle_supplier

CREATE TABLE `c_vehicle_supplier` (

  `id` int NOT NULL AUTO_INCREMENT,

  `supplierName` varchar(50)   NOT NULL,

  `contacts` varchar(30)   NOT NULL,

  `phone` varchar(11)   DEFAULT NULL,

  `sum` int NOT NULL,

  `buyTime` varchar(11)   DEFAULT NULL,

  `unitPrice` varchar(20)   DEFAULT NULL,

  `allPrice` varchar(20)   DEFAULT NULL,

  `contactPic` varchar(100)   DEFAULT NULL,

  `other` text  ,

  PRIMARY KEY (`id`)

)

(12)门店信息表c_store_information

CREATE TABLE `c_store_information` (

  `id` int NOT NULL AUTO_INCREMENT,

  `storeName` varchar(50)   NOT NULL,

  `province` varchar(30)   NOT NULL,

  `city` varchar(30)   NOT NULL,

  `area` varchar(30)   NOT NULL,

  `address` varchar(200)   NOT NULL,

  `storeTelephone` varchar(11)   NOT NULL,

  `userId` int NOT NULL,

  `phone` varchar(11)   NOT NULL,

  `establishment` varchar(30)   NOT NULL,

  `introduce` text   NOT NULL,

  PRIMARY KEY (`id`)

)

(13)出租车辆记录表c_rental_record

CREATE TABLE `c_rental_record` (

  `id` int NOT NULL AUTO_INCREMENT,

  `carRentalTime` varchar(30)   NOT NULL,

  `ReturnTime` varchar(30)   NOT NULL,

  `vehicleId` int NOT NULL,

  `isDriver` int DEFAULT NULL,

  `day` int NOT NULL,

  `rentId` int NOT NULL,

  `rentUnitPrice` varchar(30)   NOT NULL,

  `rentAllPrice` varchar(30)   NOT NULL,

  `idCard` varchar(20)   DEFAULT NULL,

  `idCardPic` varchar(100)   NOT NULL,

  `driverdPic` varchar(100)   NOT NULL,

  `status` int NOT NULL,

  `returnId` int NOT NULL,

  `cusService` int NOT NULL,

  `orderTime` varchar(30)   NOT NULL,

  `isCollectCar` int NOT NULL,

  `isDrivera` int NOT NULL,

  `driverId` int NOT NULL,

  PRIMARY KEY (`id`)

)

(14)员工工资表c_employee_wages

CREATE TABLE `c_employee_wages` (

  `id` int NOT NULL AUTO_INCREMENT,

  `carRentalTime` varchar(30)   NOT NULL,

  `baseWages` varchar(30)   NOT NULL,

  `achievements` varchar(30)   NOT NULL,

  `deduction` varchar(30)   NOT NULL,

  `workingYears` varchar(30)   NOT NULL,

  `remarks` text   NOT NULL,

  PRIMARY KEY (`id`)

)

(15)维修信息表c_repair

CREATE TABLE `c_repair` (

  `id` int NOT NULL AUTO_INCREMENT,

  `carRentalTime` varchar(30)   NOT NULL,

  `repairId` int NOT NULL,

  `repairContent` int NOT NULL,

  `repairTime` int NOT NULL,

  `remarks` text  ,

  PRIMARY KEY (`id`)

)

(16)还车信息表c_return_record

CREATE TABLE `c_return_record`  (

  `id` int(0) NOT NULL,

  `rent_id` int(0)  NULL,

  `address` varchar(255)  NULL,

  `user_id` int(0)  NULL,

  `jj_time` datetime(0) NULL,

  `remarks` varchar(255) NULL ,

  PRIMARY KEY (`id`)

)

(17)费用信息表c_money

CREATE TABLE `c_money`  (

  `id` int(0) NOT NULL,

  `rent_id` int(0) NULL DEFAULT NULL,

  `sum_money` varchar(255)  NULL,

  `flag` int(0) NULL ,

  `remarks` text  NULL,

  `zf_time` datetime(0) NULL,

  PRIMARY KEY (`id`)

)

2.2.3模式分析

1.模式分析

(1)将实体转化为关系模式的R(A,B...)形式

即上述的:用户,部门,角色,资源,客户,车辆,用途,门店,出租车辆记录,员工工资

用户(用户id、用户编号,联系方式,家庭地址,入职时间,用户名、密码,性别,部门,角色,状态,登录时间,归属门店)

部门(部门id,部门名称,部门编号,部门主管,启用状态)

角色(角色id,角色名称,角色编号,启用状态)

资源(资源id,资源名称,资源URL,上级资源,序号)

客户(客户id,客户姓名(或单位名称),家庭地址(或企业地址),联系电话,电子信箱,用户登录名,密码,身份证号,驾驶证号,营业执照,客户类型,客户等级,备注)

车辆(车辆id,车辆编号,车牌号,颜色,品牌,车型,排量,身行驶公里数,照片,日租金,车辆介绍,租赁状态,供应商,备注)

用途(用途id,用途,启用状态)

车辆供货商(供货商id,厂商名称,厂商联系人,厂商联系电话,汽车数量,采购时间,车辆单价,车辆总价,合同照片,其他约定)

门店(门店id,门店名称,所在省,所在市,所在县区,详细地点,门店电话,门店店长,店长电话,门店成立时间,门店介绍)

员工工资(员工id,基本工资,绩效工资,扣除工资,工龄工资,备注)

 (2)建立实体间联系的转换(一对一,一对多,多对多)

当两个实体各自转化为 关系模式后,实体间联系的转换

一对一的转换:用户与部门形成一对一的关系,一个用户对应一个部门;用户与门店形成一对一的关系,一个用户归属一个门店;用户与角色形成一对一的关系,一个用户拥有一个角色;车辆与客户形成一对一的关系,在租赁过程中一辆车可被一个客户租赁;驾驶员与车辆形成一个一的关系,一个驾驶员在驾驶期间可为一辆车服务。订单与还车可形成一对一的关系,一个订单可形成一个还车信息记录。车辆与门店可形成一对一的关系,一辆车归属与一个门店。

一对多的转换:客户与租车形成一对多的关系,一个客户可租多辆汽车;客户与订单形成一对多的关系,一个客户可下多个订单。维修工与汽车可形成一对多的关系,一个维修工可修多辆车。门店与客户形成一对多的关系,一个门店可拥有多个员工。门店与车辆可形成一对多的关系,一个门店可拥有多辆车。车辆与维修可形成一对多的关系,一个车辆可拥有多个维修记录。客户与付款记录可形成一对多的关系,一个客户可形成多个付款记录。

多对多的转换:车辆用途与车辆形成多对多的关系,一辆车可拥有多个用途标签。一个用途可被多辆车拥有。角色与权限形成多对多的关系,一个角色拥有多个权限,一个权限可被多个权限拥有。

2.数据库模型图:

3.功能设计

3.1功能分析

汽车租赁公司管理系统一般分为前台租赁系统、后台管理系统两大部分。前台租赁系统是为客户服务,后台管理系统是为汽车公司的全部员工,管理人员服务。全部的功能都是为了方便客户使用及企业的管理。

3.1.1前台租赁系统

前台客户的操作功能一般为如下:

  1. 客户注册成为会员。
  2. 客户登录平台。
  3. 客户浏览车辆信息,可根据车型、车辆信息、价格等查询条件快速筛选符合自己租赁条件的车辆。
  4. 客户在选好车后,可登录系统选择租车时间、服务门店、还车城市等后,点击租车,在提交订单好,系统会自动算好费用,客户进行付费。付费成功后租赁成功,若未支付成功则需要再次支付直到成功。
  5. 客户订单下好后,可到提车门店办理相应手续,提交好对应资料后,检查好车辆即可提车。
  6. 客户在车辆使用过程中,若车辆出现任何问题可联系客服进行车辆维修和替换。
  7. 客户在使用完车辆后,可到对应还车门店进行门店的还车手续办理,确认信息无误后,门店给办理还车手续及确认手续。
  8. 客户在平台可对个人信息进行查询、修改。
  9. 客户在登录系统可查询自己的历史租赁车辆情况。

3.1.2后台系统

后台客户的操作功能一般为如下:

  1. 用户登录。
  2. 用户管理:企业用户的新增、修改、删除、查询。
  3. 部门管理:公司部门的新增、修改、删除、查询。
  4. 角色管理:公司角色的新增、修改、删除、查询。
  5. 资源管理:系统功能资源的新增、修改、删除、查询。
  6. 资源权限分配管理:系统角色的资源分配、新增。
  7. 客户信息管理:对平台注册客户进行统一管理。
  8. 租车信息管理:客户租车信息情况管理,客户资料租车确认。
  9. 车辆信息管理:公司购买车辆的统一管理,车辆的新增、修改、删除、查询。
  10. 门店信息管理:企业全国各地门店的管理,门店信息的新增、修改、删除、查询。
  11. 供应商信息管理:对车辆采购的供货商统一管理,包括车辆购买数量、金额、合同等,方便后期有问题处理。
  12. 订单信息管理:对客户前台下的租赁订单进行统一管理,可方便查询已支付订单、未支付订单、取消订单的信息。
  13. 维修信息管理:对车辆维修信息进行统一记录,后期方便查询车辆存在的问题故障等。
  14. 用途管理:对车辆进行贴标签,方便后期客户快速查询适合自己的车辆,但是用途不是全部固定,对其进行新增、修改、删除、查询,方便后期维护。
  15. 还车信息管理:租赁车辆的还车确认、还车确认信息查询。
  16. 费用信息管理:租赁车辆缴费的记录,方便后台对客户缴费情况进行统一查询、统计。

3.2功能设计

3.2.1用户登录

本模块是用户进入系统的入口, 用户登录时输入用户名、密码才可以登录本系统。本系统有租赁公司接待人员、租赁公司管理员、租赁公司车辆维护人员、租赁公司驾驶员四种用户角色,根据其身份及权限的不同,通过用户名和密码验证用户的身份,对不同级别的用户系统自动调用不同的可访问页面,使用系统提供的与其身份相应的各项功能。用户登录流程图如3-1所示。

3.2.2客户注册、登录

本模块是客户进入系统的入口, 客户登录时输入用户名、密码才可以登录本系统。本系统有铂金卡客户、金卡客户、银卡客户、一般客户四种用户角色,根据其身份及权限的不同,通过用户名和密码验证用户的身份,对不同级别的用户系统自动调用不同的可访问页面,使用系统提供的与其身份相应的各项功能。在本平台无账号的客户,先进行注册,输入用户名称、密码、联系方式等信息进行注册,完成后进行登录。

 3.2.3前台租赁系统

(1)个人信息

个人信息包括个人信息查看,个人信息修改。具体流程图如下所示。

 

 (2)浏览车辆信息

车辆浏览是客户使用前台系统进行租车的第一步,客户会输入租车城市、目的地城市、车辆需求、是否需要驾驶员、使用天数等信息系统反馈出可选车型、报价、注意事项等。

 (3)租车支付费用下单

客户在前台系统根据各类搜索条件,得到自己想要租赁的车辆,在登录状态下进行下单缴费,下单成功后到对应门店提交相应资料从而提取车辆。

 (4)还车

在车辆使用完成后,到达固定地点,进行相应手续办理,车辆检查,没任何问题完成还车。

 (5)查看租车记录

客户在前台租赁系统可点击订单,查看自己的历史租车记录、当前租车记录信息。

3.2.4后台管理系统

(1)员工信息管理

员工信息管理是对公司的员工信息统一管理,包括员工的新增、修改、删除、查询。

员工新增流程图:

 员工修改流程图:

 员工删除流程图:

 员工查询流程图:

 (2)部门信息管理

部门信息管理是对公司的部门信息统一管理,包括部门的新增、修改、删除、查询。

部门新增流程图:

 部门修改流程图:

 部门删除流程图:

 部门查询流程图:

 (3)角色信息管理

角色信息管理是对公司的角色信息统一管理,包括角色的新增、修改、删除、查询。

角色新增流程图:

 角色修改流程图:

 角色删除流程图:

 角色查询流程图:

 (4)资源权限分配

资源权限分配是给不同角色分配不同的资源菜单,不同角色的用户进入系统展示对应的信息。

 (4)租车信息管理

租车信息管理是对客户的租车信息进行统计管理,从而知道每辆车的使用情况等。

 (6)还车信息管理

还车管理是对客户的还车信息进行统一管理,包括还车的确认,记录查询等。

还车确认管理流程如图所示。

 (7)车辆信息管理

车辆信息管理是对公司的车辆信息统一管理,包括车辆的新增、修改、删除、查询。

车辆新增流程图:

车辆信息修改流程图:

 车辆删除流程图:

 车辆信息查询流程图:

 

 (8)门店信息管理

门店信息管理是对公司的所有门店信息统一管理,包括门店的新增、修改、删除、查询。

门店新增流程图:

 门店信息修改流程图:

 门店删除流程图:

 门店信息查询流程图:

 (9)供应商信息管理

供应商信息管理是对公司的所有供应商信息统一管理,包括供应商的新增、修改、删除、查询。

供应商新增流程图:

 供应商信息修改流程图:

供应商删除流程图:

 供应商信息查询流程图:

 (10)订单信息管理

订单信息管理是对已支付订单、未支付订单、取消订单进行统计管理。

已支付订单管理如图所示。

 未支付订单管理如图所示。

 取消订单管理如图所示。

 (11)维修信息管理

维修信息是对出现问题的车辆进行维修,在处理完后进行记录。

 (12)用途信息管理

用途信息管理是对公司的所有供应商信息统一管理,包括用途信息的新增、修改、删除、查询。

用途新增流程图:

用途信息修改流程图:

 用途信息删除流程图:

 用途信息查询流程图:

 (13)费用信息管理

费用信息管理是对下单的费用进行统计管理,里面分为已支付费用管理与退款管理。

已支付费用管理流程图如图所示。

 退款费用管理流程图如图所示。

3.3功能汇总

系统分为前台租赁系统,后台管理系统两大部分。具体的功能模块如下所示:

 3.3.1前台租赁系统

  1. 客户注册、登录。
  2. 车辆筛选、查询。
  3. 租车提交、费用支付、订单取消。
  4. 车辆问题反馈。
  5. 门店后续办理。
  6. 还车操作。
  7. 个人信息修改、查看。
  8. 租车订单查看:已完成、正在进行中、已取消三类的查看。

 3.3.2后台管理系统

  1. 用户登录。
  2. 用户管理:用户新增、修改、删除、查询。
  3. 部门管理:部门新增、修改、删除、查询。
  4. 角色管理:角色新增、修改、删除、查询。
  5. 资源信息管理:资源新增、修改、删除、查询。
  6. 资源权限分配:资源角色分配。
  7. 客户信息管理:客户信息查询、修改。
  8. 车辆信息管理:车辆新增、修改、删除、查询。
  9. 门店信息管理:门店新增、修改、删除、查询。
  10. 供应商信息管理:供应商新增、修改、删除、查询。
  11. 租车信息管理:租车信息查看、确认。
  12. 还车信息管理:还车确认、查询。
  13. 订单信息管理:已支付、未支付、已取消订单管理。
  14. 维修信息管理:维修记录新增、查询、修改、删除。
  15. 用途信息管理:用途新增、修改、删除、查询。
  16. 费用信息管理:费用查询、统计。

4.结论

这次课程设计我的题目是汽车租赁管理系统,通过这次可视化编程课程设计,我了解了一个完整的数据库系统设计的步骤,掌握了租车公司汽车租赁系统的业务流程及管理,巩固了我在课堂上所学的理论知识,开拓了自己的知识面,同时也让我看到了自己的不足,很多东西单独用可以做出来,可是连贯起来就出现了很多错,还有很多不足之处需要在今后的学习和工作中继续努力。

当然这次设计在老师的悉心指导下也有了很多的收获和体会,见证了一个系统的诞生,虽然不复杂,但它可以实现一些基本的功能,很有成就感,是理论与实践的一次完美的结合,而且也学到很多课本上没有涉及到的知识,对编程经验也起到了累积作用,也是第一次了解了一个系统诞生所要经过的流程,这次课程设计就像一次工作的体验,从头到尾不遗余力的把它完成。体会就是自己在这次设计当中遇到了很多问题,一开始的时候根本无从下手、什么都不会,但是通过和同学之间的讨论,查阅资料、网上查询等有了基本的了解,遇到的问题也和其他同学进行交流、探讨,问题得以一一解决。总之,在这次数据库课程设计中受益匪浅。

5.结束语

很高兴我的数据库设计能够完成,但是过程中却经历了很多的困难。万事开头难,最开始的时候确实是不知道该从何处下手,然后查阅了大量的资料,参考了相关的文献以后,才明白应该如何去做。首先对我所开发的系统进行了需求分析和调研,然后再对系统进行分析设计,最后经过指导老师的指导和我自己不断地努力,课程设计最终才被完成。这个过程也让我积极的迎接各种挑战和困难,及时搜寻各种有用信息与资料,从而顺利地解决遇到的各种困难。

汽车公司租赁系统,不但让我将数据库课程学到的知识真正用到了实践当中,而且对于知识理解的更为透彻,同时也掌握了一些新的技能和知识,明白了许多东西。在本设计当中,也锻炼了我的独立工作能力,巩固了专业知识与技术,让我对自己的未来更加有信心。在本设计当中所学到的知识和技能,对我来说都是非常宝贵的财富,也让我的经历更加丰富,未来我会继续努力。

6.参考文献

1.《数据库系统教程》施伯乐、丁宝康、汪卫编著,高等教育出版社。

2.《数据库系统概论》,王珊、萨师煊编著,高等教育出版社,第三版。

3.《数据库理论与应用》李合龙等编著,清华大学出版社。

Guess you like

Origin blog.csdn.net/lf21qp/article/details/131623371