Database Principle and Application Research Report-Online Rescue Material Help System

Chapter 1 Demand Analysis

1.1 System overview

In 2020, the sudden "new crown" pneumonia epidemic and the most serious "Yangtze River Basin" flood since 1998 have brought a major test to my country's epidemic prevention and disaster relief system. Now all countries in the world have realized that they need to pay attention to and have begun to pay attention to the country's ability to deal with emergency incidents, how to efficiently use limited resources, and improve the ability to respond to various disasters and emergencies, so as to provide benefits to the people and those involved Providing faster emergency rescue services to the units that arrive is gradually becoming an important topic that countries all over the world are seriously thinking about and studying. The rescue material help platform can facilitate real-time grasp of emergency material data, and enhance the material support capabilities for preventing and handling emergencies. A professional platform not only enhances the intelligence and systematization of management, but also prevents material waste.

On the one hand, this system is to enable groups that need materials to ask for help to publish online registration information for help, and on the other hand, it is to allow caring groups to donate relief materials. Therefore, the system is mainly divided into front-end client functions and back-end management system. Users are divided into two types: front-end customers and back-end administrators. The main functional modules of the two types of customers are specifically divided as follows.

1.1.1 Foreground client functions

The front-end client is mainly used by front-end customers, and the specific functions are divided as follows. The front-end customer use case diagram is shown in Figure 1-1.

(1) Customer registration: The customer enters the relevant fields required for registration at the front desk, and uses MD5 to encrypt the password to register.

(2) Customer login: In order to ensure the security of the customer account password, the password needs to be MD5 encrypted.

(3) Search for help, rescue information, and news information: search for help, rescue information, and news information, etc.

(4) Release of information for users seeking help: release information on the relief supplies and assistance system as needed, and obtain corresponding rescue assistance.

(5) User help-seeking information and assistance: Check the corresponding help-seeking information, and caring people donate rescue materials to it.

(6) Personal Center: Modify basic information, view my help information and my rescue information records.

 Figure 1-1 Front-end customer use case diagram

1.1.2 Background management system functions

The background management system is mainly used by administrators to manage all kinds of information in the system in a unified manner. The specific functions divided according to the usage of the platform are as follows. The system administrator use case diagram is shown in Figure 1-2.

(1) Customer information management: manage all the information of the successful registration of the front-end client, which can be queried and viewed.

(2) System settings: including addition, deletion, modification and query operations of system users, addition, deletion, modification and query operations , addition, deletion, modification and query operations of system roles, resource authority allocation , etc.

(3) Material type management: query, add, delete, and modify the type of relief materials.

(4) Review and management of help-seeking information: Verify the authenticity of the help-seeking information. If there is no problem, click the "pass" operation, and if there is a problem, click the "reject" operation.

(5) Rescue material information help management: management of audit failure, audit pass, rescue, receipt of material information, etc.

(6) News and information management: front-end related news and information management and crawling management.

 Figure 1-2 Administrator use case diagram

1.2 Functional module design

According to the analyzed needs, the rescue material help system is divided into two parts: the front-end client and the back-end management system. The overall design of system functions is shown in Figure 1-3. The front-end client includes functions such as registration and login, help registration, rescue registration, rescue information publicity, and personal center. The background management system includes modules such as customer management, audit management, rescue management, and news management. Through these functions, it is convenient and satisfying for groups in need of material help to get help online.

Figure 1-3 Overall design of system functions

 1.2.1 Foreground client functional modules

(1) Log in to the registration module

The login and registration module is the basis for the front-end customers to issue help information and make material donations to provide assistance. It can only be done if they are system users and are in the login state.

(2) Home page information display module

① Login

Front-end customers need to obtain corresponding services on the platform, and they need to log in with username and password. It does not provide services for the information on the status of tourists, so as to facilitate the verification and management of the authenticity of the system information.

② Register

The registration module is the basis for the front-end customers to use the platform. If you do not have an account, you can only view various information in the system without any operation authority. Registration is when the front desk customer enters information such as user name, mobile phone number, gender, ID number, etc., and adds it to the database.

(3) Help registration module

Registration for help is the core function of the system and a way to disseminate information for help. The logged-in front desk customer enters information such as materials for help, material type, material quantity, event, address, picture, etc., and adds the information to the database. After being reviewed by the administrator, it can be displayed on the system's help list for other caring personnel to view and provide material help.

(4) Rescue registration module

Rescue registration is the core function of the system. Rescue registration is the follow-up to help registration and the essence of the entire system. Caring people check all the help-seeking information in the system. After viewing the information that they want to provide assistance, they register an account and log in to register for assistance. After registration, they send supplies and contact the other party for address confirmation, so as to achieve point-to-point assistance.

(5) Rescue information publicity module

The rescue information publicity module is to make the information open and transparent, so that people from all walks of life who publish help and those who provide assistance can understand the flow of materials on the platform. The publicity of rescue information includes the publicity of waiting for help, the publicity of rescued and the publicity of completed.

(6) Personal center module

The personal center is a module for viewing various information of front-end customers, which includes modification of personal information, management of self-published help information, management of rescue information, and management of help material receipt.

1.2.2 Background management system function modules

(1) Login module

Login is the basis for administrators to manage information. Login with a given user name and password will be compared with the information in the database. After the comparison is successful, you can log in to the background management system to perform corresponding operations.

(2) Customer management module

The customer management module is to manage the customer information registered at the front desk in a unified manner, which is convenient for counting the number of registered customers and the required information of each customer, etc., and lays the foundation for the later review of help information. Administrators can only view customer information and cannot perform other operations.

(3) Audit management module

Review management is to review the help-seeking registration information released by the front-end customer. After the help-seeker releases the registration information, the administrator conducts an investigation and verification of the authenticity of the information. After confirming that it is true and correct, click Pass. If there is fraud or other behavior, click Reject. It can be displayed in the help bar on the home page or in the help announcement. Audit management includes audit and audit failure management.

① Audit management

After confirming the authenticity of the published information, the administrator clicks "Pass" in the operation to update the identification status of the corresponding information in the database, and then display it in the help column at the front desk, so that it can be displayed externally and obtained assistance.

② Audit failed to pass the management

After the administrator rejects the false and inaccurate information released, the front-end customers can no longer modify it. If it is rejected, the information that still needs to submit materials for help only needs to be registered again. In addition, the administrator can record and manage the help requests that have not passed the review, and query the corresponding information in the database according to subsequent needs.

(4) Rescue management module

The rescue management module manages the registration information released by the front-end customers according to different states, mainly divided into pending rescue, rescued and completed information management. The administrator can clearly see the amount of information that is waiting for rescue, the amount of information that has been rescued, the amount of information that has completed and received materials, and can accurately understand the overall material help and rescue situation of the system.

(5) News management module

News management is the basis for information display on the home page of the front-end client and its news information page, which facilitates the display and real-time update of news. This module includes adding, modifying, deleting and viewing news.

① Add news

News addition includes news title, source, and content. The administrator will enter the information into the database, and update the content of the front-end client home page news and news information page information in real time to enrich the page content.

② News Editor

News editing includes revisions to news headlines, sources and content, adjusting problematic information fields and updating them from the database.

③ Delete news

The administrator deletes outdated or useless information from the database.

④ View news

