Review Notes - Management System Development (4) Creating Projects

1. Write in front

When many people do this step, they will feel that it is the stage of writing code, but it is not. In the whole development process, the proportion of code writing is actually very small. We should first design the whole system, model the system we want to do, design the functions we need, connect them, and then go one step further. Step by step to develop the code.
If you are like me and haven't thought about what kind of system you want to make, then simply determine the general functions of the system, such as login and registration. Of course, this depends on the system. If it is a system that manages important information, don't arrange the registration function.
Now that there are users, there must be a user management module. It is best to add the menu bar to the management, so that the menu bar is dynamically loaded. In addition, you can add role modules. Different roles affect all aspects of the system. Seeing or managing is different, which makes it more convenient for the operating system.

2. Design database

After roughly setting the direction, you can design the database. It is best to build a database for the writing system first, and design each table according to the structure of your system. Instead of designing all the tables at the beginning, you can design the required tables first, and you can add and modify tables in the later stage of system development.
Here, I have some opinions of my own. At work, because the system uses Hibernate, many foreign key associations in entity classes are all entity classes. Yes, otherwise it is not recommended that you do so. There is a relationship between the two tables. In fact, the id field of the table can be used as a foreign key association. I prefer to do this. No matter what the query is, just take out the id value and look it up in the table, or directly use the id as a condition. , Multi-table joint query, the system will not be redundant due to querying too many fields, and it will not be dizzy due to various twists and turns.
In the development at work, the database design is basically designed in advance, and the fields, etc. are all designed by special personnel. If your company does not have it, you basically have to do it yourself, but there will definitely be a project manager to tell you. You can design the data table according to your needs, but in the process of learning, it is like making a graduation project by yourself. When you don’t know what your data table needs to be designed, you can first put the important Write the fields first. For example,
in the system you are doing now, you don’t know how to design your own data table, so you can think about it one by one. First of all, since it is a system, there must be a login and a login. There must be users, so what attributes do users have? First of all, the account password is required, and the id field that must be self-increasing in each table is indispensable. This is the primary key of the data table, and then it is to determine whether it is the main table or not. The user will have permissions to access the system, such as which menus It can see, which pages it cannot see, and which pages he can only read but cannot write. These are permissions. These permissions are generally added to roles, and generally user-related roles, so there must be the id field of the role table. In this way, a table is created.
The following are a few tables I created. The type of the field is determined by myself. If it is a string type, use the varchar type. If it is a pure number, use the int, eight basic data types, depending on the situation:
User table :
insert image description here
Role table:
insert image description here
Permission table:
insert image description here
Form table:
insert image description here

At this point, the design of the data table is completed, and then the development of the code can be carried out.

3. System development

Before writing the code, it is recommended that you go to the Internet to find a front-end framework developed by others, which is the beautiful system you usually see. Many people on the Internet share various beautiful static pages. If you have this strength, you can Design by yourself, but a good-looking front-end web page takes a lot of time to develop, and various css and js files. If you are not a professional front-end development engineer, it is difficult to make a good-looking interface. If it is a graduation design, it is still good-looking. Click.
After the downloaded front-end interface is decompressed, it is basically a file with html suffix, js folder, image folder, css folder, directly copy the whole to the webApp folder, it is best to create a folder, put this folder in the new folder Under the folder, manage your own code files so that others can read them more comfortably.
insert image description here
Next, you can create an entity class under your entity class folder. You can name it yourself. It is best to name it with entity or pojo, as follows:
insert image description here
Take the user table as an example to explain:

package admin.pojo;

/**
 * @author Fan
 */
public class User {
    
    

    private int userId;

    private String userName;

    private String userPwd;

    private String userJobNo;

    private int roleId;

    public int getUserId() {
    
    
        return userId;
    }

    public void setUserId(int userId) {
    
    
        this.userId = userId;
    }

    public String getUserName() {
    
    
        return userName;
    }

    public void setUserName(String userName) {
    
    
        this.userName = userName;
    }

    public String getUserPwd() {
    
    
        return userPwd;
    }

    public void setUserPwd(String userPwd) {
    
    
        this.userPwd = userPwd;
    }

    public String getUserJobNo() {
    
    
        return userJobNo;
    }

    public void setUserJobNo(String userJobNo) {
    
    
        this.userJobNo = userJobNo;
    }

    public int getRoleId() {
    
    
        return roleId;
    }

    public void setRoleId(int roleId) {
    
    
        this.roleId = roleId;
    }

    @Override
    public String toString() {
    
    
        return "User{" +
                "userId=" + userId +
                ", userName='" + userName + '\'' +
                ", userPwd='" + userPwd + '\'' +
                ", userJobNo='" + userJobNo + '\'' +
                ", roleId=" + roleId +
                '}';
    }
}

I don't know what your java foundation is. I will try to be as detailed as possible here. The structure of the java file is the access modifier class class name curly brackets. The curly brackets contain variables and methods; there are
generally four access modifiers . (public, private, protected, default), is the access rights of the entire class, the specific rules are as follows:

Scope of application <The smaller the scope of access rights, the higher the security>

  • access rights class package subclass other
  • public ∨ ∨ ∨ ∨ (available to anyone)
  • protect ∨ ∨ ∨ × (inherited classes can access and have the same permissions as private)
    default ∨ ∨ × × (package access rights, that is, can be accessed in the entire package)
    private ∨ × × × (except for the type creator and type Elements that cannot be accessed by anyone outside of the inner methods)

Here, first use private to modify the variable, which is the attribute of the user, to privatize the user attribute, so that other classes cannot access the attribute, and then use the get and set methods to give the attribute read and write permissions, so that the class can be called by calling The user's attributes are assigned or valued. As for the toString method, this is just a convenient way to print out the attributes of the entire class, optional.
Between the access modifier and the variable is the data type, and the eight data types can be Baidu.
The preparation before writing the code is completed here. What we need to do later is to modify the html page into a jsp file, write the code of the background control layer, service layer and dao layer to complete the login function.
The effect diagram after completion is as follows:
This is the initial interface I made, because what I want to do is a system that integrates portal and management, so the initial page accessed after the system starts should be the home page of the portal website. When clicking the management system , then jump to the background login system.
insert image description here

This is the background login system. After successful login, you will enter the homepage of the background management system.

insert image description here

This interface has not been transformed yet, here is the interface of the background management system.
insert image description here

These interfaces are all the front-end pages made by others that I have searched on the Internet. Since there are ready-made ones, don't do it yourself. The front-end pages have a very large amount of code, but if you are interested, you can still try to do it yourself. written.

Guess you like

Origin blog.csdn.net/fzt12138/article/details/118379682