Database Principles and Applications Course Design Report - Salary Management System

1 Overview

With the development of the economy, enterprises are developing towards large-scale and large-scale development. For large and medium-sized enterprises, the information related to salary management, such as employees and professional titles, has increased dramatically. In this case, relying solely on manual processing of employees' wages is not only powerless, but also extremely error-prone. How to design a small enterprise wages, a series of operations such as adding new employees, deleting old employees, salary inquiries, statistics, etc. are performed by computers instead of humans. In this way, the office staff can easily and quickly complete the task of salary management.

For the salary payment of enterprises and institutions, it does not need to be too large. All that is needed is a system that is easy to operate, has practical functions, and can simultaneously meet the data management and needs of the financial department, other relevant departments of the unit, and the agency.

To achieve centralized management of wages. It can be used by financial personnel to add, delete, modify, and query the personnel and wages of the unit, and the system can automatically calculate the total wages to be paid in wage distribution; at the same time, the system can also perform multi-angle queries on the management of employees and wages .

Based on the above reasons, the enterprise salary management system uses computers for safe storage, fast calculation, and comprehensive statistics to realize the systematization, standardization, and automation of salary management. The enterprise salary management system is a typical information management system (MIS), and the background database adopts MySQL database , which has the advantages of simple operation and easy use .

2. Demand analysis

2.1 Requirement Description

The salary management system is to better realize the management of various salary information and the security management of various information. This system is mainly designed to check various salary information needs of employees, and can manage data well. The main function of this system consists of the following parts:

After research and analysis, the salary management information system mainly completes the following functions:

(1) Employee basic information module: basic information of employees.

(2) Salary information module: employees' monthly basic salary, post salary, water and electricity bills, allowance salary, deduction of salary, actual payment amount.

(3) Department information module: the number, name, person in charge, and number of each department of the company.

(4) Attendance module: record the number of late arrivals and absences of employees.

(5) Allowance module: record the overtime situation of employees and distribute allowances.

(6) Employee information management module: The administrator's query of the required information is to add, delete, modify, and query the basic information of the employee.

(7) Employee salary management module: The administrator's query of the required information is the addition, deletion, modification, and query of employee salary information.

2.2 Data Flow Diagram

Top-level data flow diagram 

2.3 Data Dictionary

2.3.1  Description of data items

1. Data item name: employee number

Alias: w_number

Value range: 0000-9999

Explanation of meaning: the number of each employee

Type: char

Length: 4

2. Data item name: employee name

Alias: w_name

Value range: 1-4

Explanation of meaning: the name of each employee

Type: varchar

Length: 8

3. Data item name: employee gender

Alias: sex

Value range: "Male" or "Female"

Explanation of meaning: Gender of each employee

Type: char

Length: 2

4. Data item name: basic salary

Alias: basic_wage

Value range: integer

Explanation of meaning: basic salary of each employee

Type: int

5. Data item name: date of birth

Alias: birthday

Explanation of meaning: the date of birth of each employee

Type: datetime

2.3.2 Data structure description 

1. Name: Employee

Description of meaning: employee information

Composition structure: employee number + name + gender + date of birth + department + education level + title

2. Name: Salary

Meaning description: salary information

Composition structure: employee number + basic salary + post salary + water and electricity charges + allowance salary + deducted salary + actual salary

pay wages

2.3.3  Description of data flow

1. Data flow name: add employee information

Brief description: new employee information entry

Source of data flow: Company managers

Where the data flows: employee information

Data flow composition: employee number + name + gender + date of birth + department + educational level + title

2.3.4  Description of data flow

1. Storage name: employee record storage

Description: Record all basic information of all employees

Input: employee basic information

Output: All employee information

Data structure: employee number + name + gender + date of birth + department + education level + title

2.3.5  Definition of processing

1. Process name: employee information processing

Description: Process the basic information of employees

Input data stream: terminal

Output data flow: employee information storage

3. Conceptual structure design

3.1 Concept Design

3.1.1 Entity Analysis Description

From the user's point of view, the needs of the database are mainly reflected in the addition, deletion, modification and query of database tables. Therefore, the database structure needs to meet two elements at the same time: input and output. When doing data design, you first need to collect data, then analyze the data structure, and finally process the data. According to the requirements of this system, the following main data items and data structures are designed:

(1) Employee information entity: employee number, name, gender, department, professional title, education level, and date of birth.

(2) Department information entity: department number, department name, department head, department number.

(3) Salary information entity: employee number, basic salary, post salary, water and electricity bills, subsidized salary, deducted salary, actual payment amount.

(4) Attendance information entity: employee number, name, gender, late times, absent times.

(5) Subsidy information entity: employee number, name, gender, overtime days, allowance status, overtime type, and overtime hours.

3.1.2 Entity Entity Graph

The employee information entity is shown in Figure 3.1.

User Information Entity Diagram Design 

The department information entity is shown in Figure 3.2.

Department Information Entity Diagram Design 