For news viewing, you can fill in the news title and content in the query box, and click the query button to filter the list of news you want to view.

(6) System settings

Type setting is the basis of the background management system. It has management of departments, roles, and users, which facilitates the division of authority for different parts and performs their duties. System settings include department management, role management, and user management.

① Department management

Department management includes managing the departments of the background management system, including checking, adding, modifying, deleting, and viewing departments.

② Role management

Role management is the unified management of the role types of all different users in the background system and their role resource permission allocation, including the addition, modification, deletion of role information and resource permission allocation.

③ User management

User management is the unified management of user information and account allocation for the background system, including user addition, modification, deletion, and viewing.

(7) Type setting

The type setting is the basis for registering the help-seeking customers at the front desk, and the source of the item type selected during registration is based on this. The types are set and managed in a unified manner, so that the platform can make statistics on help requests and rescue information according to the types of materials in the later stage. Type settings include type addition, type viewing, type editing, and type deletion.

① Add type

The type addition includes the type name and type number, and the administrator will enter and store the information in the database, which is convenient for the front-end customers to choose when posting help information.

② Type view

You can enter the type name, type number, and click the query button to check the type, which is convenient for the administrator to filter the result list he wants to view.

③ Type Edit

Type editing includes the modification of type name and type number, and the administrator will update the information that needs to be modified from the database.

④ Type deletion

The administrator will delete the unnecessary information from the database through the delete button.

Chapter 2 Conceptual Design

2.1 Concept Design

2.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) User entity : table id, user name, user real name, password, gender, department id, role id, status, last login time.

(2) Role entity: table id, role name, enabled status.

(3) Department entity: table id, department name, department number, enabled status.

(4) Resource entity: table id, resource name, resource URL, parent resource id, resource flag.

(5) First-level substance classification entity: table id, first-level material type name.

(6) Second-level material classification entity: table id, first-level material type table id, material type name, status.

(7) Customer entity: form id, customer name, password, gender, mobile phone number, WeChat ID, ID number.

(8) Help-seeking information entities: table id, material classification table id, item name, quantity, help-seeking time, help-seeking person, rescue time, rescuer, help-seeking information status, rescue event, homepage picture name, address.

(9)  News entity : table id, title, acquisition time , content, source, description .

According to the requirements analysis of the above database, the specific entities are obtained, and the attributes of each entity generally correspond to the ER diagram of the entity.

(1) The user entity is shown in Figure 2-1.

 Figure 2-1 User entity

(2) The role entity is shown in Figure 2-2.

 Figure 2-2 Role entity

(3) Department entities are shown in Figure 2-3.

 Figure 2-3 Department entity

(4) The resource entity is shown in Figure 2-4.

 Figure 2-4 Resource entity

(5) The primary substance classification entity is shown in Figure 2-5.

 Figure 2-5 Level 1 Material Classification Entity

(6) The secondary material classification entity is shown in Figure 2-6.

 Figure 2-6 Level 2 Material Classification Entity

(7) The customer entity is shown in Figure 2-7.

 Figure 2-7 Customer entity

(8) The help information entity is shown in Figure 2-8.

 Figure 2-8 Help information entity

(9) The news entity is shown in Figure 2-9.

 Figure 2-9 News entity

2.1.2 Analysis of entity connection types

According to the corresponding relationship between entities and their entities, the corresponding general database information ER diagram is shown in Figure 2-10. Customers can issue and rescue help information, one customer can issue a primary help information, and one customer can rescue multiple help information. Administrators can manage news information, customer information, and help information. One administrator can manage multiple pieces of help information in different states, and manage multiple pieces of news information. There are many-to-many relationships between departments and users, users and roles.

 Figure 2-10 Overall database ER diagram

Chapter 3   Logic Design

3.1 Relational schema

Customer (customer name, password, gender, mobile phone number, ID number, WeChat ID)

admin (username, realname, password, status, gender)

news (title, content, source, description)

Help information (item name, quantity, help event, customer name)

Publish, ask for help (customer name, item name)

admin(username, username, title, itemname)

3.2 Table

(1) User table (s_user)

The user table contains user id, user real name, user name, password, gender, department id, role id, status, last login time. As shown in Table 3-1.

Table 3-1 User table (s_user)

column name

type

primary key

foreign key

note

id

int(0)

yes

user id

realName

varchar(50)

user real name

userName

varchar(50)

username

pwd

varchar(20)

password

sex

int(0)

gender

deptId

int(0)

yes

department id

roleId

int(0)

yes

role id

status

int(0)

state

lastLogin

varchar(30)

last login time

(2) Role table (s_role)

The role table contains role ID, role name, enabled status. As shown in Table 4-2.

Table 4-2 Role table (s_role)

column name

type

primary key

foreign key

note

id

int(0)

yes

primary key

roleName

varchar(50)

Role Name

status

int(0)

enabled state

(3) Department table (s_dept)

The department table contains department id, department name, department number, and enabled status. As shown in Table 4-3.

Table 4-3 Department table (s_dept)

column name

type

primary key

foreign key

note

id

int(0)

yes

primary key

deptName

varchar(20)

Department name

deptCode

varchar(20)

Department Number

status

int(0)

enabled state

(4) Resource table (s_resource)

The resource table contains resource name, resource URL, parent resource id, and resource flag. As shown in Table 4-4.

Table 4-4 Resource table (s_resource)

the list

type

primary key

foreign key

note

id

int(0)

yes

primary key

resourceName

varchar(100)

Resource Name

resourceUrl

varchar(100)

Resource URL

pid

int(0)

parent resource id

icon

int(0)

resource flag

(5) Role resource table (s_roleresource)

A role resource includes a role resource id, a role id, and a resource id. As shown in Table 4-5.

Table 4-5 Role resource table (s_roleresource)

column name

type

primary key

foreign key

note

id

int(0)

yes

role resource id

roleId

int(0)

yes

role id

resourceId

int(0)

yes

resource id

(6) Level 1 material type table (s_typemain)

The first-level material type table includes material type id and material type name. As shown in Table 4-6.

Table 4-6 Level 1 Material Type Table (s_typemain)

column name

type

primary key

foreign key

note

id

int(0)

yes

primary key

typename

varchar(100)

material type name

(7) Secondary Material Type Table (s_typedetail)

The second-level material type table includes material type id, first-level material type table id, material type name, and status. As shown in Table 4-7.

Table 4-7 Secondary Material Type Table (s_typedetail)

column name

type

primary key

foreign key

note

id

int(0)

yes

primary key

pid

int(0)

foreign key

First-level material type table id

typename

varchar(100)

material type name

flag

int(0)

state

(8) Customer table (t_customer)

The customer table contains customer id, customer name, password, gender, mobile phone number, WeChat ID, and ID card. As shown in Table 4-8.

Table 4-8 Customer table (t_customer)

column name

type

primary key

foreign key

note

id

int(0)

yes

primary key

customername

varchar(100)

client's name

cpassword

varchar(20)

password

sex

int(0)

Gender (1 male 0 female)

cphone

varchar(11)

Phone number

cWeChat

varchar(20)

We chat number

idcard

varchar(18)

ID card

(9) Help Information Form (t_recourse)

