It’s class notes

Time:2021-1-18

1 do the basic page, first import the data, there are related dependencies, 8.
1.1 change the configuration file first
It's class notes
It's class notesIt's class notesIt's class notes
2.1 create a control class to manage all page requests
It's class notes
You can start the test. Let’s see if the basic page is completed.
It's class notes
This is the interface that should be queried, and the next idea. Log management is a DOM element.
The next step is technology.
It's class notes
Click start asynchronous request.
Operation: 1 starter.html Register events.
First, get the log management ID (load log ID), that is, open it in the F12 interface. Click the register function on this button. In the next sentence, the load function in jQuery sends the Ajax function to the server and directly updates the function loaded from the URL to the specified part, as shown in the red dot in the figure.
It's class notes
Corresponding write function, the following error, write less and arrow
It's class notes
Then, which part of the URL is added, and which part to load to the specified location.
It's class notes
I want to put this page in templates for processing, so I put it there.
This directory can’t be accessed directly, so you need to configure a controller.
This is a page request. All page requests are in pagecontroller.
Operation:It's class notes
Corresponding to the road strength we hope to reach. You can start the test.
It's class notes
When the log list page is loaded, it is log list. I also hope that after the log page J is loaded, the paging page will be displayed here, and the page will be partially refreshed and Ajax. Go back to pagecontroller and add a return methodIt's class notesThis is the server side. Next, you need to log list on the client side.
There is an area in the log list page to store paging elementsIt's class notes
Because other places need to use, so write a function to take out.It's class notes
So that all can get the paging page, loaded into the dopage UI. As part of the whole, you can use $
Optimized version of writing, JS load, in order to achieve this function.It's class notes
Operation: you can
starter.html Common extraction, because, are loaded with different module ID, daily log management, menu management, so you can extract common, the second code.
It's class notes
In addition, just change the brackets. You can choose a target based on ID, or you can choose a class selector after class. You can take one or two! If you don’t understand, go to F12 and write
bc2735d75c10d802a8988254dad339d.png
The ID is the same as the load log ID aboveIt's class notes
Follow the sequence diagram.
It's class notes
The following is the same way
It's class notes
Next step!
It's class notes
Design principle:
Start writing from the data layer and store it in a POJO. Go through the list instead of taking out all the records by page. Because it is impossible to display all the records, you have to calculate paging. Then you need to take out the total number of records before paging. @Repository is an adjective class, representing POJO in the data layer. The data layer needs to return to the business layer interface. Calculation is involved in the business layer. Given a total number of records, the total number of pages can be calculated. In the business layer, the list set and row count data are received, so they need to be encapsulated (map can also be used). The list is passed to the business layer. On the interface side, the business layer also needs to encapsulate the data when it returns to the control layer. Because there is still wrong data, whether it is normal or wrong, it also needs to be encapsulated. Let the client need to identify, add a status code.
The current page is changed based on the click event, such as the first page, previous page, next page, and last page. The total number of records is the total number of records in the database. The total number of pages is calculated according to the total number of records, not by query.
Operation: 1 encapsulate the data returned from the database! All encapsulate the serialization interface to convert the object into bytes for convenient storage or transmissiond0e6b84ae02b99ae079d1d0f655fb05.png
2 interface
It's class notes
This needs to be found out
It's class notes
A row of records maps an object. The design of parameters should have its name, starting position, where to start, and write according to the design.
3 Create mapping file
It's class notes
All select must have a resulttype, which means mapping a record on a line
If the name matches the record, just record it.
Where does limit start? How many.
Order by descendingIt's class notes
We can extract commonalities,It's class notesIt can be tested.
Create test classIt's class notes
Take out the records of admission, starting from 0, take 3
It's class notesg](/img/bVbOIk1)
The data layer ends and the business layer begins.
Operation: write query method in interface. Parameter and return value
It's class notesWhat values will the client pass, such as the current page number and user name. If you don’t know what the return value is, use object.
This return value encapsulates the data returned by the data layer and the page number value after calculation, so you can create an object and create a class (solve the value to be returned). If the return value is large. If the int value is not satisfied, you can change it to long.It's class notes
Records the current page record. Psgecount total number of pages, rowcount total number of records, need to calculate the total number of pages, also need to show how many records per page PageSize. Will also display the current page value.It's class notes
Optimization: other modules can also be used except log module!
1599985608(1).png
Become a generic classIt's class notes
T is a variable! You can write more than one in the future
The corresponding one should also be changed. The returned value is syslog, which is a paging object encapsulating the query and calculation results
1599989507(1).png
Continue: create impl implementation class
It's class notes
StartIndex: the number of start pages, pagecurrent: the number of current pages, PageSize: the number of records on a page. Then you need to encapsulate the data, so create the object. Calculate the total number of pages through the algorithm, divide the total number of records by the number of displays per page.It's class notes
Po is returned.
If the result is 0, there is no need to execute the following procedure, so. User name can be null, while pagecurrent cannot be null! This exception is not a check exception
1599990933.png
This will not report an error until runtime, so create a class to inherit runtimeException, and also serialize to solve the exceptionIt's class notes
Constructors can be generated by parent classIt's class notes
If you don’t know, it’s all generated.It's class notes
To simplify the process, set the constructor with and without parameters in pageobject, @ noargsconstructor is the construction without parameters. Because this other page number can also be used, it is best in public.
It's class notes
To calculate in the construction method means to put the calculation part in the publicIt's class notes
Continue testing class testingIt's class notes
The business layer gives the data to the control layer, and the data is right and wrong.
It's class notes
Traditional writing, in order to add a state to the data, add a class response to the control side.It's class notesEncapsulation calls are simple.
After that, you can change the return value to jsonresult
It's class notes
Advanced, do not do the repetitive work of try and catch, handle abnormal web packages, add special tags
It's class notes
。。。
It's class notes
test methodIt's class notes
Presentation of client
Where do I need to present dataIt's class notes
After loading the page, you still want to add the function in the original position.
In log_ List page in!
It's class notesIt's class notesIt's class notesIt's class notesIt's class notes72cf8cb13239706a0d086c69006f1c6.png
On the configuration page, page.html File write public, through the class selector to obtain data.It's class notes
Then there’s event handling.

Recommended Today

Python series crawlers monitor bitcoin price trend

preface Use Python to monitor and save bitcoin price information. development tool Python version: 3.6.4 Related modules: Requests module; Matplotlib module; Openpyxl module; Numpy module; And some modules that come with Python. Environment construction Install Python and add it to the environment variable. PIP can install the required modules. Main ideas Google can create an […]