The salary information entity is shown in Figure 3.3.

Salary information entity diagram design 

The attendance information entity is shown in Figure 3.4.

Attendance information entity diagram design

The subsidy information entity is shown in Figure 3.5.

Subsidy Information Entity Diagram Design 

3.1.3 ER Diagram

The local ER diagram of the salary management system is shown in Figure 3.6.

Partial ER Diagram Design of Salary Management System 

The local ER diagram of the salary management system is shown in Figure 3.7.

Partial ER Diagram Design of Salary Management System 

The local ER diagram of the salary management system is shown in Figure 3.8.

Partial ER Diagram Design of Salary Management System 

The local ER diagram of the salary management system is shown in Figure 3.9.

Partial ER Diagram Design of Salary Management System 

The general ER diagram of the salary management system is shown in Figure 3.10.

General ER diagram design of salary management system

4.1 Logical structure design

4.1 Relationship schema

Relationship mode: employee information (employee number, name, gender, date of birth, department,

education level, job title)

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

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

Relationship mode: department information (department number, department name, department head, department number)

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 model: salary information (employee number, basic salary, post salary, utilities, allowances

wages, deducted wages, paid amount)

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

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

Relationship mode: attendance information (employee number, name, gender, number of late arrivals, number of absences)

Mode judgment: attendance information ∈ 2NF, and each non-main attribute does not transfer function depends on attendance information

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

Relationship mode: allowance information (employee number, name, gender, overtime hours, overtime days,

type of overtime, allowances)

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

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

5. Physical structure design

5.1 Define the database and table name

Database name:

wages

Database table name:

  1. Employee information form: staff
  2. Department Information Form: dept
  3. Salary information table: wages
  4. Attendance Information Form: attendance
  5. Allowance information sheet: allowance

5.2 Storage Engine

Use the mysql database and choose InnoDB as the storage engine.

5.3 Database storage structure design

In order to improve the performance of the system, according to the application situation, the variable part of the data and the stable part, often

The access part is stored separately from the infrequent access part.

Since today's computers have multiple disks, placing tables (such as employee information tables) and indexes in different

In the query process, the efficiency of I/O read and write is greatly improved, and for larger partitions, the two

On a disk, it can speed up the access speed, and it is more effective in a multi-user environment; in order to improve the system

The performance of the log file and the database object (table, index, etc.) are placed on different disks. at the same time,

Considering that this system is multi-user, in order to improve efficiency, the data and log files of the database backup will be kept

stored on disk.

Frequently accessed parts of the database include:

Employee (employee number, name, gender, date of birth, department...)

Department (department number, department name, department head, department number...)

Salary (employee number, basic salary, post salary, utilities...)

Attendance (employee number, name, gender, number of late arrivals, number of absences)

The infrequent access section includes:

Basic salary (salary level, salary amount)

Post salary (salary level, salary amount)

In the initial stage of database design, in order to physically optimize the future database, some

The system configures variables, stores distribution coefficients, and assigns reasonable default values ​​to these variables. but these values ​​are not

It must be suitable for each application environment. When performing physical design, reassign these variables to improve

system performance. When choosing hardware devices, server operating systems, and databases, you should consider being able to gradually

Increase and expand.

When configuring system variables, pay attention to the number of users who use the database at the same time, the number of databases opened at the same time

Number of objects, memory allocation parameters, buffer allocation parameters, time slice size, database size, lock

number etc. These parameter values ​​will affect the storage time of the database and the allocation of storage space. 

5.4 Database storage method design

In this system, the sequential search is adopted, n/2 times are searched on average, and the B+ tree index is established, and the average search times is log2 n+1 of the layers of the B+ tree. Therefore, B+ tree is chosen as the index, and the code of the relationship is indexed in the design process.

5.5 Database table structure

(1) Employee Information Form

attribute name

field name

type of data

length

Is it allowed to be empty

Whether primary key

employee ID

employee_No

char

4

not allowed

yes

Name

name

varchar

8

not allowed

no

gender

sex

char

2

allow

no

date of birth

birthday

datetime

allow

no

Department

dept

varchar

20

not allowed

no

education level

education_level

varchar

20

allow

no

job title

title

char

12

allow

no

(2) Department Information Form

attribute name

field name

type of data

length

Is it allowed to be empty

Whether primary key

Department Number

code

char

4

not allowed

yes

Department name

name

varchar

20

not allowed

no

department head

manager

varchar

20

not allowed

no

department headcount

sum

int

10

not allowed

no

(3) Salary Information Form

attribute name

field name

type of data

length

Is it allowed to be empty

With or without index

employee ID

code

char

4

not allowed

yes

Basic wage

baseWages

varchar

20

not allowed

no

Wage jobs

postWages

varchar

20

not allowed

no

utility bill

money

float

10

not allowed

no

allowance salary

subsidy

varchar

10

not allowed

no

Deduction of salary

deduction

varchar

10

not allowed

no

Actual amount

fact

varchar

10

not allowed