The help-seeking information table includes help-seeking information id, material classification table id, material name, quantity, help-seeking time, help-seeker id, rescue time, rescuer id, help-seeking status, rescue event, homepage picture name, and address. As shown in Table 4-9.

Table 4-9 Help information table (t_recourse)

column name

type

primary key

foreign key

the data shows

id

int(0)

yes

help information id

category

int(0)

material classification table id

material

varchar(20)

Item Name

quantity

int(0)

quantity

recourse_time

varchar(18)

help time

customerid

int(0)

yes

Helper id

aid_time

varchar(18)

rescue time

aid_id

int(0)

yes

rescuer id

flag

int(0)

求助状态

event

varchar(255)

救援事件

picturename

varchar(100)

首页图片名称

address

varchar(255)

地址

(10) 新闻表 (t_new)

新闻表包含主键id、新闻标题、发布时间、内容、来源、描述。如表4-10所示。

表4-10 新闻表(t_new)

列名

类型

主键

外键

注释

id

int(0)

主键

title

varchar(100)

新闻标题

releaseTime

varchar(30)

发布时间

content

text

内容

source

varchar(30)

来源

desc1

varchar(100)

描述

第四章  物理设计

4.1索引设计

在经常需要搜索的列上建立索引。在主关键字上建立索引。在经常用于连接的列上建索引,即在外键上建立索引。在经常需要根据范围进行搜索的列上创建索引,因为索引已经排序,其指定的范围是连续的。在经常需要排序的列上建立索引 ,因为索引已经排序,这样查询可以利用索引的排序,加快排序查询时间。在经常成为查询条件的列上建立索引。也就是说,在经常使用在where子句中的列上建立索引。

对于那些在查询中很少使用和参考的列不应该创建索引。因为既然这些列很少使用,有所因并不能提高查询速度。相反,由于增加了索引,反而降低了系统的维护速度和增大了空间需求。对于那些只有很少值的列不应该建立索引。例如,人事表中的“性别”列,取值范围只有两项:“男”或“女”。若在其上建立索引,则平均起来,每个属性值对应一半的元组,用索引检索,并不能明显加快检索速度。属性值分布严重不均的属性。例如学生的年龄往往集中在几个属性值上,若在年龄属性上建立索引,则在检索某个年龄的学生时,会涉及相当多的学生。过长的属性,例如超过30个字节。因为在过长的属性上建立索引,索引所占的存储空间比较大,而索引的级数也随之增加,有诸多不利之处。如果实在需要在其上建立索引,必须采取索引属性压缩的措施。经常更新的属性或表。因为在更新时有关的索引需要做相应的修改。

第五章  实施与维护

5.1SQL代码

(1)用户表 (s_user)

创建用户表SQL语句:

CREATE TABLE `s_user`  (

  `id` int(0) NOT NULL AUTO_INCREMENT,

  `realname` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,

  `username` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,

  `pwd` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,

  `sex` int(0) NULL DEFAULT NULL,

  `deptId` int(0) NULL DEFAULT NULL,

  `roleId` int(0) NULL DEFAULT NULL,

  `status` int(0) NULL DEFAULT NULL,

  `lastLogin` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,

  PRIMARY KEY (`id`) USING BTREE,

  INDEX `deptid`(`deptId`) USING BTREE,

  INDEX `roleid`(`roleId`) USING BTREE,

  CONSTRAINT `deptid` FOREIGN KEY (`deptId`) REFERENCES `s_dept` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,

  CONSTRAINT `roleid` FOREIGN KEY (`roleId`) REFERENCES `s_role` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT

) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;

给用户表插入数据SQL语句:

INSERT INTO `s_user` VALUES (7, 'ceshi', 'admin', '123456', 0, 1, 1, 0, NULL);

INSERT INTO `s_user` VALUES (8, 'ceshi1', 'ceshi1', 'ceshi1', 0, 1, 1, 0, NULL);

INSERT INTO `s_user` VALUES (9, 'ceshi1', 'ceshi2', 'ceshi1', 0, 1, 1, 0, NULL);

INSERT INTO `s_user` VALUES (10, 'ceshi1', 'ceshi3', 'ceshi1', 0, 1, 1, 0, NULL);

INSERT INTO `s_user` VALUES (11, 'ceshi1', 'ceshi4', 'ceshi1', 0, 1, 1, 0, NULL);

INSERT INTO `s_user` VALUES (12, 'ceshi1', 'ceshi5', 'ceshi1', 0, 1, 1, 0, NULL);

INSERT INTO `s_user` VALUES (13, 'ceshi1', 'ceshi6', 'ceshi1', 0, 1, 1, 0, NULL);

INSERT INTO `s_user` VALUES (14, 'ceshi1', 'ceshi7', 'ceshi1', 0, 1, 1, 0, NULL);

INSERT INTO `s_user` VALUES (15, 'ceshi1', 'ceshi8', 'ceshi1', 0, 1, 1, 0, NULL);

INSERT INTO `s_user` VALUES (16, 'ceshi1', 'ceshi9', 'ceshi1', 0, 1, 1, 0, NULL);

INSERT INTO `s_user` VALUES (17, 'ceshi1', 'ceshi10', 'ceshi1', 0, 1, 1, 0, NULL);

INSERT INTO `s_user` VALUES (18, 'ceshi1', 'ceshi11', 'ceshi1', 0, 1, 1, 0, NULL);

INSERT INTO `s_user` VALUES (19, 'ceshi1', 'ceshi12', 'ceshi1', 0, 1, 1, 0, NULL);

(2)角色表(s_role)

创建角色表SQL语句:

CREATE TABLE `s_role`  (

  `id` int(0) NOT NULL AUTO_INCREMENT,

  `roleName` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,

  `status` int(0) NULL DEFAULT NULL,

  PRIMARY KEY (`id`) USING BTREE

) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;

给角色表插入数据SQL语句:

INSERT INTO `s_role` VALUES (1, '平台管理员', 0);

INSERT INTO `s_role` VALUES (2, '角色2', NULL);

(3)部门表 (s_dept)

创建部门表SQL语句:

CREATE TABLE `s_dept`  (

  `id` int(0) NOT NULL AUTO_INCREMENT,

  `deptName` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,

  `deptCode` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,

  `status` int(0) NULL DEFAULT NULL,

  PRIMARY KEY (`id`) USING BTREE

) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;

给部门表插入数据SQL语句:

INSERT INTO `s_dept` VALUES (1, '部门1', '001', NULL);

INSERT INTO `s_dept` VALUES (2, '部门2', '002', 0);

(4)资源表 (s_resource)

创建资源表SQL语句:

CREATE TABLE `s_resource`  (

  `id` int(0) NOT NULL AUTO_INCREMENT,

  `resourceName` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,

  `resourceUrl` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,

  `pid` int(0) NULL DEFAULT NULL,

  `icon` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,

  PRIMARY KEY (`id`) USING BTREE

) ENGINE = InnoDB AUTO_INCREMENT = 34 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;

给资源表插入数据SQL语句:

INSERT INTO `s_resource` VALUES (1, '系统设置', NULL, 0, 'icon-computer');

INSERT INTO `s_resource` VALUES (2, '用户管理', '../user/userData.action', 1, '');

INSERT INTO `s_resource` VALUES (3, '角色管理', '../role/data.action', 1, '');

INSERT INTO `s_resource` VALUES (4, '部门管理', '../dept/data.action', 1, '');

