SSM pet adoption system
Summary
Pet abandonment has always been a factor that cannot be ignored that affects the urban environment and residents' lives. Based on this, this article designs and implements a pet adoption system. Users can use this system to view and search pet-related information, apply for adoption, and provide them with loving help. This system effectively solves problems such as difficulties in pet adoption and establishes a convenient communication bridge between pets and social animal lovers.
The pet adoption system is based on a browser and server architecture platform, developed using the cross-platform JAVA language, using the SSM framework for logical control, the MySQL database to store data, and finally the Tomcat server is released. The system can run in multiple environments.
Keywords: pet adoption , SSM framework, MySQL database , Java
SSM Pet Adoption System
Abstract
Abandonment of pets has always been a factor that cannot be ignored in affecting the urban environment and residents' lives. Based on this, this article designs and implements a pet adoption system. Through this system, users can view information related to searching for pets, apply for adoption, and provide loving assistance. This system effectively solves problems such as difficulties in carrying out pet adoption work, and establishes a convenient communication bridge between pets and social animal lovers.
The pet adoption system is based on a browser and server architecture platform, developed using a cross platform JAVA language, using the SSM framework for logical control, MySQL database to store data, and finally Tomcat server to complete the release. The system can run in multiple environments.
Key words: pet adoption, SSM framework, MySQL database, Java
Table of contents
1.3 Organizational structure of this article
Chapter 2 Introduction to Related Technologies
2.5 Introduction to SSM framework
3.1.1 Legal feasibility analysis
3.1.2 Technical feasibility analysis
3.1.3 Economic feasibility analysis
3.2 Functional requirements analysis
3.3 Non-functional requirements analysis
4.1 System architecture design
4.2 System functional structure
Chapter 5 System Implementation
5.4.4 Address management module
5.4.7 Adoption feedback module
5.5.1 Website management module
5.5.2 Personnel management module
5.5.3 Content management module
5.5.4 Shopping management module
5.5.6 Personal management module
Chapter 1 Introduction
1.1 Research background
With the rapid development of my country's economy and science and technology in recent years, people's living standards have continued to improve. After people have gained a rich material life, their demand for enriching their spiritual life is also increasing day by day. Keeping pets as spiritual companions has become the choice of many people. They treat pets as family members, accompany them to live with them, and derive pleasure from them. But while people regard keeping pets as a kind of spiritual sustenance and life companions, some people inevitably abandon their pets for various reasons. Pets generally refer to ownerless pets. Stray animals in cities mainly include stray dogs and stray cats, which are mainly discarded by humans or lost in public places. Today, there are more and more stray animals in our country, but the management of stray animals is very chaotic.
In order to solve the problem of pet overpopulation, public or private pet rescue centers have appeared in Bi Province and cities. However, due to regional restrictions, lack of funds, difficulties in publicity and other issues, the development of pet adoption and sponsorship has been slow. However, with the development of Intcmet technology, especially the rapid popularization of e-commerce, it has provided good conditions for the popularization and rapid development of pet adoption and sponsorship. Although there are some related adoption and rescue websites on the Internet, due to problems such as untimely information updates, geographical restrictions, and lack of human and material resources, caring people who have the intention and conditions to adopt cannot or postpone adoption, and there is an overpopulation of animals within the rescue stations. , the shortage of funds cannot form a virtuous circle. Therefore, developing an online pet adoption system has become a top priority.
1.2 Research status
In the United States and Canada, pets are taken in by private rescue organizations. Both countries have national non-governmental animal rescue organizations, part of which comes from government funding and the rest from private donations. SPCA (the Society for the Prevention of Cruelty to Animals) is a non-profit public welfare organization founded by Henry Bergh, which aims to convey the voices of animals to humans. SCPA, which specializes in protecting abandoned or abused animals, has now spread almost all over the United States, and its influence has spread to many countries or regions in the world, such as the Hong Kong Society for the Prevention of Cruelty to Animals (HKSPCA) in Hong Kong. Abroad, due to the large scale of stray animal rescue organizations , so their official website is more formal and has more complete functions. For example, the SPCA's official website has a donation module, a science popularization module, an adoption module, a survey module, and an introduction module .
In our country , pet rescue and adoption has always been one of the issues of widespread concern to the whole society . As early as 2017, representatives of the National Two Sessions put forward suggestions for improving pet rescue work, and received widespread attention from the society. This also shows that our country The pet rescue business is growing step by step. However, pet rescue is a long-term and complex work, and a large amount of manpower, material and financial resources are required to carry out this work. How to ensure that pet rescue work can be carried out in a long-term and stable manner is an important issue that must be studied . At present, China's rescue , adoption and management mechanism for stray animals is not perfect enough. It relies more on the spontaneous organization of volunteer rescue stations by the private sector to carry out small-scale rescue. Due to the small scale of most pet adoption and rescue organizations in China, there are two main types of organization websites. One is to directly use the blog as the website. The website built in this way is relatively simple and usually only has the function of publishing articles. Communication between visitors and relief organizations needs to be done through the contact information reserved in the blog and using other tools, such as the one established using Douban Blog. Pet adoption rescue shelter. The other is to use ready-made website construction templates to build a website. The website built in this way is more beautiful than the previous method, but it also lacks practicality . How to speed up the development of the pet rescue and adoption system ? The solution to this problem is the key to the perfect combination of e-commerce and pet adoption today. The rapid development of the Internet, people's dependence on the Internet, and the Internet has brought people such convenient, fast, and all-day services. At the same time, the virtual space of the Internet has become the main activity place for young people born in the 80s, 90s , and 00s . The traditional lifestyle is gradually being replaced by this new lifestyle, and everyone will consciously realize their needs through the Internet.
1.3 Organizational structure of this article
Six chapters together constitute the research and design content of this article, including:
Chapter One Introduction. The beginning of this article provides a textual description of the research background and significance of this topic.
Chapter 2: Introduction to related technologies. Mainly introduces the SSM framework, Java embedded scripting language, B/S mode, etc.
Chapter 3: System analysis. Including description of the overall system requirements, analysis of system requirements from a functional perspective, non-functionality and other aspects to analyze whether the system can be implemented.
Chapter 4: System Design. The important part of this article provides the detailed design of the system architecture and the design instructions of some main functional modules.
Chapter 5: System implementation. This system is divided into prerequisite development tool introduction and later functional code implementation.
Chapter Six: System Testing. After the system is completed, each module will be functionally tested based on the test cases of each module.
Chapter 2 Introduction to Related Technologies
2.1 Development technology
The front-end part of this system is developed based on the MVVM model, using B/S mode, and the back-end part is developed based on Java's ssm framework.
Front-end part: The front-end framework uses the popular progressive JavaScript framework Vue.js. Use Vue-Router and Vuex to realize dynamic routing and global state management, Ajax to realize front-end and back-end communication, Element UI component library to quickly prototype the page, and the project front-end to achieve responsiveness through grid layout, which can be adapted to PC, tablet, mobile phone, etc. Perfect layout display for different screen sizes.
Back-end part: Use ssm as the development framework, and integrate MyBatis, Redis and other related technologies.
2.2 MVVM pattern
MVVM is the abbreviation of Model-View-ViewModel. It is essentially an improved version of MVC. MVVM abstracts the state and behavior of the View, allowing us to separate the view UI and business logic. Of course, ViewModel has already done these things for us. It can take out the data of the Model and help handle the business logic involved in the View due to the need to display content. Microsoft's WPF brings new technical experiences, such as Silverlight, audio , video , 3D , animation ..., which results in the software UI layer being more detailed and customizable. At the same time, at the technical level, WPF also brings new features such as Binding, Dependency Property, Routed Events, Command, DataTemplate, ControlTemplate and so on. The origin of the MVVM (Model-View-ViewModel) framework is a new architectural framework that evolved from the application method of combining the MVP (Model-View-Presenter) pattern with WPF . It is based on the original MVP framework and incorporates the new features of WPF to cope with increasingly complex changes in customer needs.
2.3 MySQL database
The advancement of science and technology has brought many conveniences to daily life: classroom projectors use virtual imaging technology, and digital cameras use photoelectric detection technology. For example, the records of supermarket goods entering and leaving the warehouse require an information warehouse. This information warehouse is a database, and this time the pet adoption system also needs the support of this technology.
The software MySQL is used because it can accept access from multiple users, and Archive etc. exist in it. It will first classify the data and then save it in tables respectively. Such special operations will improve the speed of the data management system itself and allow the database to be used flexibly. MySQL's code is public and allows others to compile and upgrade it again. This feature can reduce user costs and form a good website system when paired with appropriate software. Although it has shortcomings, in all aspects, it is the mainstream application object of users.
2.4 B/S structure
B/S structure (Browser/Server, browser/server mode) is a network structure mode after the rise of WEB. The WEB browser is the most important application software on the client. This model unifies the client and concentrates the core parts of system function implementation on the server, simplifying the development, maintenance and use of the system. Just install a browser on the client, such as Chrome, Safari, Microsoft Edge, Netscape Navigator or Internet Explorer, and install SQL Server, Oracle, MYSQL and other databases on the server. The browser interacts with the database through the Web Server.
2.5 Introduction to SSM framework
The SSM (Spring+SpringMVC+MyBatis) framework set is integrated by the two open source frameworks Spring and MyBatis (SpringMVC is part of Spring). It is often used as a framework for web projects with relatively simple data sources.
1.1 Spring
Spring is like a big factory that assembles beans in the entire project. In the configuration file, you can specify the use of specific parameters to call the constructor method of the entity class to instantiate the object. It can also be called the glue in the project.
The core idea of Spring is IoC (Inversion of Control), which means that programmers no longer need to explicitly `new` an object, but let the Spring framework do it all for you.
1.2 SpringMVC
SpringMVC intercepts user requests in the project. Its core Servlet, DispatcherServlet, assumes the responsibility of intermediary or front desk, and matches user requests through HandlerMapping to the Controller. The Controller is the specific operation performed in response to the request. SpringMVC is equivalent to struts in the SSH framework.
1.3 apartment
Mybatis is an encapsulation of jdbc, which makes the underlying operations of the database transparent. The operations of mybatis are centered around a sqlSessionFactory instance. Mybatis is associated to the Mapper file of each entity class through the configuration file. The Mapper file is configured with the SQL statement mapping required for each class to the database. Every time you interact with the database, get a sqlSession through sqlSessionFactory, and then execute the sql command.
The page sends a request to the controller, the controller calls the business layer processing logic, the logic layer sends a request to the persistence layer, the persistence layer interacts with the database, and then returns the result to the business layer, the business layer sends the processing logic to the controller, and the controller then Call the view to display the data.
2.6 Vue.js main functions
Vue.js is a progressive framework for building user interfaces. Unlike other heavyweight frameworks, Vue adopts a bottom-up incremental development design. Vue's core library only focuses on the view layer, and is very easy to learn and integrate with other libraries or existing projects. Vue, on the other hand, is fully capable of driving complex single-page applications developed using single-file components and libraries supported by the Vue ecosystem.
The goal of Vue.js is to implement responsive data binding and composed view components through the simplest possible API.
Vue.js itself is not a full-featured framework - it only focuses on the view layer. Therefore it is very easy to learn and very easy to integrate with other libraries or existing projects. On the other hand, Vue.js can also power complex single-page applications when used with related tools and support libraries
Chapter 3 System Analysis
3.1 Feasibility analysis
3.1.1 Legal feasibility analysis
Does developing software violate the law? This involves the issue of whether the software or system can be released. If you break the law, you will be punished by law. A common legal issue is software plagiarism. If you copy other people's software, you will be severely punished.
3.1.2 Technical feasibility analysis
After years of development, the software industry has now reached a large scale. There are countless professionals engaged in software development. The importance of the software industry has risen to the core position of influencing and promoting the development of the national economy. The architecture this system is based on is currently very mature and there are no technical difficulties that are difficult to implement.
3.1.3 Economic feasibility analysis
The time, labor and material costs required to develop software, the benefits after the development is completed, and whether the functions required by the software can be realized under existing economic conditions from the perspective of return on investment are all in line with actual requirements. Therefore, the pet adoption system is economically feasible and practical, and can save management costs.
3.2 Functional requirements analysis
The pet adoption system is mainly to further improve the service of pet rescue and adoption , and provides a convenient mechanism for user information, pet information , pet adoption , etc. This system has multiple types of users, namely administrators and registered users. The following is an introduction to the functions to be achieved by this system from the perspectives of these two users.
user:
Registration: First check whether the user name and email address exist. If they do not exist, you can register and encrypt the password entered by the user with MD5. After successful registration, it will prompt that the registration is successful and save the user information to the database.
Login: Before using the pet adoption system , users are required to log in to their personal account.
Pet information: Users can browse pet information online.
Adoption Feedback : Users can post feedback on the situation after adopting a pet .
administrator:
User management: manage users, user registration, including user nickname, user name information , and user account information .
Pet information management: publish and manage pet information.
Pet information management: Maintain and manage pet information.
Shopping management: Manage shopping malls, category lists, and order lists.
Adoption feedback management: Manage feedback information after pet adoption.
3.3 Non-functional requirements analysis
There are many non-functional requirements for the system, such as performance requirements, maximum number of users that can be hosted, stability, ease of use, etc. This system analysis takes into account the need for ease of use. Because the system is for people to use, it must be fully considered from the user's perspective and the user experience to make the system easy to understand, easy to use and easy to operate.
3.4 Use case analysis
1. Ordinary users mainly use the system for pet inquiry, shopping mall and adoption feedback . The figure below shows the use cases of ordinary users.
Figure 3-1 Common user use case diagram
2. The administrator is mainly responsible for personnel management, pet information management, pet information management , and shopping management. The following figure describes the use case diagram of the administrator.
Figure 3-2 Administrator use case diagram
3.5 Business process analysis
The system business flow chart is shown below.
Figure 3-3 System business flow chart
Business process diagram (TFD) describes the business processing process through some specific symbols. It emphasizes the relationship between each processing activity in the business process and specific business departments, and selects some modules for detailed description. Focus on describing the most important pet information query and shopping mall in the overall business of this system. After users enter the pet adoption system, they browse various module information. In addition, managers enter back-end management to implement relevant management methods of the pet adoption module. , and provide a feedback mechanism to the customer after resolution.
3.6 Data process analysis
The following is the top-level External entities include users and administrators, who input data into the system respectively to obtain the data to be output .
Figure 3-4 System top-level data flow diagram
The following figure shows the underlying data flow diagram of the system .
Figure 3-5 System underlying data flow diagram
The underlying data flow diagram of the pet adoption system mainly describes the data flow, data carrier, data processing, and specific interactions of external entities of the underlying modules of the system. This system is the data interaction between administrators and ordinary users on user management, pet information, adoption feedback and other modules.
Chapter 4 System Design
4.1 System architecture design
The system architecture design is mainly divided into three layers, mainly the Web layer, the business layer, and the Model layer. The web layer also includes the View layer and the Controller layer, and the Model layer includes the metadata extension layer and the data access layer.
Figure 4-1 System architecture diagram
4.2 System functional structure
In order to implement the system from "what to do" to "how to do it", based on the system design principles, the system functions are divided into functions that are more suitable for coding implementation. Based on the system architecture design in the figure above, a standardized system functional structure diagram is compiled to prepare for system implementation coding.
The following figure shows the system functional structure diagram.
Figure 4-2 System functional structure diagram
4.3 Function module design
User management is for all users and administrators. Unregistered users click Register and enter the registration page to fill in the new user information. After getting a custom generated account, the registration is completed. The activity diagram for unregistered user registration is shown below.
Figure 4-3 Unregistered user registration activity diagram
Users can log in to use more functions. First, enter the user login interface and enter the user account and password. The account and password information will be checked and verified in the background. If the verification is successful, the page will directly display the nickname of the logged in user to indicate successful login. Otherwise, it will return to the user login interface. The user login activity diagram is as shown below.
Figure 4-4 User login activity diagram
After the user logs in , he enters the function page for announcement messages, pet information, shopping mall, personal account, personal collection, address management, shopping management, order management, pet information, and adoption feedback . The user usage function activity diagram is shown in the figure below .
Figure 4-5 User function activity diagram
User function interface allows you to modify your own password. After entering the password change interface, check the current password. After successful verification, fill in the new password. The password change activity diagram is shown below.
Figure 4-6 Password changing activity diagram
4.4 Database design
The database used by the pet adoption system is MySQL. This part will design a reasonable database based on the system requirements and design. This system takes into account the future expansion of the system cluster, and the database will not use foreign keys. In addition, data management is simpler when foreign keys are not used, the operation is more convenient, and the performance is higher.
4.4.1 ER diagram
ER diagrams more intuitively tell developers the attributes of each data in the system, the connections between each data, and the types of each data. Through this model, you can understand the design of the database more intuitively and gradually improve it.
The system diagram design is as shown in the figure below.
Figure 4-7 System ER diagram
4.4.2 Table structure design
This system designs the database based on the ideas of the third paradigm to reduce redundancy to the greatest extent. It has a total of multiple tables, such as user registration table, administrator table, pet information table, pet adoption table, etc.
Table access_token (login access duration)
serial number |
name |
type of data |
length |
Decimal places |
Allow null values |
primary key |
default value |
illustrate |
1 |
token_id |
int |
10 |
0 |
N |
Y |
Temporary access badge ID |
|
2 |
token |
varchar |
64 |
0 |
Y |
N |
temporary access badge |
|
3 |
info |
text |
65535 |
0 |
Y |
N |
||
4 |
maxage |
int |
10 |
0 |
N |
N |
2 |
Maximum lifespan: Default 2 hours |
5 |
create_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
Creation time: |
6 |
update_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
Update time: |
7 |
user_id |
int |
10 |
0 |
N |
N |
0 |
user ID: |
Table address (shipping address:)
serial number |
name |
type of data |
length |
Decimal places |
Allow null values |
primary key |
default value |
illustrate |
1 |
address_id |
int |
10 |
0 |
N |
Y |
Shipping address: |
|
2 |
name |
varchar |
32 |
0 |
Y |
N |
Name: |
|
3 |
phone |
varchar |
13 |
0 |
Y |
N |
cell phone: |
|
4 |
postcode |
varchar |
8 |
0 |
Y |
N |
post code: |
|
5 |
address |
varchar |
255 |
0 |
N |
N |
address: |
|
6 |
user_id |
mediumint |
8 |
0 |
N |
N |
User ID: [0,8388607] User obtains other user-related data |
|
7 |
create_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
Creation time: |
8 |
update_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
Update time: |
9 |
default |
bit |
1 |
0 |
N |
N |
0 |
Default judgment |
Table adoption_feedback (adoption feedback)
serial number |
name |
type of data |
length |
Decimal places |
Allow null values |
primary key |
default value |
illustrate |
1 |
adoption_feedback_id |
int |
10 |
0 |
N |
Y |
Adoption Feedback ID |
|
2 |
title |
varchar |
64 |
0 |
Y |
N |
title |
|
3 |
user_number |
int |
10 |
0 |
Y |
N |
0 |
user ID |
4 |
full_name |
varchar |
64 |
0 |
Y |
N |
Name |
|
5 |
feedback_time |
date |
10 |
0 |
Y |
N |
feedback time |
|
6 |
feedback_details |
text |
65535 |
0 |
Y |
N |
Feedback details |
|
7 |
examine_state |
varchar |
16 |
0 |
N |
N |
Not reviewed |
Approval Status |
8 |
examine_reply |
varchar |
16 |
0 |
Y |
N |
moderation reply |
|
9 |
recommend |
int |
10 |
0 |
N |
N |
0 |
Intelligent Recommendation |
10 |
create_time |
datetime |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
creation time |
11 |
update_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
Update time |
Table article (article: article for content management system)
serial number |
name |
type of data |
length |
Decimal places |
Allow null values |
primary key |
default value |
illustrate |
1 |
article_id |
mediumint |
8 |
0 |
N |
Y |
Article id: [0,8388607] |
|
2 |
title |
varchar |
125 |
0 |
N |
Y |
Title: [0,125] is used in the title tag of articles and html |
|
3 |
type |
varchar |
64 |
0 |
N |
N |
0 |
Article classification: [0,1000] is used to search for articles of the specified type |
4 |
hits |
int |
10 |
0 |
N |
N |
0 |
Number of clicks: [0,1000000000] Number of people who visited this article |
5 |
praise_len |
int |
10 |
0 |
N |
N |
0 |
Number of likes |
6 |
create_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
Creation time: |
7 |
update_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
Update time: |
8 |
source |
varchar |
255 |
0 |
Y |
N |
Source: [0,255] Source of article |
|
9 |
url |
varchar |
255 |
0 |
Y |
N |
Source address: [0,255] used to jump to the website where the article was published |
|
10 |
tag |
varchar |
255 |
0 |
Y |
N |
Tag: [0,255] is used to mark the relevant content of the article. Multiple tags are separated by spaces. |
|
11 |
content |
longtext |
2147483647 |
0 |
Y |
N |
Text: the main content of the article |
|
12 |
img |
varchar |
255 |
0 |
Y |
N |
cover picture |
|
13 |
description |
text |
65535 |
0 |
Y |
N |
Article description |
Table article_type (article classification)
serial number |
name |
type of data |
length |
Decimal places |
Allow null values |
primary key |
default value |
illustrate |
1 |
type_id |
smallint |
5 |
0 |
N |
Y |
Category ID: [0,10000] |
|
2 |
display |
smallint |
5 |
0 |
N |
N |
100 |
Display order: [0,1000] determines the order in which categories are displayed. |
3 |
name |
varchar |
16 |
0 |
N |
N |
Category name: [2,16] |
|
4 |
father_id |
smallint |
5 |
0 |
N |
N |
0 |
Parent category ID: [0,32767] |
5 |
description |
varchar |
255 |
0 |
Y |
N |
Description: [0,255] describes the role of this classification |
|
6 |
icon |
text |
65535 |
0 |
Y |
N |
Category icon: |
|
7 |
url |
varchar |
255 |
0 |
Y |
N |
External link address: [0,255] If this category jumps to other websites, set it on the URL |
|
8 |
create_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
Creation time: |
9 |
update_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
Update time: |
Table auth (user rights management)
serial number |
name |
type of data |
length |
Decimal places |
Allow null values |
primary key |
default value |
illustrate |
1 |
auth_id |
int |
10 |
0 |
N |
Y |
Authorization ID: |
|
2 |
user_group |
varchar |
64 |
0 |
Y |
N |
user group: |
|
3 |
mod_name |
varchar |
64 |
0 |
Y |
N |
Module name: |
|
4 |
table_name |
varchar |
64 |
0 |
Y |
N |
Table Name: |
|
5 |
page_title |
varchar |
255 |
0 |
Y |
N |
page title: |
|
6 |
path |
varchar |
255 |
0 |
Y |
N |
Routing path: |
|
7 |
position |
varchar |
32 |
0 |
Y |
N |
Location: |
|
8 |
mode |
varchar |
32 |
0 |
N |
N |
_blank |
Jump method: |
9 |
add |
tinyint |
3 |
0 |
N |
N |
1 |
Is it possible to add: |
10 |
of the |
tinyint |
3 |
0 |
N |
N |
1 |
Can it be deleted: |
11 |
set |
tinyint |
3 |
0 |
N |
N |
1 |
Whether it can be modified: |
12 |
get |
tinyint |
3 |
0 |
N |
N |
1 |
Is it possible to view: |
13 |
field_add |
text |
65535 |
0 |
Y |
N |
Add fields: |
|
14 |
field_set |
text |
65535 |
0 |
Y |
N |
Modify fields: |
|
15 |
field_get |
text |
65535 |
0 |
Y |
N |
Query fields: |
|
16 |
table_nav_name |
varchar |
500 |
0 |
Y |
N |
Cross-table navigation name: |
|
17 |
table_nav |
varchar |
500 |
0 |
Y |
N |
Cross-table navigation: |
|
18 |
option |
text |
65535 |
0 |
Y |
N |
Configuration: |
|
19 |
create_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
Creation time: |
20 |
update_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
Update time: |
table cart (shopping cart)
serial number |
name |
type of data |
length |
Decimal places |
Allow null values |
primary key |
default value |
illustrate |
1 |
cart_id |
int |
10 |
0 |
N |
Y |
Shopping cart ID: |
|
2 |
title |
varchar |
64 |
0 |
Y |
N |
title: |
|
3 |
img |
varchar |
255 |
0 |
N |
N |
0 |
picture: |
4 |
user_id |
int |
10 |
0 |
N |
N |
0 |
User ID: |
5 |
create_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
Creation time: |
6 |
update_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
Update time: |
7 |
state |
int |
10 |
0 |
N |
N |
0 |
Status: In use, expired |
8 |
price |
double |
9 |
2 |
N |
N |
0.00 |
unit price: |
9 |
price_ago |
double |
9 |
2 |
N |
N |
0.00 |
Original price: |
10 |
price_count |
double |
11 |
2 |
N |
N |
0.00 |
Total price: |
11 |
num |
int |
10 |
0 |
N |
N |
1 |
quantity: |
12 |
goods_id |
mediumint |
8 |
0 |
N |
N |
Product id: [0,8388607] |
|
13 |
type |
varchar |
64 |
0 |
N |
N |
uncategorized |
Categories: |
14 |
description |
varchar |
255 |
0 |
Y |
N |
Description: [0,255] is used for product specification description |
table collect (collection)
serial number |
name |
type of data |
length |
Decimal places |
Allow null values |
primary key |
default value |
illustrate |
1 |
collect_id |
int |
10 |
0 |
N |
Y |
Collection ID: |
|
2 |
user_id |
int |
10 |
0 |
N |
N |
0 |
Collector ID: |
3 |
source_table |
varchar |
255 |
0 |
Y |
N |
Source table: |
|
4 |
source_field |
varchar |
255 |
0 |
Y |
N |
Source field: |
|
5 |
source_id |
int |
10 |
0 |
N |
N |
0 |
Source ID: |
6 |
title |
varchar |
255 |
0 |
Y |
N |
title: |
|
7 |
img |
varchar |
255 |
0 |
Y |
N |
Cover: |
|
8 |
create_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
Creation time: |
9 |
update_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
Update time: |
Table comment (comment)
serial number |
name |
type of data |
length |
Decimal places |
Allow null values |
primary key |
default value |
illustrate |
1 |
comment_id |
int |
10 |
0 |
N |
Y |
Comment ID: |
|
2 |
user_id |
int |
10 |
0 |
N |
N |
0 |
Commenter ID: |
3 |
reply_to_id |
int |
10 |
0 |
N |
N |
0 |
Reply comment ID: empty is 0 |
4 |
content |
longtext |
2147483647 |
0 |
Y |
N |
content: |
|
5 |
nickname |
varchar |
255 |
0 |
Y |
N |
Nick name: |
|
6 |
avatar |
varchar |
255 |
0 |
Y |
N |
Avatar address: [0,255] |
|
7 |
create_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
Creation time: |
8 |
update_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
Update time: |
9 |
source_table |
varchar |
255 |
0 |
Y |
N |
Source table: |
|
10 |
source_field |
varchar |
255 |
0 |
Y |
N |
Source field: |
|
11 |
source_id |
int |
10 |
0 |
N |
N |
0 |
Source ID: |
Table goods (product information)
serial number |
name |
type of data |
length |
Decimal places |
Allow null values |
primary key |
default value |
illustrate |
1 |
goods_id |
mediumint |
8 |
0 |
N |
Y |
Product id: [0,8388607] |
|
2 |
title |
varchar |
125 |
0 |
Y |
N |
Title: [0,125] is used in the <title> tag of products and html |
|
3 |
img |
text |
65535 |
0 |
Y |
N |
Cover image: used to display on the product list page |
|
4 |
description |
varchar |
255 |
0 |
Y |
N |
Description: [0,255] is used for product specification description |
|
5 |
price_ago |
double |
8 |
2 |
N |
N |
0.00 |
原价:[1] |
6 |
price |
double |
8 |
2 |
N |
N |
0.00 |
卖价:[1] |
7 |
sales |
int |
10 |
0 |
N |
N |
0 |
销量:[0,1000000000] |
8 |
inventory |
int |
10 |
0 |
N |
N |
0 |
商品库存 |
9 |
type |
varchar |
64 |
0 |
N |
N |
商品分类: |
|
10 |
hits |
int |
10 |
0 |
N |
N |
0 |
点击量:[0,1000000000]访问这篇产品的人次 |
11 |
content |
longtext |
2147483647 |
0 |
Y |
N |
正文:产品的主体内容 |
|
12 |
img_1 |
text |
65535 |
0 |
Y |
N |
主图1: |
|
13 |
img_2 |
text |
65535 |
0 |
Y |
N |
主图2: |
|
14 |
img_3 |
text |
65535 |
0 |
Y |
N |
主图3: |
|
15 |
img_4 |
text |
65535 |
0 |
Y |
N |
主图4: |
|
16 |
img_5 |
text |
65535 |
0 |
Y |
N |
主图5: |
|
17 |
create_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
创建时间: |
18 |
update_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
更新时间: |
19 |
customize_field |
text |
65535 |
0 |
Y |
N |
自定义字段 |
|
20 |
source_table |
varchar |
255 |
0 |
Y |
N |
来源表: |
|
21 |
source_field |
varchar |
255 |
0 |
Y |
N |
来源字段: |
|
22 |
source_id |
int |
10 |
0 |
N |
N |
0 |
来源ID: |
23 |
user_id |
int |
10 |
0 |
Y |
N |
0 |
添加人 |
表goods_type (商品类型)
编号 |
名称 |
数据类型 |
长度 |
小数位 |
允许空值 |
主键 |
默认值 |
说明 |
1 |
type_id |
int |
10 |
0 |
N |
Y |
商品分类ID: |
|
2 |
father_id |
smallint |
5 |
0 |
N |
N |
0 |
上级分类ID:[0,32767] |
3 |
name |
varchar |
255 |
0 |
Y |
N |
商品名称: |
|
4 |
desc |
varchar |
255 |
0 |
Y |
N |
描述: |
|
5 |
icon |
varchar |
255 |
0 |
Y |
N |
图标: |
|
6 |
source_table |
varchar |
255 |
0 |
Y |
N |
来源表: |
|
7 |
source_field |
varchar |
255 |
0 |
Y |
N |
来源字段: |
|
8 |
create_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
创建时间: |
9 |
update_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
更新时间: |
表hits (用户点击)
编号 |
名称 |
数据类型 |
长度 |
小数位 |
允许空值 |
主键 |
默认值 |
说明 |
1 |
hits_id |
int |
10 |
0 |
N |
Y |
点赞ID: |
|
2 |
user_id |
int |
10 |
0 |
N |
N |
0 |
点赞人: |
3 |
create_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
创建时间: |
4 |
update_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
更新时间: |
5 |
source_table |
varchar |
255 |
0 |
Y |
N |
来源表: |
|
6 |
source_field |
varchar |
255 |
0 |
Y |
N |
来源字段: |
|
7 |
source_id |
int |
10 |
0 |
N |
N |
0 |
来源ID: |
表notice (公告)
编号 |
名称 |
数据类型 |
长度 |
小数位 |
允许空值 |
主键 |
默认值 |
说明 |
1 |
notice_id |
mediumint |
8 |
0 |
N |
Y |
公告id: |
|
2 |
title |
varchar |
125 |
0 |
N |
N |
标题: |
|
3 |
content |
longtext |
2147483647 |
0 |
Y |
N |
正文: |
|
4 |
create_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
创建时间: |
5 |
update_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
更新时间: |
表order (订单)
编号 |
名称 |
数据类型 |
长度 |
小数位 |
允许空值 |
主键 |
默认值 |
说明 |
1 |
order_id |
int |
10 |
0 |
N |
Y |
订单ID: |
|
2 |
order_number |
varchar |
64 |
0 |
Y |
N |
订单号: |
|
3 |
goods_id |
mediumint |
8 |
0 |
N |
N |
商品id:[0,8388607] |
|
4 |
title |
varchar |
32 |
0 |
Y |
N |
商品标题: |
|
5 |
img |
varchar |
255 |
0 |
Y |
N |
商品图片: |
|
6 |
price |
double |
10 |
2 |
N |
N |
0.00 |
价格: |
7 |
price_ago |
double |
10 |
2 |
N |
N |
0.00 |
原价: |
8 |
num |
int |
10 |
0 |
N |
N |
1 |
数量: |
9 |
price_count |
double |
8 |
2 |
N |
N |
0.00 |
总价: |
10 |
norms |
varchar |
255 |
0 |
Y |
N |
规格: |
|
11 |
type |
varchar |
64 |
0 |
N |
N |
未分类 |
商品分类: |
12 |
contact_name |
varchar |
32 |
0 |
Y |
N |
联系人姓名: |
|
13 |
contact_email |
varchar |
125 |
0 |
Y |
N |
联系人邮箱: |
|
14 |
contact_phone |
varchar |
11 |
0 |
Y |
N |
联系人手机: |
|
15 |
contact_address |
varchar |
255 |
0 |
Y |
N |
收件地址: |
|
16 |
postal_code |
varchar |
9 |
0 |
Y |
N |
邮政编码: |
|
17 |
user_id |
int |
10 |
0 |
N |
N |
0 |
买家ID: |
18 |
merchant_id |
mediumint |
8 |
0 |
N |
N |
0 |
商家ID: |
19 |
create_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
创建时间: |
20 |
update_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
更新时间: |
21 |
description |
varchar |
255 |
0 |
Y |
N |
描述:[0,255]用于产品规格描述 |
|
22 |
state |
varchar |
16 |
0 |
N |
N |
待付款 |
订单状态:待付款,待发货,待签收,已签收,待退款,已退款,已拒绝,已完成 |
表pet_information (宠物信息)
编号 |
名称 |
数据类型 |
长度 |
小数位 |
允许空值 |
主键 |
默认值 |
说明 |
1 |
pet_information_id |
int |
10 |
0 |
N |
Y |
宠物信息ID |
|
2 |
pet_name |
varchar |
64 |
0 |
Y |
N |
宠物姓名 |
|
3 |
picture |
varchar |
255 |
0 |
Y |
N |
图片 |
|
4 |
pet_category |
varchar |
64 |
0 |
Y |
N |
宠物种类 |
|
5 |
pet_age |
int |
10 |
0 |
Y |
N |
0 |
宠物年龄 |
6 |
pet_gender |
varchar |
64 |
0 |
Y |
N |
宠物性别 |
|
7 |
vaccine_situation |
varchar |
64 |
0 |
Y |
N |
疫苗情况 |
|
8 |
adoption |
varchar |
64 |
0 |
Y |
N |
领养情况 |
|
9 |
detailed_description |
longtext |
2147483647 |
0 |
Y |
N |
详情描述 |
|
10 |
hits |
int |
10 |
0 |
N |
N |
0 |
点击数 |
11 |
praise_len |
int |
10 |
0 |
N |
N |
0 |
点赞数 |
12 |
recommend |
int |
10 |
0 |
N |
N |
0 |
智能推荐 |
13 |
create_time |
datetime |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
创建时间 |
14 |
update_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
更新时间 |
表praise (点赞)
编号 |
名称 |
数据类型 |
长度 |
小数位 |
允许空值 |
主键 |
默认值 |
说明 |
1 |
praise_id |
int |
10 |
0 |
N |
Y |
点赞ID: |
|
2 |
user_id |
int |
10 |
0 |
N |
N |
0 |
点赞人: |
3 |
create_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
创建时间: |
4 |
update_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
更新时间: |
5 |
source_table |
varchar |
255 |
0 |
Y |
N |
来源表: |
|
6 |
source_field |
varchar |
255 |
0 |
Y |
N |
来源字段: |
|
7 |
source_id |
int |
10 |
0 |
N |
N |
0 |
来源ID: |
8 |
status |
bit |
1 |
0 |
N |
N |
1 |
点赞状态:1为点赞,0已取消 |
表registered_users (注册用户)
编号 |
名称 |
数据类型 |
长度 |
小数位 |
允许空值 |
主键 |
默认值 |
说明 |
1 |
registered_users_id |
int |
10 |
0 |
N |
Y |
注册用户ID |
|
2 |
user_number |
varchar |
64 |
0 |
N |
N |
用户编号 |
|
3 |
full_name |
varchar |
64 |
0 |
Y |
N |
姓名 |
|
4 |
gender |
varchar |
64 |
0 |
Y |
N |
性别 |
|
5 |
examine_state |
varchar |
16 |
0 |
N |
N |
已通过 |
审核状态 |
6 |
recommend |
int |
10 |
0 |
N |
N |
0 |
智能推荐 |
7 |
user_id |
int |
10 |
0 |
N |
N |
0 |
用户ID |
8 |
create_time |
datetime |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
创建时间 |
9 |
update_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
更新时间 |
表shopping_mall (购物商城)
编号 |
名称 |
数据类型 |
长度 |
小数位 |
允许空值 |
主键 |
默认值 |
说明 |
1 |
shopping_mall_id |
int |
10 |
0 |
N |
Y |
购物商城ID |
|
2 |
brand |
varchar |
64 |
0 |
Y |
N |
品牌 |
|
3 |
specifications |
varchar |
64 |
0 |
Y |
N |
规格 |
|
4 |
recommend |
int |
10 |
0 |
N |
N |
0 |
智能推荐 |
5 |
cart_title |
varchar |
125 |
0 |
Y |
N |
标题:[0,125]用于产品html的标签中 |
|
6 |
cart_img |
text |
65535 |
0 |
Y |
N |
封面图:用于显示于产品列表页 |
|
7 |
cart_description |
varchar |
255 |
0 |
Y |
N |
描述:[0,255]用于产品规格描述 |
|
8 |
cart_price_ago |
double |
8 |
2 |
N |
N |
0.00 |
原价:[1] |
9 |
cart_price |
double |
8 |
2 |
N |
N |
0.00 |
卖价:[1] |
10 |
cart_inventory |
int |
10 |
0 |
N |
N |
0 |
商品库存 |
11 |
cart_type |
varchar |
64 |
0 |
N |
N |
未分类 |
商品分类: |
12 |
cart_content |
longtext |
2147483647 |
0 |
Y |
N |
正文:产品的主体内容 |
|
13 |
cart_img_1 |
text |
65535 |
0 |
Y |
N |
主图1: |
|
14 |
cart_img_2 |
text |
65535 |
0 |
Y |
N |
主图2: |
|
15 |
cart_img_3 |
text |
65535 |
0 |
Y |
N |
主图3: |
|
16 |
cart_img_4 |
text |
65535 |
0 |
Y |
N |
主图4: |
|
17 |
cart_img_5 |
text |
65535 |
0 |
Y |
N |
主图5: |
|
18 |
create_time |
datetime |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
创建时间 |
19 |
update_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
更新时间 |
表slides (轮播图)
编号 |
名称 |
数据类型 |
长度 |
小数位 |
允许空值 |
主键 |
默认值 |
说明 |
1 |
slides_id |
int |
10 |
0 |
N |
Y |
轮播图ID: |
|
2 |
title |
varchar |
64 |
0 |
Y |
N |
标题: |
|
3 |
content |
varchar |
255 |
0 |
Y |
N |
内容: |
|
4 |
url |
varchar |
255 |
0 |
Y |
N |
链接: |
|
5 |
img |
varchar |
255 |
0 |
Y |
N |
轮播图: |
|
6 |
hits |
int |
10 |
0 |
N |
N |
0 |
点击量: |
7 |
create_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
创建时间: |
8 |
update_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
更新时间: |
表upload (文件上传)
编号 |
名称 |
数据类型 |
长度 |
小数位 |
允许空值 |
主键 |
默认值 |
说明 |
1 |
upload_id |
int |
10 |
0 |
N |
Y |
上传ID |
|
2 |
name |
varchar |
64 |
0 |
Y |
N |
文件名 |
|
3 |
path |
varchar |
255 |
0 |
Y |
N |
访问路径 |
|
4 |
file |
varchar |
255 |
0 |
Y |
N |
文件路径 |
|
5 |
display |
varchar |
255 |
0 |
Y |
N |
显示顺序 |
|
6 |
father_id |
int |
10 |
0 |
Y |
N |
0 |
父级ID |
7 |
dir |
varchar |
255 |
0 |
Y |
N |
文件夹 |
|
8 |
type |
varchar |
32 |
0 |
Y |
N |
文件类型 |
表user (用户账户:用于保存用户登录信息)
编号 |
名称 |
数据类型 |
长度 |
小数位 |
允许空值 |
主键 |
默认值 |
说明 |
1 |
user_id |
mediumint |
8 |
0 |
N |
Y |
用户ID:[0,8388607]用户获取其他与用户相关的数据 |
|
2 |
state |
smallint |
5 |
0 |
N |
N |
1 |
账户状态:[0,10](1可用|2异常|3已冻结|4已注销) |
3 |
user_group |
varchar |
32 |
0 |
Y |
N |
所在用户组:[0,32767]决定用户身份和权限 |
|
4 |
login_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
上次登录时间: |
5 |
phone |
varchar |
11 |
0 |
Y |
N |
手机号码:[0,11]用户的手机号码,用于找回密码时或登录时 |
|
6 |
phone_state |
smallint |
5 |
0 |
N |
N |
0 |
手机认证:[0,1](0未认证|1审核中|2已认证) |
7 |
username |
varchar |
16 |
0 |
N |
N |
用户名:[0,16]用户登录时所用的账户名称 |
|
8 |
nickname |
varchar |
16 |
0 |
Y |
N |
昵称:[0,16] |
|
9 |
password |
varchar |
64 |
0 |
N |
N |
密码:[0,32]用户登录所需的密码,由6-16位数字或英文组成 |
|
10 |
|
varchar |
64 |
0 |
Y |
N |
邮箱:[0,64]用户的邮箱,用于找回密码时或登录时 |
|
11 |
email_state |
smallint |
5 |
0 |
N |
N |
0 |
邮箱认证:[0,1](0未认证|1审核中|2已认证) |
12 |
avatar |
varchar |
255 |
0 |
Y |
N |
头像地址:[0,255] |
|
13 |
create_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
创建时间: |
表user_group (用户组:用于用户前端身份和鉴权)
编号 |
名称 |
数据类型 |
长度 |
小数位 |
允许空值 |
主键 |
默认值 |
说明 |
1 |
group_id |
mediumint |
8 |
0 |
N |
Y |
用户组ID:[0,8388607] |
|
2 |
display |
smallint |
5 |
0 |
N |
N |
100 |
显示顺序:[0,1000] |
3 |
name |
varchar |
16 |
0 |
N |
N |
名称:[0,16] |
|
4 |
description |
varchar |
255 |
0 |
Y |
N |
描述:[0,255]描述该用户组的特点或权限范围 |
|
5 |
source_table |
varchar |
255 |
0 |
Y |
N |
来源表: |
|
6 |
source_field |
varchar |
255 |
0 |
Y |
N |
来源字段: |
|
7 |
source_id |
int |
10 |
0 |
N |
N |
0 |
来源ID: |
8 |
register |
smallint |
5 |
0 |
Y |
N |
0 |
注册位置: |
9 |
create_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
创建时间: |
10 |
update_time |
timestamp |
19 |
0 |
N |
N |
CURRENT_TIMESTAMP |
更新时间: |
第5章 系统实现
5.1 开发工具
系统中应用的开发工具总结如下表所示。
表5-1开发工具
名称 |
工具 |
版本 |
操作系统 IDE(Integrated Development Environment) |
Windows Eclipse |
7/8/10 2017 |
服务器 |
Tomcat |
9.10.7 |
JDK(Java Development Kit) |
JDK |
Java SE 8.0 (1.8.0) |
数据库 浏览器 界面工具 |
MySQL 谷歌 Photoshop |
5.7 6.0 2016 |
5.2 注册模块
未注册用户在用户注册界面uerRegister.jsp,输入新用户信息,点击注册后,新用户信息由界面传入控制层userAction,调用addUser(user)方法,通过userDAOImp向数据库用户表插入用户信息,由于用户账号是自动生成的,若成功则反馈注册成功,并提示新用户的用户账号;若失败则回到登录界面,并显示登录失败。
注册界面如下所示。
图5-1注册界面
用户注册关键代码如下所示。
/**
* 注册
* @return
*/
@PostMapping("register")
public Map<String, Object> signUp(HttpServletRequest request) throws IOException {
// 查询用户
Map<String, String> query = new HashMap<>();
Map<String,Object> map = service.readBody(request.getReader());
query.put("username",String.valueOf(map.get("username")));
List list = service.selectBaseList(service.select(query, new HashMap<>()));
if (list.size()>0){
return error(30000, "用户已存在");
}
map.put("password",service.encryption(String.valueOf(map.get("password"))));
service.insert(map);
return success(1);
}
public Map<String,Object> readBody(BufferedReader reader){
BufferedReader br = null;
StringBuilder sb = new StringBuilder("");
try{
br = reader;
String str;
while ((str = br.readLine()) != null){
sb.append(str);
}
br.close();
String json = sb.toString();
return JSONObject.parseObject(json, Map.class);
}catch (IOException e){
e.printStackTrace();
}finally{
if (null != br){
try{
br.close();
}catch (IOException e){
e.printStackTrace();
}
}
}
return null;
}
public void insert(Map<String,Object> body){
E entity = JSON.parseObject(JSON.toJSONString(body),eClass);
baseMapper.insert(entity);
log.info("[{}] - 插入操作:{}",entity);
}
5.3 登录模块
用户在首页点击登录,进入用户登录界面uerLogin.jsp,输入用户账号和密码,点击登录,用户账号和密码信息由界面传入控制层userAction,调用userLogin(user)方法,通过userDAOImp向数据库用户表搜索该用户账号与密码,将最终结果反馈到前端。若成功则回到首页;用户成功登录,若失败则回到登录界面,并显示登录失败。
登录界面如下所示。
图5-2登录界面
登录界面关键代码如下所示。
/**
* 登录
* @param data
* @param httpServletRequest
* @return
*/
@PostMapping("login")
public Map<String, Object> login(@RequestBody Map<String, String> data, HttpServletRequest httpServletRequest) {
log.info("[执行登录接口]");
String username = data.get("username");
String email = data.get("email");
String phone = data.get("phone");
String password = data.get("password");
List resultList = null;
Map<String, String> map = new HashMap<>();
if(username != null && "".equals(username) == false){
map.put("username", username);
resultList = service.select(map, new HashMap<>()).getResultList();
}
else if(email != null && "".equals(email) == false){
map.put("email", email);
resultList = service.select(map, new HashMap<>()).getResultList();
}
else if(phone != null && "".equals(phone) == false){
map.put("phone", phone);
resultList = service.select(map, new HashMap<>()).getResultList();
}else{
return error(30000, "账号或密码不能为空");
}
if (resultList == null || password == null) {
return error(30000, "账号或密码不能为空");
}
//判断是否有这个用户
if (resultList.size()<=0){
return error(30000,"用户不存在");
}
User byUsername = (User) resultList.get(0);
Map<String, String> groupMap = new HashMap<>();
groupMap.put("name",byUsername.getUserGroup());
List groupList = userGroupService.select(groupMap, new HashMap<>()).getResultList();
if (groupList.size()<1){
return error(30000,"用户组不存在");
}
UserGroup userGroup = (UserGroup) groupList.get(0);
//查询用户审核状态
if (!StringUtils.isEmpty(userGroup.getSourceTable())){
String sql = "select examine_state from "+ userGroup.getSourceTable() +" WHERE user_id = " + byUsername.getUserId();
String res = String.valueOf(service.runCountSql(sql).getSingleResult());
if (res==null){
return error(30000,"用户不存在");
}
if (!res.equals("已通过")){
return error(30000,"该用户审核未通过");
}
}
//查询用户状态
if (byUsername.getState()!=1){
return error(30000,"用户非可用状态,不能登录");
}
String md5password = service.encryption(password);
if (byUsername.getPassword().equals(md5password)) {
// 存储Token到数据库
AccessToken accessToken = new AccessToken();
accessToken.setToken(UUID.randomUUID().toString().replaceAll("-", ""));
accessToken.setUser_id(byUsername.getUserId());
tokenService.save(accessToken);
// 返回用户信息
JSONObject user = JSONObject.parseObject(JSONObject.toJSONString(byUsername));
user.put("token", accessToken.getToken());
JSONObject ret = new JSONObject();
ret.put("obj",user);
return success(ret);
} else {
return error(30000, "账号或密码不正确");
}
}
5.4 用户模块
5.4.1 个人资料模块
登录用户在首页点击进入用户中心userCenter.jsp,再点击修改个人信息按钮进入userChangeInfo.jsp界面,系统根据session中存储的目前登录的用户的账号,向控制层userAction发送请求,搜索当前用户信息,userAction向userDAOImp调用queryByUserId(user),向数据库的用户表搜索当前用户信息并将用户信息以对象的形式层层返回到userChangeInfo.jsp界面,显示出当前用户的个人信息。
若用户要对个人信息进行修改,则通过修改当前信息之后点击确认,向控制层userAction发送更改后的用户信息,调用changeUser(user)方法,通过userDAOImp向数据库用户表更新用户信息,若成功则反馈注册成功,则返回的userChangeInfo.jsp界面被更改成功;若失败则显示修改失败。
5.4.2 宠物资讯模块
用户在登录状态下浏览宠物资讯时,点击加入宠物资讯信息后前台发起请求,将对应的宠物shuliang、id参数信息从前台传递GoumaiController类里,匹配到add()方法,add()方法调用GoumaiServiceImpl类的add()方法。
宠物资讯界面如下所示。
图5-3宠物资讯界面
5.4.3 购物商城模块
用户在登录状态下点击购物商城页面可将进行购物,通过筛选、排序等操作进行查看。
购物商城界面如下所示。
图5-4购物商城界面
5.4.4 地址管理模块
用户在登录状态下点击地址管理页面通过查看收货人、手机号等信息进行修改等操作。
修改收货地址界面如下所示。
图5-5修改收货地址界面
5.4.5 订单管理模块
用户在登录状态下点击订单管理页面可通过订单状态、排序等操作进行查看我的订单。
订单管理界面如下所示。
图5-6订单管理界面
5.4.6 宠物信息模块
用户在登录状态下点击宠物信息页面可通过关键字搜索、排序、宠物性别等操作进行查看宠物信息。
宠物信息界面如下所示。
图5-7宠物信息界面
5.4.7 领养反馈模块
用户在登录状态下点击领养反馈页面可通过填写标题、姓名、用户编号、反馈时间、反馈详情来发布领养反馈信息。
填写领养反馈界面如下所示。
图5-8填写领养反馈界面
5.5 管理员模块
5.5.1 网站管理模块
管理员在登录状态下点击网站管理页面通过查看轮播图、公告消息进行相应的操作。
公告消息管理界面图如下所示。
图5-9公告栏管理界面
5.5.2 人员管理模块
人员管理,管理员在此页面可以查看用户名、用户编号、姓名、性别等信息,并可根据需要进行删除、添加等操作
人员管理界面如下所示。
图5-10人员管理界面
5.5.3 内容管理模块
宠物资讯,管理员在此页面可以通过标题、封面图、标签等查看宠物信息,进行重置、删除、添加、查看评论等操作。
宠物资讯界面如下图所示。
图5-11宠物资讯界面
5.5.4 购物管理模块
订单列表,在此页面可以查看商品名称、订单号、商品图片、价格、订单状态等信息,进行查询、重置、删除等操作。
订单列表界面如下图所示。
图5-12订单列表界面图
5.5.5 模块管理
宠物信息,在此页面可以查看宠物姓名、图片、宠物种类、宠物年龄、领养情况等信息,进行查询、重置、删除、添加等操作。
宠物信息界面如下图所示。
图5-13宠物信息界面图
宠物信息的添加界面如下图所示。
图5-14宠物信息添加界面图
领养反馈,在此页面可以查看标题、用户编号、姓名、反馈时间、反馈详情等信息,进行查询、重置、删除、添加等操作。
领养反馈界面如下图所示。
图5-15领养反馈界面图
5.5.6 个人管理模块
管理员选择个人管理的修改本人密码。通过密码框输入现密码和2次新密码,如果现密码错误,则提示修改失败。如果2次新密码不一致,则提示修改失败。都没问题的话,系统提示修改成功,并返回登录界面。
第6章 系统测试
6.1 测试概述
软件测试是软件开发完成后必须经过的一道程序,它在软件开发过程中地位十分重要,需要由专业的测试工程师来对软件进行各方面的测试,大到功能模块测试,小到代码的单元测试,这对测试工程师来说需要有足够的耐心和专业的测试方案,软件测试归根结底就是对软件的结构和功能的综合测评,需要做到结构稳定和功能正确,二者兼顾。软件测试也叫寻找系统bug的过程,世界上没有完美无缺、不存在bug的软件,只能将软件的bug降到最低最小,来追求极致。
6.2 测试过程
6.2.1 登录测试
登录测试是系统最开始就要进行,测试用户能否登录,才能完成后续的功能操作。
登录测试用例表如下所示。
表6-1登录测试
用例编号 |
YL001 |
程序版本 |
1.00 |
功能名称 |
使用者登录测试 |
编制人 |
李铁蛋 |
功能描述 |
根据用户的登录情况测试 |
||
用例目的 |
测试用户登录情况是否正确 |
||
测试项 |
测试数据 |
测试结果 |
预期结果 |
用户名 |
为空 |
请输入用户名 |
请输入用户名 |
密码 |
为空 |
请输入密码 |
请输入密码 |
用户密码组合 |
用户名:klouse 密码 klouses |
用户与密码不匹配 |
用户与密码不匹配 |
用户密码组合 |
用户名 : klouse 密码 klouse |
进入系统 |
正确的用户名和密码 登录系统 |
6.2.2 信息录入测试
管理员在发布信息页面,通过按照预先格式发布信息,如果因为输入时候缺少相关内容,就不能发布成功,且有相应错误提示
信息录入发布测试用例表如下所示。
表6-1信息录入发布测试
用例编号 |
YL002 |
程序版本 |
1.00 |
功能名称 |
信息发布测试 |
编制人 |
李铁蛋 |
功能描述 |
对使用者发布或者录入信息进行测试,判断其功能是否达到预期的要求 |
||
用例目的 |
对系统使用者录入发布信息进行原型测试。 |
||
测试项 |
测试数据 |
测试结果 |
预期结果 |
属性1 |
为空 |
请输入属性1对应的数据 |
请输入属性1对应的数据 |
属性2 |
为空 |
请输入属性2对应的数据 |
请输入属性2对应的数据 |
属性3 |
为空 |
请输入属性3对应的数据 |
请输入属性3对应的数据 |
全部输入 |
数据均填入 |
录入发布成功 |
录入发布成功 |
6.2.3 信息更新测试
管理员在更新信息页面,通过按照预先格式更新信息,如果因为输入时候缺少相关内容或者更新的数据不符合当前规范的话,就不能更新成功,且有相应错误提示
信息更新测试用例表如下所示。
表6-1信息更新测试
用例编号 |
YL003 |
程序版本 |
1.00 |
功能名称 |
信息更新测试 |
编制人 |
李铁蛋 |
功能描述 |
对使用者更新信息进行测试,判断其功能是否达到预期的要求 |
||
用例目的 |
对系统使用者更新信息进行原型测试。 |
||
测试项 |
测试数据 |
测试结果 |
预期结果 |
属性1 |
编号:321 |
编号更新成功 |
编号更新成功 |
属性2 |
名称:名称1 |
名称更新成功 |
名称更新成功 |
属性3 |
内容:内容1234内容 |
内容更新成功 |
内容更新成功 |
全部输入 |
数据均未更改 |
更新成功 |
更新成功 |
6.2.4 信息删除测试
管理员在信息页面,通过点击数据删除按钮来删除该条数据,如果该数据和其他数据有关联,则提示是否确定删除。
信息删除测试用例表如下所示。
表6-1信息删除测试
用例编号 |
YL004 |
程序版本 |
1.00 |
功能名称 |
信息删除测试 |
编制人 |
李铁蛋 |
功能描述 |
对使用者删除信息进行测试,判断其功能是否达到预期的要求 |
||
用例目的 |
对系统使用者删除信息进行原型测试。 |
||
测试项 |
测试数据 |
测试结果 |
预期结果 |
数据1 |
无任何关联的数据1 |
数据删除成功 |
数据删除成功 |
数据2 |
和其他数据有关联的数据2 |
请确认是否删除 |
请确认是否删除 |
6.3 测试结果
在经过之前的所有的工作之后,通过对软件的测试方法、测试原则还有典型的测试用例进行全面的、深入的介绍。经过对系统的全面测试,系统目前所具有的所有功能均成功的实现并且通过了测试,整个系统实现了基于 Java 开发的期望。
第7章 总结与展望
7.1 总结
宠物领养系统采用SSM框架开发,该系统非常完美的集优点于一身,成熟、强大、易理解易使用,通过使用这个结构,降低了开发的难度。本系统实现了基于SSM的宠物领养系统,将数据操作维护的过程转化成电脑操作流程,具体实现了对系统人员管理、宠物信息数据维护、领养反馈数据维护,并提供查询统计功能来对宠物领养系统的相关数据进行统计分析,让使用者能更清晰的掌握运营情况,帮助使用者进行数据操作维护,简化工作流程,提高工作效率和盈利。
7.2 展望
目前完成的宠物领养系统,还有许多有待改进的地方。一个是功能上的改进,用户理应可以修改自己的相关信息,故应增设个人中心功能;另外,系统如果能提供更多的功能就会使得系统更加丰富和多样化,比如数据当前分析和未来预测等。第二个是技术上的改进,由于对开发框架不太熟悉,权限管理这部分,本系统采用一个Java页面来规定好导航栏,即跳转的页面,这相对比较不灵活,如果将URL路径记录到数据库并实现增删查改会比较好;另外就是对EasyUI的使用还不够熟练,视觉效果和界面观感有待提升,希望日后能对这个系统有所改进。
参考文献
[1]李亚君. 基于SSM框架的B2C电子商城系统的设计与实现[D].合肥工业大学,2022.
[2]焦宇,李民,王欢,余开朝. 基于MySQL性能调优的推荐系统优化设计[J]. 软件导刊,2022,21(09):108-112.
[3]欧阳桂秀. 基于Java和MySQL的数据库管理系统的设计与实现[J]. 信息记录材料,2022,23(09):240-242.
[4]杨卓凡. 基于MySQL不同存储引擎下数据存储效率研究[J]. 电脑知识与技术,2022,18(21):18-20.
[5]王景. 基于MySQL的数据库查询性能优化技术研究[J]. 电脑与电信,2022,(06):90-93.
[6]He Xinbin,Bai Yongbin,Yue Lisen,Wang Haixiao,Liu Yi. Design and Implementation of Information System Based on Java Technology Platform[J]. Journal of Physics: Conference Series,2021,2033(1).
[7]金馨. 基于SSM的宠物店线上运营系统的设计与实现[D].首都经济贸易大学,2021.
[8]周粉妹,吴仁平,钱荣华,陈思. 基于SSM的宠物领养网站设计[J]. 扬州职业大学学报,2021,25(01):32-35.
[9]李艳杰. MySQL数据库下存储过程的设计与应用[J]. 信息技术与信息化,2021,(01):96-97.
[10]王亚文,赵翠. 基于SSM框架的社区宠物信息管理系统设计与分析[J]. 电脑编程技巧与维护,2021,(01):103-105.
[11]吴文洋,刘世宇. 基于B/S架构宠物领养管理系统设计[J]. 软件,2020,41(11):85-87.
[12]. Design and Implementation of ERP System Based on SSM Framework[J]. ,2020,440(5).
[13]. Design and Implementation of Loan Management System using ISI Server, PhP and MySql[J]. International Journal of Recent Technology and Engineering,2019,8(4).
[14]Ping Wanxin,Chen Yuankun,Hou Xiaoyan. Design of Campus Bicycle Rental Management System Based on SSM Framework[J]. Journal of Physics: Conference Series,2019,1314.
[15]Wu Jihong,Wang Junmei,Shi Dongling. Design and Research of University International Cooperation Office Platform Based on SSM Framework[A]. Jilin Province Science and Technology (S&T) Innovation Center for Physical Simulation and Security of Water Resources and Electric Power Engineering、The Cooperative Innovation Center of Wind Power Equipment and Energy Conversion, Hunan Institute of Engineering、St. John’s University、Hunan Internet of Things Association.Proceedings of 2019 International Conference on Virtual Reality and Intelligent Systems (ICVRIS 2019) Volume I[C].Jilin Province Science and Technology (S&T) Innovation Center for Physical Simulation and Security of Water Resources and Electric Power Engineering、The Cooperative Innovation Center of Wind Power Equipment and Energy Conversion, Hunan Institute of Engineering、St. John’s University、Hunan Internet of Things Association:第三届数字制造与自动化国际会议(ICDMA2012会务组),2019:229-232.
[16]Yun Quan. Design and Implementation of E-commerce Platform based on Vue.js and MySQL[A]. Wuhan Zhicheng Times Cultural Development Co., Ltd..Proceedings of the 3rd International Conference on Computer Engineering, Information Science & Application Technology(ICCIA 2019)[C].Wuhan Zhicheng Times Cultural Development Co., Ltd.: Wuhan Zhicheng Times Cultural Development Co., Ltd., 2019: 460-465.
[17] Yang Hua. Design and implementation of pet shop information system based on SSM [D]. Jilin University, 2019.
[18]Di Lu,Yuping Qiu,Chun Qian,Xi Wang,Wei Tan. Design of Campus Resource Sharing Platform based on SSM Framework[J]. IOP Conference Series: Materials Science and Engineering,2019,490(6).
[19]Evaristus Didik Madyatmadja,Chelsea Adora. Designing and Using a MySQL Database for Human Resource Management[J]. Advances in Science Technology and Engineering Systems Journal,2019,4(6).
[20]Di Lu, Yuping Qiu, Chun Qian, Xi Wang, Wei Tan. Design of Campus Resource Sharing Platform based on SSM Framework[A]. Bosi Academic Exchange Center. Proceedings of the 2nd International Seminar on Computational Intelligence, Engineering and Technology (SCIET2018) [C]. Bosi Academic Exchange Center: Shanghai Xiaoyu Cultural Communication Co., Ltd., 2018: 477-482.
Acknowledgments
With the guidance and help of my teacher, I completed this thesis. The teacher had very strict requirements on the content and format of the paper. During the process of writing my graduation thesis, he gave me many suggestions and checked regularly. He has strict requirements on us and helps us write documents to the extreme and correctness. His attitude towards teaching and work makes me have infinite admiration and respect for him. While writing my graduation thesis, as a fresh graduate, I was also busy looking for a job. I encountered many choices. When I felt confused and confused, the teacher gave me a lot of advice. Thanks to the teacher for her patient guidance. I understood a lot through chatting with her. .
I would also like to thank my parents, who have always supported and believed in me and given me a lot of strength mentally and financially. Now that I will graduate and embark on the road to work, I can finally repay my parents for their upbringing and guidance. And all the teachers and classmates during my college years. When I encountered problems, these teachers and classmates always helped me selflessly. I am really grateful. I will work hard to grow into a useful person.