no

(4) Attendance Information Form

attribute name

field name

type of data

length

Is it allowed to be empty

With or without index

employee ID

code

char

4

not allowed

yes

Name

name

varchar

8

not allowed

no

gender

sex

char

2

not allowed

no

Number of late arrivals

delaysum

int

10

not allowed

no

Number of absences

sent

int

10

not allowed

no

(5) Subsidy Information Form

attribute name

field name

type of data

length

Is it allowed to be empty

With or without index

employee ID

code

char

4

not allowed

yes

Name

name

varchar

8

not allowed

no

gender

sex

char

2

not allowed

no

Overtime

overtime

varchar

10

allow

no

Overtime days

daytime

float

10

allow

no

Overtime type

supertype

varchar

10

allow

no

Allowance

allowance

int

10

allow

no

5.6 Database model

database model

6. Database implementation

6.1 Database Creation

CREATE DATABASE wages CHARACTER SET utf8;

6.2 Database table creation

(1) Employee Information Form

CREATE TABLE `staff`  (

  `employee_No` char(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,

  `name` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,

  `sex` char(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,

  `birthday` datetime(0) NULL DEFAULT NULL,

  `dept` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,

  `education_level` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,

  `title` char(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,

  PRIMARY KEY (`employee_No`) USING BTREE

) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

基础数据初始化:

INSERT INTO `staff` VALUES ('001', '张三', '女', '1999-01-21 00:00:00', '部门', '本科', '无');

INSERT INTO `staff` VALUES ('002', '张三', '女', '1999-01-21 00:00:00', '部门', '本科', '无');

INSERT INTO `staff` VALUES ('003', '张三', '女', '1999-01-21 00:00:00', '部门', '本科', '无');

INSERT INTO `staff` VALUES ('004', '张三', '女', '1999-01-21 00:00:00', '部门', '本科', '无');

效果图:

 图6.1 员工信息表运行效果

(2)部门信息表

CREATE TABLE `dept`  (

  `code` char(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,

  `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,

  `manager` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,

  `sum` int(0) NULL DEFAULT NULL,

  PRIMARY KEY (`code`) USING BTREE

) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

数据初始化:

INSERT INTO `dept` VALUES ('001', '部门1', '张三', 10);

INSERT INTO `dept` VALUES ('002', '部门2', '张三', 10);

INSERT INTO `dept` VALUES ('003', '部门2', '张三', 10);

效果图:

 图6.2 部门信息表运行效果

(3)工资信息表

DROP TABLE IF EXISTS `wages`;

CREATE TABLE `wages`  (

  `code` char(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,

  `baseWages` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,

  `postWages` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,

  `money` float(10, 0) NULL DEFAULT NULL,

  `subsidy` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,

  `deduction` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,

  PRIMARY KEY (`code`) USING BTREE

) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

数据初始化:

INSERT INTO `wages` VALUES ('001', '2000', '1000', 1000, '1000', '');

INSERT INTO `wages` VALUES ('002', '2000', '1000', 1000, '1000', '');

INSERT INTO `wages` VALUES ('003', '2000', '1000', 1000, '1000', '');

INSERT INTO `wages` VALUES ('004', '2000', '1000', 1000, '1000', '');

效果图:

 图6.3 工资信息表运行效果

(4)考勤信息表

CREATE TABLE `attendance`  (

  `code` char(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,

  `name` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,

  `sex` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,

  `delaysum` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,

  `misssum` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,

  PRIMARY KEY (`code`) USING BTREE

) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

数据初始化:

INSERT INTO `attendance` VALUES ('001', '张三', '女', '11', '0');

INSERT INTO `attendance` VALUES ('002', '张三', '女', '11', '0');

INSERT INTO `attendance` VALUES ('003', '张三', '女', '11', '0');

INSERT INTO `attendance` VALUES ('004', '张三', '女', '11', '0');

INSERT INTO `attendance` VALUES ('005', '张三', '女', '11', '0');

效果图:

 图6.4 考勤信息表运行效果

(5)津贴信息表

CREATE TABLE `allowance`  (

  `code` char(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,

  `name` varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,

  `sex` char(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,

  `overtime` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,

  `allowance` int(0) NULL DEFAULT NULL,

  `overday` float(10, 0) NULL DEFAULT NULL,

  `overtype` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,

  PRIMARY KEY (`code`) USING BTREE

) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

数据初始化:

INSERT INTO `allowance` VALUES ('001', '张三', '女', '0', 0, 0, '0');

INSERT INTO `allowance` VALUES ('002', '张三', '女', '0', 0, 0, '0');

INSERT INTO `allowance` VALUES ('003', '张三', '女', '0', 0, 0, '0');

INSERT INTO `allowance` VALUES ('004', '张三', '女', '0', 0, 0, '0');

INSERT INTO `allowance` VALUES ('005', '张三', '女', '0', 0, 0, '0');

运行效果图:

 图6.5 津贴信息表运行效果

 

Guess you like

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