INSERT INTO `s_resource` VALUES (8, '数据字典', NULL, 0, 'icon-wenben');

INSERT INTO `s_resource` VALUES (9, '类型设置', '../system/data.action?pid=1', 8, '');

INSERT INTO `s_resource` VALUES (19, '客户管理', '', 0, 'icon-computer');

INSERT INTO `s_resource` VALUES (20, '客户管理', '../customer/customerData.action', 19, '');

INSERT INTO `s_resource` VALUES (26, '新闻管理', NULL, 0, 'icon-computer');

INSERT INTO `s_resource` VALUES (27, '新闻管理', '../news/newsData.action', 26, '');

INSERT INTO `s_resource` VALUES (28, '救助管理', '', 0, 'icon-computer');

INSERT INTO `s_resource` VALUES (29, '待救援信息管理', '../need/needData.action?flag=0', 28, '');

INSERT INTO `s_resource` VALUES (30, '被救援信息管理', '../need/needData.action?flag=1', 28, '');

INSERT INTO `s_resource` VALUES (31, '已完成救援信息管理', '../need/needData.action?flag=2', 28, '');

INSERT INTO `s_resource` VALUES (32, '审核管理', '', 0, 'icon-computer');

INSERT INTO `s_resource` VALUES (33, '待审核求助信息', '../need/needData.action?flag=-1', 32, '');

INSERT INTO `s_resource` VALUES (34, '审核失败求助信息', '../need/needData.action?flag=-2', 32, '');

(5)角色资源表(s_roleresource)

创建角色资源表SQL语句:

CREATE TABLE `s_roleresource`  (

  `id` int(0) NOT NULL AUTO_INCREMENT,

  `roleId` int(0) NULL DEFAULT NULL,

  `resourceId` int(0) NULL DEFAULT NULL,

  PRIMARY KEY (`id`) USING BTREE

) ENGINE = InnoDB AUTO_INCREMENT = 67 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;

给角色资源表插入数据SQL语句:

INSERT INTO `s_roleresource` VALUES (30, 1, 1);

INSERT INTO `s_roleresource` VALUES (31, 1, 2);

INSERT INTO `s_roleresource` VALUES (32, 1, 3);

INSERT INTO `s_roleresource` VALUES (33, 1, 8);

INSERT INTO `s_roleresource` VALUES (34, 1, 9);

INSERT INTO `s_roleresource` VALUES (36, 1, 4);

INSERT INTO `s_roleresource` VALUES (37, 1, 5);

INSERT INTO `s_roleresource` VALUES (38, 1, 6);

INSERT INTO `s_roleresource` VALUES (39, 1, 7);

INSERT INTO `s_roleresource` VALUES (40, 1, 10);

INSERT INTO `s_roleresource` VALUES (41, 1, 11);

INSERT INTO `s_roleresource` VALUES (42, 1, 12);

INSERT INTO `s_roleresource` VALUES (43, 1, 13);

INSERT INTO `s_roleresource` VALUES (44, 1, 14);

INSERT INTO `s_roleresource` VALUES (45, 1, 15);

INSERT INTO `s_roleresource` VALUES (46, 1, 16);

INSERT INTO `s_roleresource` VALUES (47, 1, 17);

INSERT INTO `s_roleresource` VALUES (48, 1, 18);

INSERT INTO `s_roleresource` VALUES (49, 1, 19);

INSERT INTO `s_roleresource` VALUES (50, 1, 20);

INSERT INTO `s_roleresource` VALUES (52, 1, 21);

INSERT INTO `s_roleresource` VALUES (53, 1, 22);

INSERT INTO `s_roleresource` VALUES (54, 1, 23);

INSERT INTO `s_roleresource` VALUES (55, 1, 26);

INSERT INTO `s_roleresource` VALUES (56, 1, 27);

INSERT INTO `s_roleresource` VALUES (58, 1, 28);

INSERT INTO `s_roleresource` VALUES (59, 1, 29);

INSERT INTO `s_roleresource` VALUES (60, 1, 30);

INSERT INTO `s_roleresource` VALUES (61, 1, 31);

INSERT INTO `s_roleresource` VALUES (65, 1, 32);

INSERT INTO `s_roleresource` VALUES (66, 1, 33);

INSERT INTO `s_roleresource` VALUES (67, 1, 34);

(6)一级物资类型表 (s_typemain)

创建一级物资类型表SQL语句:

CREATE TABLE `s_typemain`  (

  `id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,

  `typename` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,

  PRIMARY KEY (`id`) USING BTREE

) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;

给一级物资类型表插入数据SQL语句:

INSERT INTO `s_typemain` VALUES ('1', '物资分类');

(7)二级物资类型表 (s_typedetail)

创建一级物资类型表SQL语句:

CREATE TABLE `s_typedetail`  (

  `id` int(0) NOT NULL AUTO_INCREMENT,

  `pid` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,

  `typename` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,

  `flag` int(0) NULL DEFAULT NULL,

  PRIMARY KEY (`id`) USING BTREE

) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;

给一级物资类型表插入数据SQL语句:

INSERT INTO `s_typedetail` VALUES (2, '1', '生活用品', 1);

INSERT INTO `s_typedetail` VALUES (4, '1', '医药用品', 1);

(8)客户表 (t_customer)

创建客户表SQL语句:

CREATE TABLE `t_customer`  (

  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT 'ID',

  `customername` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户名',

  `cpassword` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '密码',

  `sex` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '性别 1男2女',

  `cphone` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '手机号',

  `cWeChat` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '微信号',

  `idcard` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '身份证',

  PRIMARY KEY (`id`) USING BTREE

) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '客户表 ' ROW_FORMAT = Dynamic;

给客户表插入数据SQL语句:

INSERT INTO `t_customer` VALUES (12, '小仙女', '123456', '1', '18435122312', '18435122389', NULL);

INSERT INTO `t_customer` VALUES (13, '小仙女1', '123456', '0', '18435122315', '18435122388', NULL);

(9)求助信息表 (t_recourse)

创建求助信息表SQL语句:

CREATE TABLE `t_recourse`  (

  `id` int(0) NOT NULL AUTO_INCREMENT COMMENT 'ID',

  `category` int(0) NULL DEFAULT NULL COMMENT '物资分类',

  `material` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '物品名称',

  `quantity` int(0) NOT NULL COMMENT '数量',

  `recourse_time` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '求助时间',

  `customerid` int(0) NOT NULL COMMENT '求助人',

  `aid_time` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '援助时间',

  `aid_id` int(0) NULL DEFAULT NULL COMMENT '援助人',

  `flag` int(0) NULL DEFAULT NULL COMMENT '收取情况状态 1代表求助成功2物资收取成功',

  `event` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '救援事件',

  `picturename` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '图片 存图片的名称',

  `address` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '救援物资派送地址',

  PRIMARY KEY (`id`) USING BTREE

) ENGINE = InnoDB AUTO_INCREMENT = 51 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '求助表 ' ROW_FORMAT = Dynamic;

给求助信息表插入数据SQL语句:

INSERT INTO `t_recourse` VALUES (38, 2, '口罩', 10000, '2022-05-15 11:57:14', 12, NULL, NULL, -1, '太原疫情-口罩短缺、保障大量医用口罩', 'f6f8b943-0fab-4a2a-8237-a59cb4ef69ea.png', '山西省晋中市榆次区');

INSERT INTO `t_recourse` VALUES (39, 2, '矿泉水', 100, '2022-05-15 12:11:49', 12, NULL, NULL, -1, '地震-需大量矿泉水保障灾区人民生活', '258d3b22-7d49-4d48-aa92-fe853c781188.png', '山西省晋中市');

INSERT INTO `t_recourse` VALUES (40, 4, '医用防护服', 1000, '2022-05-15 12:14:56', 12, NULL, NULL, -1, '疫情-急缺大量医用防护服', '289f5e6e-3030-4094-b079-1f12b7f51a1a.png', '上海市');

INSERT INTO `t_recourse` VALUES (41, 2, '蔬菜', 2000, '2022-05-15 12:16:51', 12, NULL, NULL, -1, '疫情-郑州疫情封城急需大量蔬菜', 'd06cc942-92c4-4f26-9dd4-9e48a26c58b5.png', '河南省郑州市');

INSERT INTO `t_recourse` VALUES (42, 4, '药品', 500, '2022-05-15 12:19:45', 12, NULL, NULL, -1, '洪水-急需大量医药用品救急灾区人民', 'b823586c-6135-4590-b990-ba2d91231373.png', '山西省运城市新绛县');

INSERT INTO `t_recourse` VALUES (43, 2, '生活物资', 2000, '2022-05-15 12:21:30', 12, NULL, NULL, -1, '地震-急需大量生活物资重建家园', 'a9a9222c-9e00-427e-9278-0c698a9afe8c.png', '四川省成都市');

INSERT INTO `t_recourse` VALUES (44, 2, '口罩', 10000, '2022-05-15 11:57:14', 12, '2022-05-15 12:55:00', 13, 1, '太原疫情-口罩短缺、保障大量医用口罩', 'f6f8b943-0fab-4a2a-8237-a59cb4ef69ea.png', '山西省晋中市榆次区');

INSERT INTO `t_recourse` VALUES (45, 2, '矿泉水', 100, '2022-05-15 12:11:49', 12, '2022-05-15 12:55:15', 13, 1, '地震-需大量矿泉水保障灾区人民生活', '258d3b22-7d49-4d48-aa92-fe853c781188.png', '山西省晋中市');

INSERT INTO `t_recourse` VALUES (46, 4, '医用防护服', 1000, '2022-05-15 12:14:56', 12, NULL, NULL, 0, '疫情-急缺大量医用防护服', '289f5e6e-3030-4094-b079-1f12b7f51a1a.png', '上海市');

INSERT INTO `t_recourse` VALUES (47, 2, '蔬菜', 2000, '2022-05-15 12:16:51', 12, '2022-05-15 12:40:03', 13, 2, '疫情-郑州疫情封城急需大量蔬菜', 'd06cc942-92c4-4f26-9dd4-9e48a26c58b5.png', '河南省郑州市');

INSERT INTO `t_recourse` VALUES (48, 4, '药品', 500, '2022-05-15 12:19:45', 12, '2022-05-15 12:40:23', 13, 2, '洪水-急需大量医药用品救急灾区人民', 'b823586c-6135-4590-b990-ba2d91231373.png', '山西省运城市新绛县');

INSERT INTO `t_recourse` VALUES (49, 2, '生活物资', 2000, '2022-05-15 12:21:30', 12, '2022-05-15 12:38:51', 13, 2, '地震-急需大量生活物资重建家园', 'a9a9222c-9e00-427e-9278-0c698a9afe8c.png', '四川省成都市');

(10)新闻表 (t_new)

创建新闻表SQL语句:

CREATE TABLE `t_new`  (

  `ID` int(0) NOT NULL AUTO_INCREMENT COMMENT 'id',

  `title` varchar(3072) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '标题',

  `releaseTime` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '发布时间',

  `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '内容',

  `source` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '来源',

  `desc1` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '描述',

  PRIMARY KEY (`ID`) USING BTREE

) ENGINE = InnoDB AUTO_INCREMENT = 45 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '新闻表 ' ROW_FORMAT = Dynamic;

给新闻表插入数据SQL语句:

INSERT INTO `t_new` VALUES (40, '国家卫健委:昨日新增本土确诊病例226例', '2022-05-15 01:05:55', ',<p style=\"text-align: center;\">       <span style=\"font-weight: 700; font-family: simsun; text-align: -webkit-center; background-color: rgb(255, 255, 255);\"><a href=\"http://news.enorth.com.cn/system/2020/01/23/037946966.shtml\" target=\"_blank\" style=\"background-color: transparent; color: rgb(0, 0, 0); text-decoration-line: none; padding: 0px; margin: 0px; box-sizing: border-box; transition: color 0.2s linear 0s;\">新型冠状病毒感染的肺炎疫情快报</a></span></p><p>       <span style=\"font-family: simsun; background-color: rgb(255, 255, 255);\">5月14日0—24时,31个省(自治区、直辖市)和新疆生产建设兵团报告新增确诊病例239例。其中境外输入病例13例(福建7例,上海2例,云南2例,广东1例,四川1例),含1例由无症状感染者转为确诊病例(在广东);本土病例226例(上海166例,北京33例,四川13例,河南5例,辽宁2例,贵州2例,河北1例,吉林1例,广东1例,广西1例,重庆1例),含120例由无症状感染者转为确诊病例(上海111例,北京7例,四川2例)。新增死亡病例3例,均为本土病例,均在上海;无新增疑似病例。</span></p><p><span style=\"font-family: simsun; background-color: rgb(255, 255, 255);\"></span></p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px 0px 13px; box-sizing: border-box; font-family: simsun; white-space: normal; background-color: rgb(255, 255, 255);\">当日新增治愈出院病例448例,其中境外输入病例15例,本土病例433例(上海290例,北京54例,吉林25例,黑龙江15例,广东15例,河南14例,浙江5例,江西5例,江苏3例,内蒙古2例,山东2例,重庆2例,四川1例),解除医学观察的密切接触者28076人,重症病例较前一日减少1例。</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px 0px 13px; box-sizing: border-box; font-family: simsun; white-space: normal; background-color: rgb(255, 255, 255);\">  境外输入现有确诊病例196例(无重症病例),无现有疑似病例。累计确诊病例18386例,累计治愈出院病例18190例,无死亡病例。</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px 0px 13px; box-sizing: border-box; font-family: simsun; white-space: normal; background-color: rgb(255, 255, 255);\">  截至5月14日24时,据31个省(自治区、直辖市)和新疆生产建设兵团报告,现有确诊病例6141例(其中重症病例383例),累计治愈出院病例210454例,累计死亡病例5209例,累计报告确诊病例221804例,无现有疑似病例。累计追踪到密切接触者3879227人,尚在医学观察的密切接触者342128人。</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px 0px 13px; box-sizing: border-box; font-family: simsun; white-space: normal; background-color: rgb(255, 255, 255);\">  31个省(自治区、直辖市)和新疆生产建设兵团报告新增无症状感染者1550例,其中境外输入58例,本土1492例(上海1203例,四川196例,河南24 例,辽宁16例,江苏9例,北京8例,河北8例,安徽7例,青海7例,浙江3例,江西2例,山东2例,广西2例,重庆2例,贵州2例,吉林1例)。</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px 0px 13px; box-sizing: border-box; font-family: simsun; white-space: normal; background-color: rgb(255, 255, 255);\">   当日解除医学观察的无症状感染者4331例,其中境外输入45例,本土4286例(上海4003例,辽宁54例,江苏46例,吉林40例,江西39例,山东34例,河南24例,河北13例,黑龙江10例,浙江8例,北京5例,广西4例,云南4例,山西1例,四川1例);当日转为确诊病例121例(境外输入1例);尚在医学观察的无症状感染者58878例(境外输入481例)。</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px 0px 13px; box-sizing: border-box; font-family: simsun; white-space: normal; background-color: rgb(255, 255, 255);\">  累计收到港澳台地区通报确诊病例1031473例。其中,香港特别行政区331567例(出院61157例,死亡9360例),澳门特别行政区82例(出院82例),台湾地区699824例(出院13742例,死亡1049例)。</p><p> </p>', '央视新闻客户端', '5月14日0—24时,31个省(自治区、直辖市)和新疆生产建设兵团报告新增确诊病例239例。');

INSERT INTO `t_new` VALUES (41, '各地加强疫情防控 有序恢复生产生活秩序', '2022-05-15 01:05:46', ',<p>        <span style=\"background-color: rgb(255, 255, 255); font-family: "Microsoft Yahei", SimSun; font-size: 18px; text-align: center;\"> </span><span style=\"text-align: center; color: rgb(37, 37, 37); font-family: "Microsoft Yahei", SimHei; font-size: 20px;\">各地加强疫情防控 有序恢复生产生活秩序</span></p><p style=\"margin-top: 0px; margin-bottom: 15px; padding: 0px; border: 0px; overflow: hidden; font-size: 18px; line-height: 36px; font-family: "Microsoft Yahei", SimSun; white-space: normal; background-color: rgb(255, 255, 255);\">      <span style=\"font-size: 16px;\">为阻断病毒传播,从13日开始,北京市连续三天在12个区开展区域核酸筛查。目前,北京市各级党政机关、国有企事业单位累计有8万人下沉到基层充实社区一线防控力量。</span></p><p style=\"margin-top: 0px; margin-bottom: 15px; padding: 0px; border: 0px; overflow: hidden; font-size: 18px; line-height: 36px; font-family: "Microsoft Yahei", SimSun; white-space: normal; background-color: rgb(255, 255, 255);\"><span style=\"font-size: 16px;\">  为巩固疫情防控成果,吉林长春主城区每3天进行一轮全员核酸检测,持续排查风险隐患;广东湛江倡导市民停止非必要活动,尽量减少人员聚集;江西宜春各大医院开通了孕产妇、儿童、老人、急症病人急救绿色通道,全力保障特殊人群及时入院治疗。</span></p><p style=\"margin-top: 0px; margin-bottom: 15px; padding: 0px; border: 0px; overflow: hidden; font-size: 18px; line-height: 36px; font-family: "Microsoft Yahei", SimSun; white-space: normal; background-color: rgb(255, 255, 255);\"><span style=\"font-size: 16px;\">       随着疫情形势逐渐向好,江苏徐州市在严格疫情管控同时,采用车辆行程提前报备、专人监管等措施,做到“防疫情、保畅通”两不误,为复工复产提供运输保障。</span></p><p style=\"margin-top: 0px; margin-bottom: 15px; padding: 0px; border: 0px; overflow: hidden; font-size: 18px; line-height: 36px; font-family: "Microsoft Yahei", SimSun; white-space: normal; background-color: rgb(255, 255, 255);\"><span style=\"font-size: 16px;\">  湖北日前出台《金融支持文化旅游行业稳企纾困专项行动方案》,为文化旅游企业拓宽融资渠道;贵州出台《促进服务业领域困难行业恢复发展的实施方案》,提出58条扶持措施,帮助餐饮、零售、住宿等服务业渡过难关、恢复发展。</span></p><p> </p>', '央视网消息(新闻联播)', '各地积极统筹疫情防控和经济社会发展,从严从紧落实防控措施的同时,有序恢复生产生活秩序。');

INSERT INTO `t_new` VALUES (42, '上海已有8个区实现社会面基本清零', '2022-05-15 01:05:40', ',<p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px 0px 13px; box-sizing: border-box; text-align: center;\"><span style=\"font-weight: 700;\"><a href=\"http://news.enorth.com.cn/system/2020/01/23/037946966.shtml\" target=\"_blank\" style=\"background-color: transparent; color: rgb(0, 0, 0); text-decoration-line: none; padding: 0px; margin: 0px; box-sizing: border-box; transition: color 0.2s linear 0s;\">新型冠状病毒感染的肺炎疫情快报</a></span></p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px 0px 13px; box-sizing: border-box; font-family: simsun; white-space: normal; background-color: rgb(255, 255, 255); text-indent: 2em;\">据“上海发布”微信公众号消息,5月11日上午举行的上海市疫情防控工作新闻发布会上,上海市卫生健康委副主任赵丹丹介绍,上海全市已有8个区和浦东部分街镇社会面基本清零,这8个区分别是奉贤、金山、崇明、青浦、松江、普陀、嘉定和徐汇。</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px 0px 13px; box-sizing: border-box; font-family: simsun; white-space: normal; background-color: rgb(255, 255, 255); text-indent: 2em;\">赵丹丹介绍,5月10日,上海市新增228例新冠肺炎本土确诊病例和1259例本土无症状感染者。228例本土确诊病例中,30例在闭环隔离管控中发现,198例为无症状感染者转归确诊病例。1259例本土无症状感染者均在闭环隔离管控中发现。</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px 0px 13px; box-sizing: border-box; font-family: simsun; white-space: normal; background-color: rgb(255, 255, 255); text-indent: 2em;\">截至5月10日24时,在定点医疗机构接受治疗的重型患者379例、危重型71例。</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px 0px 13px; box-sizing: border-box; font-family: simsun; white-space: normal; background-color: rgb(255, 255, 255); text-indent: 2em;\">5月10日,新增本土死亡病例7例,平均年龄87.3岁。7位患者合并有严重的多脏器基础疾病,包括冠心病、急慢性心功能不全、严重心律失常、重度高血压、脑梗死及后遗症、阿尔兹海默症、糖尿病、急性肝功能衰竭、急慢性肾功能不全等。7例死亡病例中有1例曾接种过1剂次新冠疫苗,其余均未接种新冠疫苗。死亡的直接原因均为基础疾病。</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px 0px 13px; box-sizing: border-box; font-family: simsun; white-space: normal; background-color: rgb(255, 255, 255); text-indent: 2em;\">截至5月11日9时:这次疫情全市已累计排查到在沪密切接触者832144人,均已落实管控。</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px 0px 13px; box-sizing: border-box; font-family: simsun; white-space: normal; background-color: rgb(255, 255, 255); text-indent: 2em;\">昨天,上海全市本土确诊病例出院607例,无症状感染者解除集中隔离医学观察8094例,他们将返回居住地接受健康监测,请社区妥善做好接返工作。</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px 0px 13px; box-sizing: border-box; font-family: simsun; white-space: normal; background-color: rgb(255, 255, 255); text-indent: 2em;\">赵丹丹介绍,目前又有一个区徐汇区达到社会面基本清零标准,全市已有8个区和浦东部分街镇社会面基本清零,这8个区分别是奉贤、金山、崇明、青浦、松江、普陀、嘉定和徐汇。</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px 0px 13px; box-sizing: border-box; font-family: simsun; white-space: normal; background-color: rgb(255, 255, 255); text-indent: 2em;\">近阶段,上海开展了基于三区划分的“抗原+核酸”组合筛查。根据筛查结果,5月10日全市共划分封控区6303个,涉及人口数208万;管控区17990个,涉及人口数324万;防范区50056个,涉及人口数1797万。</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px 0px 13px; box-sizing: border-box; font-family: simsun; white-space: normal; background-color: rgb(255, 255, 255); text-indent: 2em;\">赵丹丹表示,当前,上海市疫情防控进入“逆水行舟、不进则退”的关键时期和吃劲阶段。全市聚焦“降新增、防反弹”工作取得一定成效,但也要清醒地看到,目前成绩并不稳固,反弹风险依然存在。要坚持“动态清零”总方针不动摇,落实“四应四尽”要求,围绕“降新增、防反弹”,细化措施,找准盲点漏点,全力实现社会面清零,坚决打赢大上海保卫战。</p>', '中新网', '据“上海发布”微信公众号消息,5月11日上午举行的上海市疫情防控工作新闻发布会上,上海市卫生健康委副主任赵丹丹介绍,上海全市已有8个区和浦东部分街镇社会面基本清零,这8个区分别是奉贤、金山、崇明、青浦、松江、普陀、嘉定和徐汇。');

INSERT INTO `t_new` VALUES (43, '北京以快制快坚持“动态清零”', '2022-05-15 01:05:01', ',<p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px 0px 13px; box-sizing: border-box; text-align: center;\"><span style=\"font-weight: 700;\"><a href=\"http://news.enorth.com.cn/system/2020/01/23/037946966.shtml\" target=\"_blank\" style=\"background-color: transparent; color: rgb(0, 0, 0); text-decoration-line: none; padding: 0px; margin: 0px; box-sizing: border-box; transition: color 0.2s linear 0s;\">新型冠状病毒感染的肺炎疫情快报</a></span></p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px 0px 13px; box-sizing: border-box; font-family: simsun; white-space: normal; background-color: rgb(255, 255, 255); text-indent: 2em;\">“当前首都新增新冠肺炎病例仍在高位运行,仍有零星社会面病例,首都与疫情的较量正处于胶着状态。”5月8日,在北京市新型冠状病毒肺炎疫情防控工作第328场新闻发布会上,北京市疾病预防控制中心副主任、全国新型冠状病毒肺炎专家组成员庞星火介绍,“自4月22日至5月8日15时,北京市累计报告727例新冠肺炎病毒感染者,涉及15个区。”</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px 0px 13px; box-sizing: border-box; font-family: simsun; white-space: normal; background-color: rgb(255, 255, 255); text-indent: 2em;\">面对本轮疫情,北京全市上下迅速行动,深查细排,快筛严管,抓细抓实各项疫情防控举措。通过多轮核酸全面筛查,北京正一鼓作气,瞄准“社会面清零”的目标全面推进各项工作。</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px 0px 13px; box-sizing: border-box; font-family: simsun; white-space: normal; background-color: rgb(255, 255, 255); text-indent: 2em;\">严防社会面风险,北京坚持“24小时处置法则”,第一时间锁定风险点位和风险人员,第一时间落位管控到位,做到不失一处、不漏一人。</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px 0px 13px; box-sizing: border-box; font-family: simsun; white-space: normal; background-color: rgb(255, 255, 255); text-indent: 2em;\">近日,北京统一部署了多轮大规模核酸检测筛查。据介绍,5月7日共筛查1552万人,全部完成检测,共筛出5管混采阳性,其中,朝阳、顺义各2管,房山1管。自4月25日起,北京市已开展了8轮区域核酸筛查,共筛出60管混采阳性,为阻断疫情传播、早日实现社会面动态清零发挥了重要作用。</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px 0px 13px; box-sizing: border-box; font-family: simsun; white-space: normal; background-color: rgb(255, 255, 255); text-indent: 2em;\">为了尽早实现“社会面清零”的目标,北京完善了健康宝功能,对未按要求检测的人员进行北京健康宝弹窗提示。同时优化常态化核酸采样点位布局,在全市16区和经开区设立2500多个核酸检测点,设置老幼人员绿色通道和弹窗人员专用通道,分时分批组织群众采样。同时严格采样操作规范,截至目前,未发现因参加区域核酸筛查而感染的情况。</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px 0px 13px; box-sizing: border-box; font-family: simsun; white-space: normal; background-color: rgb(255, 255, 255); text-indent: 2em;\">严格分类防疫管理。朝阳区、房山区是当前首都疫情防控重中之重。北京提级管控,科学划定封控区、管控区、防范区,严格执行居家办公等各项措施,降低到岗率,减少流动性,不给病毒传播机会。对封(管)控区、临时管控区、集中医学观察点、居家观察等都严格规范管理,封控区、集中隔离、居家隔离人员足不出户,工作人员按照规范指引做好个人防护,防止交叉感染,遏制、减少新增病例。对密接人员判定按照标准坚决果断,第一时间转运实行集中隔离。对违反居家隔离规定人员严格依法追究法律责任。坚持每日盘点,查找问题,举一反三堵塞防疫漏洞。</p>', '光明日报', '面对本轮疫情,北京全市上下迅速行动,深查细排,快筛严管,抓细抓实各项疫情防控举措。通过多轮核酸全面筛查,北京正一鼓作气,瞄准“社会面清零”的目标全面推进各项工作。');

INSERT INTO `t_new` VALUES (44, '水利部珠江委终止水旱灾害防御Ⅳ级应急响应', '2022-05-15 01:05:21', ',<p style=\"text-align: left;\"><span style=\"font-family: simsun; background-color: rgb(255, 255, 255);\">   鉴于当前流域防汛形势趋于平稳,水利部珠江委决定于5月15日9时终止水旱灾害防御Ⅳ级应急响应。</span></p>', '央视新闻客户端', '鉴于当前流域防汛形势趋于平稳,水利部珠江委决定于5月15日9时终止水旱灾害防御Ⅳ级应急响应。');

INSERT INTO `t_new` VALUES (45, '同心抗疫你的背后有我', '2022-05-15 01:05:07', ',<p style=\"text-align: center;\"><span style=\"font-weight: 700; font-family: simsun; text-align: -webkit-center; background-color: rgb(255, 255, 255);\">新型冠状病毒感染的肺炎疫情快报</span></p><p><span style=\"font-weight: 700; font-family: simsun; text-align: -webkit-center; background-color: rgb(255, 255, 255);\"></span></p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px 0px 13px; box-sizing: border-box; font-family: simsun; white-space: normal; background-color: rgb(255, 255, 255);\">  4月22日至5月14日15时,北京市累计报告1019例新冠肺炎病毒感染者,涉及15个区。</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px 0px 13px; box-sizing: border-box; font-family: simsun; white-space: normal; background-color: rgb(255, 255, 255);\">  每一轮核酸检测背后,是医护人员的付出,是社区人员的辛劳,是全体居民的配合,是各个部门的支持……同心抗疫的背后,有你,有他,有我们每一个人。</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px 0px 13px; box-sizing: border-box; font-family: simsun; white-space: normal; background-color: rgb(255, 255, 255);\">  无数医务工作者、社区工作人员、下沉干部、志愿者奋战在抗疫一线,他们不辞辛劳、默默工作,汇聚起风雨同舟、共克时艰的信心和力量,构筑了有效的防疫屏障。</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px 0px 13px; box-sizing: border-box; font-family: simsun; white-space: normal; background-color: rgb(255, 255, 255);\">  “你的背后有我,我们同心抗疫。”</p><p> </p>', '新华网', '4月22日至5月14日15时,北京市累计报告1019例新冠肺炎病毒感染者,涉及15个区。');

5.2测试数据

测试语句

INSERT INTO s_user (realname,username,pwd,sex) VALUES ('张三','miszhang','123456',1)

INSERT INTO s_user (realname,username,pwd,sex) VALUES ('张三','miszhang','123456',1) 如图5-1 测试截图

图5-1 测试截图  

INSERT INTO t_customer (customername,cpassword,sex) VALUES ('赵公子','888888','1')

INSERT INTO t_customer (customername,cpassword,sex) VALUES ('李小姐','666666','0')如图5-2 测试截图

图5-2 测试截图 

INSERT INTO s_role (roleName) VALUES ('审核员') 如图5-3测试截图

图5-3 测试截图

5.3 查询

5.3.1 单表查询

(1)查询用户名是小仙女的客户信息

select * from t_customer where customername='小仙女'

查询结果如图5-4所示。

 图5-4 客户信息查询结果

(2)查询所有角色信息

select * from s_role

查询结果如图5-5所示。

 图5-5 角色信息查询结果

(3)查询用户名包含ceshi的所有用户信息

select * from s_user where username like '%ceshi%'

查询结果如图5-6所示。

 图5-6 用户信息查询结果

(4)查询所有部门信息

select * from s_dept

查询结果如图5-7所示。

 图5-7 部门信息查询结果

5.3.2 统计查询

(1)统计求助信息表的各类数据数量

①统计求助未审核的信息数量

select count(1) from t_recourse where flag=-1

查询结果如图5-8所示。

 图5-8 未审核的信息数量

②统计审核通过待求助的信息数量

select count(1) from t_recourse where flag=0

查询结果如图5-9所示。

 图5-9 审核通过待求助的信息数量

③统计已被求助的信息数量

select count(1) from t_recourse where flag=1

查询结果如图5-10所示。

 图5-10 已被求助的信息数量

④统计已收到求助物资的信息数量

查询结果如图5-11所示。

 图5-11 已收到求助物资的信息数量

(2)统计部门为“部门1”的所有用户数量

select count(1)

from s_user

where deptId =(

select id from s_dept where deptName='部门1'

)

查询结果如图5-12所示。

 图5-12 “部门1”的所有用户数量

(3)统计角色为“平台管理员”的所有用户数量

select count(1)

from s_user

where roleId = (

select id from s_role where roleName='平台管理员'

)

查询结果如图5-13所示。

 图5-13 角色是“平台管理员”的所有用户数量

(4)统计平台所有注册客户数量

select count(1) from t_customer

查询结果如图5-14所示。

 图5-14 平台注册的所有客户数量

(5)统计平台所有新闻数量

select count(1) from t_new

统计结果如图5-15所示。

 图5-15 平台的所有新闻数量

5.3.3 多表查询

(1)查询部门名称为“部门1”的所有部门信息

select a.realname,a.username,a.pwd,a.sex,b.deptName,a.roleId,a.status,

a.lastLogin

from s_user a

left join s_dept b on a.deptId=b.id

where b.deptName = '部门1'

查询结果如图5-16所示。

图5-16 部门1的所有用户信息 

(2)查询平台管理员所有的资源信息

select *

from s_roleresource a

left join s_role b on a.roleId = b.id

left join s_resource c on a.resourceId = c.id

where b.roleName = '平台管理员'

查询结果如图5-17所示。

图5-17 查询平台管理员所有的资源信息 

(3)查询物资分类下面的所有二级分类信息

select a.typename,b.typename

from s_typemain a

left join s_typedetail b on a.id = b.pid

where a.typename=’物资分类’

查询结果如图5-18所示。

                      

 图5-18 查询物资分类下面的所有二级分类信息

(4)查询角色为“平台管理员”的所有用户信息

select *

from s_user a

left join s_role b on a.roleId = b.id

where b.roleName = '平台管理员'

查询结果如图5-19所示。

图5-19 查询角色为“平台管理员”的所有用户信息

第六章  视图与查询

6.1视图概述

6.1.1 视图简述

(1)视图是虚表,它在存储时只存储视图的定义,而没有存储对应的数据。

(2)视图通过定义从基表中搜集数据,并展现给用户。

(3)数据存储在对应的数据表中。

6.1.2 视图的优缺点

优点:(1)视图能简化用户的操作;

           (2)视图机制可以使用户以不同的方式查询同一数据;

           (3)视图对数据库重构提供了一定程度的逻辑独立性;

           (4)视图可以对机密的数据提供安全保护。

缺点:(1)降低性能,通过视图查询起来需要花费时间;

           (2)视图是只读的,更新时需要更新原表,对用户来说很麻烦。

6.1.3 视图进行的修改操作有以下限制

(1)若视图的字段来自表达式或常量,则不允许对该视图执行INSERT和UPDATE操作,但允许执行DELETE操作。

(2)若视图的字段来自集合函数,则此视图不允许修改操作。

(3)若视图定义中含有GROUP BY 子句,则此视图不允许修改操作。

(4)若视图定义中含有DISTINCT短语,则此视图不允许修改操作。

(5)一个不允许修改操作视图上定义的视图,也不允许修改操作。

6.1.4 视图的作用

(1)视图能够简化用户的操作

(2)视图使用户能以多种角度看待同一数据

(3)视图对重构数据库提供了一定程度上的逻辑独立性

(4)视图能够对机密数据提供安全保护

(5)适当利用视图可以更清晰地表达查询

6.2视图创建与查询代码及效果图

(1)创建查询物资分类下面的所有二级分类信息的视图,并查询。

视图创建SQL语句:

CREATE view alltype as

(

select `a`.`typename` AS `typename1`,`b`.`typename` AS `typename` from (`s_typemain` `a` left join `s_typedetail` `b` on((`a`.`id` = `b`.`pid`))) where (`a`.`typename` = '物资分类')

)

创建成功效果如图6-1所示:

 图6-1 视图创建成功

视图查询SQL语句:

select *

from alltype

查询结果如图6-2所示:

 图6-2 视图查询结果

(2)创建查询平台管理员所有的资源信息,并查询

视图创建SQL语句:

CREATE view userresource as

(select b.roleName,c.resourceName,c.resourceUrl

from s_roleresource a

left join s_role b on a.roleId = b.id

left join s_resource c on a.resourceId = c.id)

创建成功效果如图6-3所示:

 图6-3 视图创建成功

视图查询SQL语句:

select *

from userresource

查询结果如图6-4所示:

 图6-3 视图查询结果

Guess you like

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