Page view rendering method and device

By adding static annotations on the class and field, self-description and direct reuse of the page view are achieved, solving the problems of complex configuration and difficult to maintain in the prior art, and improving the flexibility and scalability of the system.

CN117742704BActive Publication Date: 2025-03-18QIAN JIN NETWORK INFORMATION TECH SHANGHAI LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311550057.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-20
Publication Date
2025-03-18
Estimated Expiration
2043-11-20

AI Technical Summary

Technical Problem

When the front-end page display view updates, the prior art needs to be configured through tedious script writing, which leads to developers need to understand the data storage structure and rewrite scripts when modifying, which lacks accumulation and is difficult to improve maintainability and reusability.

Method used

By adding static annotations on the class and field, self-description of configuration information is realized, so that configuration information is visually displayed in the source code, reducing the need for scripting, improving readability and maintainability, and allowing direct reuse of existing code by adding annotations.

Benefits of technology

It improves the readability and maintainability of the page view, reduces the workload of configuration information, realizes self-description and direct reuse of configuration information, and enhances the flexibility and scalability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117742704B_ABST
    Figure CN117742704B_ABST
Patent Text Reader

Abstract

The present invention discloses a rendering method and device for a page view, the method comprising: configuring information of a data source and a data source column; wherein the data source comprises a plurality of data source columns; configuring information of a view and a view column; wherein the view comprises a plurality of view columns, and each view comprises a unique name or identifier; binding a specified data source to a current view to obtain configuration data of the current view, so as to enable the current view to obtain data from one or more specified data sources, and correspondingly, the view columns in the current view obtain data from the data source columns in the specified data sources; parsing the configuration data of the current view, and writing and storing the parsed configuration data of the current view; receiving a request parameter of the current view to be configured sent by a front end to obtain the configuration data of the current view to be configured; wherein the request parameter comprises the name or identifier of the current view to be configured; and sending the configuration data of the current view to be configured to the front end to render the page view.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of computers and the Internet, and in particular to a method and device for rendering a page view. Background Art

[0002] When updating the front-end page display view, a common implementation is to write the page display view configuration data into the database, and then read and parse it from the database of the back-end server into the data structure required for runtime. Usually, the page display view needs to be configured through cumbersome scripting. Developers need to understand the data storage structure. When modifying the existing front-end page display view, they usually need to rewrite the script and cannot use the existing configuration data. This work is not cumulative. Summary of the invention

[0003] The purpose of this application is to provide a page view rendering method and device thereof, which realizes self-description of configuration information by adding static annotations to classes and fields. The configuration information is intuitively displayed in the source code, which greatly improves readability. When making modifications, the existing configuration code can be modified where necessary without writing scripts from scratch or repeatedly, which improves maintainability. Existing code can be directly reused by adding annotations to reduce configuration information work.

[0004] An embodiment of the present application provides a method for rendering a page view, wherein the page view is set as a list displayed on a front-end page, and the method includes: configuring information of a data source and a data source column; wherein the data source includes a plurality of data source columns; configuring information of a view and a view column; wherein the view includes a plurality of view columns, and each view includes a unique name or identifier; binding a specified data source to a current view to obtain configuration data of the current view, so as to enable the current view to obtain data from one or more specified data sources, and correspondingly, the view columns in the current view obtain data from the data source columns in the specified data sources; parsing the configuration data of the current view, and writing and storing the parsed configuration data of the current view; receiving a request parameter of the current view to be configured sent by the front end to obtain the configuration data of the current view to be configured; wherein the request parameter includes the name or identifier of the current view to be configured; and sending the configuration data of the current view to be configured to the front end to render the page view.

[0005] Further, the information for configuring the data source includes defining one or more of the following elements: the name of the data source, the database and the data table; and / or, the information for configuring the data source column includes defining one or more of the following elements: the data source column identifier, the fully qualified name of the database table field, the query expression and the formatting string; and / or, the information for configuring the view includes defining one or more of the following elements: the name or identifier of the view, the display name, the sorting rule, whether to lock the table header when displaying, the number of fixed columns on the left when displaying, the number of fixed columns on the right when displaying and the dynamic annotation; and / or, the information for configuring the view column includes defining one or more of the following elements: the identifier of the view column, the display position order when displaying, the display name, the bound data source, the bound data source column, the query expression, whether it is visible when displaying, whether it is exportable, whether it is sortable, the horizontal alignment style when displaying, the vertical alignment style when displaying, the column width when displaying, the formatting style when displaying, the formatting style when exporting and whether to display summary data when displaying.

[0006] Further, a class is configured as a data source by adding a first annotation on the class class; and / or, a class is configured as a data source column by adding a second annotation on a class member field; and / or, a class is configured as a view by adding a third annotation on the class; and / or, a class is configured as a view column by adding a fourth annotation on the field.

[0007] Furthermore, the binding of the specified data source to the current view to obtain configuration data of the current view so as to enable the current view to obtain data from one or more specified data sources, and correspondingly the view columns in the current view to obtain data from the data source columns in the specified data sources, includes: adding a fifth annotation on the class to define one or more of the following elements: the name of the specified data source to be bound; the associated fields on the main result set when the data of the specified data source is associated with the main result set; the associated fields on the specified data source when the data of the specified data source is associated with the main result set; and the default query condition of the specified data source in the current view.

[0008] Furthermore, after the specified data source is bound to the current view to obtain the configuration data of the current view so as to enable the current view to obtain data from one or more specified data sources and the view column in the current view correspondingly obtains data from the data source column in the specified data source, it also includes: adding a sixth annotation to the field configured as the view column to configure translation information for a view column; wherein the configuration translation information is set to convert the code field into text when the stored data is a code field; the configuration translation information for a view column specifically includes: obtaining the original code field; obtaining the target data source required to provide the translation data according to the set query conditions; matching the text field of the target data source with the original code field; if they match, updating the text field of the target data source to the current view column or other specified view columns.

[0009] Furthermore, after the specified data source is bound to the current view to obtain the configuration data of the current view so as to enable the current view to obtain data from one or more specified data sources, and the view columns in the current view correspondingly obtain data from the data source columns in the specified data sources, it also includes: configuring data permission control for the current view by adding the seventh annotation to the class configured as the view; and / or, after parsing the configuration data of the current view from the source code at runtime, dynamically generating interface code for each view using dynamic bytecode technology, and adding permission annotations to the interface code according to the configuration eighth annotation to implement permission control of the interface code.

[0010] Furthermore, the configuration data of the current view is parsed, and the parsed configuration data of the current view is written and stored, including: scanning all target classes having the first annotation or the third annotation to obtain annotation information of each target class and class members contained in the target class; extracting the configuration information of the data source and the configuration information of the view according to the annotation information of the target class and the class members contained in the target class; adding a current program identifier; wherein the current program is set to be a program that defines the configuration information of the current view.

[0011] Furthermore, the request parameters also include dynamic demand information during display; the method also includes: when receiving a data query request sent by the front end, extracting the configuration data of the current view to be configured according to the name or identifier of the current view to be configured, and querying the data source bound to the current view according to the dynamic demand information during display, and binding the queried data from the data source column to the corresponding view column, generating a corresponding data list, and sending it to the front end to display the data list.

[0012] Furthermore, after receiving the request parameters for configuring the current view sent by the front end to obtain the configuration data of the current view, it also includes: verifying the configuration data of the current view to send an error message and / or a warning message; wherein the error message is sent if at least one of the following situations exists: the current view is not configured with a primary data source; the secondary data source is not configured with an associated data source column; the bound data source column does not exist; the view does not have at least one visible view column; and when verifying the identifier of the view column, the identifier of the view column is not unique.

[0013] The embodiment of the present application provides a rendering device for a page view, wherein the page view is set as a list displayed on a front-end page, and includes: a first configuration module, which is used to configure information of a data source and a data source column; wherein the data source includes a plurality of data source columns; a second configuration module, which is used to configure information of a view and a view column; wherein the view includes a plurality of view columns, and each view includes a unique name or identifier; a binding module, which is used to bind a specified data source to a current view, and obtain configuration data of the current view, so that the current view obtains data from one or more specified data sources, and correspondingly, the view columns in the current view obtain data from the data source columns in the specified data sources; a parsing module, which is used to parse the configuration data of the current view, and write and store the parsed configuration data of the current view; a receiving module, which is used to receive a request parameter of the current view to be configured sent by the front end, so as to obtain the configuration data of the current view to be configured; wherein the request parameter includes the name or identifier of the current view to be configured; and a sending module, which is used to send the configuration data of the current view to be configured to the front end, so as to render the page view.

[0014] An embodiment of the present application provides an electronic device, which includes a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the steps of the method described above are implemented.

[0015] An embodiment of the present application provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the steps of the method described above are implemented.

[0016] An embodiment of the present application provides a computer program product, wherein the computer program product includes computer program instructions, and when the computer program instructions are executed by a processor, the steps of the method described above are implemented.

[0017] The above technical solution of the present application has at least the following beneficial technical effects:

[0018] 1. In the embodiments of the present application, by adding static annotations to classes and fields, self-description of configuration information is achieved, and the configuration information is intuitively displayed in the source code, which greatly improves readability; when modifying, based on the existing configuration code, modifications can be made where necessary, without the need to write scripts from scratch or repeatedly, which improves maintainability; and the existing code can be directly reused by adding annotations to reduce configuration information work.

[0019] 2. In an embodiment of the present application, when the front end sends the request parameters of the current view to be configured to the back end, the request parameters may include, for example, the unique name or identifier of the current view to be configured, and the corresponding configuration data can be retrieved from the back end central storage to obtain the data source bound to the view, query and obtain data from these data sources one by one, and assemble them together and return them to the front end to render the front end page view; if the request parameters sent also include dynamic demand information during display, such as query conditions, sorting information, etc. of the data, the data displayed on the front end can be sorted in ascending or descending order, which is more in line with the customer's personalized customization needs for data. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following briefly introduces the drawings in the embodiments of the present application.

[0021] Figure 1 It is a schematic diagram of the system architecture of an embodiment of the present application.

[0022] Figure 2 It is a flowchart of a method for rendering a page view according to an embodiment of the present application.

[0023] Figure 3 This is a schematic diagram of the processing process of a page view rendering method of an embodiment of the present application Figure 1 .

[0024] Figure 4 This is a schematic diagram of the processing process of a page view rendering method of an embodiment of the present application Figure 2 .

[0025] Figure 5 It is a structural block diagram of a rendering device for a page view according to an embodiment of the present application.

[0026] Figure 6 It is a schematic diagram of an electronic device used to implement a page view rendering method of an embodiment of the present application. DETAILED DESCRIPTION

[0027] The principles and spirit of the present application will be described below with reference to several exemplary embodiments. It should be understood that the purpose of providing these embodiments is to make the principles and spirit of the present application clearer and more thorough, so that those skilled in the art can better understand and implement the principles and spirit of the present application. The exemplary embodiments provided herein are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments herein, all other embodiments obtained by ordinary technicians of the art without creative work are within the scope of protection of this application.

[0028] Embodiments of the present application relate to terminal devices and / or servers. Those skilled in the art will appreciate that the embodiments of the present application may be implemented as a system, apparatus, device, method, computer-readable storage medium, or computer program product. Therefore, the present disclosure may be specifically implemented in at least one of the following forms: complete hardware, complete software, or a combination of hardware and software. According to the embodiments of the present application, the present application claims protection for a method, apparatus, electronic device, computer-readable storage medium, and computer program product for rendering a page view. Figure 1 A schematic diagram of a system architecture of an embodiment of the present application is shown. Figure 1 As shown, the system includes a terminal device 102 and a server 104. Among them, the terminal device 102 may include at least one of the following: a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart TV, various wearable devices, an augmented reality AR device, a virtual reality VR device, etc. A client can be installed on the terminal device 102. For example, the client can be a client that specifically performs a specific function (such as an application app), or a client with multiple application applets (different functions) embedded in it, or a client logged in through a browser. The user can operate on the terminal device 102. For example, the user can open the client installed on the terminal device 102 and input instructions through the client operation, or the user can open the browser installed on the terminal device 102 and input instructions through the browser operation. After the terminal device 102 receives the instruction input by the user, the request information containing the instruction is sent to the server 104. After receiving the request information, the server 104 performs corresponding processing and then returns the processing result information to the terminal device 102. The user instruction is completed through a series of data processing and information interaction.

[0029] In this document, terms such as first, second, third, etc. are only used to distinguish one entity (or operation) from another entity (or operation), but not to require or imply any order or relationship between these entities (or operations).

[0030] The following is a brief description of the concepts and technical terms that may be involved in the embodiments of the present application.

[0031] Backend (or backend server): services provided by server 104.

[0032] Front end (or front end unit): desktop browser or mobile browser of terminal device 102.

[0033] Figure 2 A schematic diagram of a flow chart of a method for rendering a page view according to an embodiment of the present application is shown, and the method comprises the following specific steps:

[0034] S101: configuring information of a data source and a data source column; wherein the data source includes a plurality of data source columns;

[0035] S102: configuring information of a view and a view column; wherein a view includes a plurality of view columns, and each view includes a unique name or identifier;

[0036] S103: Bind the specified data source to the current view to obtain configuration data of the current view, so that the current view can obtain data from one or more specified data sources, and correspondingly, the view columns in the current view obtain data from the data source columns in the specified data sources;

[0037] S104: parsing the configuration data of the current view, and writing and storing the parsed configuration data of the current view;

[0038] S105: receiving a request parameter of the current view to be configured sent by the front end to obtain configuration data of the current view to be configured; wherein the request parameter includes a name or an identifier of the current view to be configured;

[0039] S106: Send the configuration data of the current view to be configured to the front end to render the page view.

[0040] In the embodiment of the present application, the page view can be set as a list displayed on the front-end page, by utilizing some inherent characteristics of the development language, such as using the class in the Java language to describe a view or data source, and using the field (class member) in the class (class) to describe the view column or data source column, so that the configuration data is naturally associated; the existing code is directly reused by adding annotations, which greatly reduces the configuration work; for example, the code can use the existing mybatis class, and by simply adding the annotation @HroDataSource, it can be defined as a complete data source containing the database name, table name, and fields contained in the table; by adding static annotations to the class and field, the self-description of the configuration information is realized, and the configuration information is intuitively displayed in the source code, which greatly improves readability; when modifying, based on the existing configuration code, it can be modified where necessary, without having to write scripts from scratch or repeatedly, which improves maintainability; reference Figure 3 A view can use, integrate and / or assemble data from multiple data sources. When the specified data source is bound to the current view, the configuration data of the current view can be obtained, so that the current view can obtain data from one or more specified data sources, and correspondingly, the view column in the current view obtains the corresponding data from the data source column in the specified data source; when the front end sends the request parameters of the current view to be configured to the back end, the request parameters may include, for example, the unique name or identifier of the current view to be configured, and the corresponding configuration data can be retrieved from the back end central storage to obtain the data source bound to the view, query and obtain data from these data sources one by one, and assemble them together and return them to the front end to render the front end page view; it can be realized that after the scattered and independent data are configured, the complete information of the configuration object can be displayed in an intuitive way.

[0041] In some embodiments, when a data query request sent by the front end is received, the configuration data of the current view to be configured is extracted according to the name or identifier of the current view to be configured, and the data source bound to the current view is queried according to the dynamic demand information during display, and the queried data is bound from the data source column to the corresponding view column, and a corresponding data list is generated to be sent to the front end for display of the data list. Specifically, if the request parameters sent also include dynamic demand information during display, such as query conditions and sorting information of the data, the data displayed on the front end can be sorted in ascending or descending order, which is more in line with the customer's personalized customization needs for data and can meet various different data query needs.

[0042] In some embodiments, the information for configuring a data source includes defining one or more of the following elements: the name of the data source, the database, and the data table; and / or, the information for configuring a data source column includes defining one or more of the following elements: the data source column identifier, the fully qualified name of the database table field, the query expression, and the formatting string; and / or, the information for configuring a view includes defining one or more of the following elements: the name or identifier of the view, the display name, the sorting rule, whether to lock the header when displaying, the number of fixed columns on the left when displaying, the number of fixed columns on the right when displaying, and the dynamic annotation; and / or, the information for configuring a view column includes defining one or more of the following elements: the identifier of the view column, the display position order when displaying, the display name, the bound data source, the bound data source column, the query expression, whether it is visible when displaying, whether it can be exported, whether it can be sorted, the horizontal alignment style when displaying, the vertical alignment style when displaying, the column width when displaying, the formatting style when displaying, the formatting style when exporting, and whether to display summary data when displaying. By adding static annotations to the class and field, the self-description of the configuration information is realized, and the configuration information is intuitively displayed in the source code, which greatly improves the readability.

[0043] In some embodiments, a class is configured as a data source by adding a first annotation to the class; and / or, a second annotation is added to a class member field to configure it as a data source column; and / or, a class is configured as a view by adding a third annotation to the class; and / or, a fourth annotation is added to the field to configure it as a view column. By adding static annotations to the class and field, self-description of configuration information is achieved, and existing code can be directly reused by adding annotations to reduce configuration information work.

[0044] In some embodiments, step S103, binding the specified data source to the current view to obtain configuration data of the current view so as to enable the current view to obtain data from one or more specified data sources, and correspondingly the view columns in the current view obtain data from the data source columns in the specified data sources, includes:

[0045] By adding the fifth annotation to the class, one or more of the following elements can be defined: the name of the specified data source to be bound; the associated fields on the main result set when the data of the specified data source is associated with the main result set; the associated fields on the specified data source when the data of the specified data source is associated with the main result set; and the default query conditions of the specified data source in the current view. For example, refer to Figure 4, define the names of the specified data sources bound to the current view as employee data and company data, call employee data and obtain the corresponding data table 1, associate data table 1 to obtain the main result set, and the associated fields on the main result set can be defined as the main data source column (masterColumn); at the same time, query company data and obtain the corresponding data table 2. When data table 2 is associated, all fields (or values) of the company ID on the main data source column are deduplicated, and the associated fields in data table 2 are called using the company ID on the main data source column. The associated fields in data table 2 can be defined as slave data source columns (slaverColumn); use the company ID to match the main data source column and the slave data source column, so as to assemble data table 1 and data table 2 together, bind the specified data source to the current view, and obtain the configuration data of the current view.

[0046] In some embodiments, step S103, after binding the specified data source to the current view to obtain configuration data of the current view so as to enable the current view to obtain data from one or more specified data sources and correspondingly the view columns in the current view obtain data from the data source columns in the specified data sources, further includes:

[0047] By adding the sixth annotation to the field configured as a view column, the translation information is configured for a view column; wherein the configuration translation information is set to convert the code field into text when the stored data is a code field; the configuration translation information for a view column specifically includes:

[0048] Get the original code field; get the target data source required to provide translation data according to the set query conditions; match the text field of the target data source with the original code field; if they match, update the text field of the target data source to the current view column or other specified view columns. For example, refer to Figure 4 , obtain the original code field in the data source column gender in data table 1, use it as the field to be translated, and deduplicate all fields (or values) of the field to be translated (gender) in data table 1, use the original code field [1,2] to query the gender dictionary data source, match the corresponding text field of the gender dictionary data source with the field to be translated, and update the matching result, that is, the text field of the gender dictionary data source, to the current view column, that is, translate gender into text and overwrite the original code field.

[0049] In some embodiments, step S103, after binding the specified data source to the current view to obtain configuration data of the current view so as to enable the current view to obtain data from one or more specified data sources and correspondingly the view columns in the current view obtain data from the data source columns in the specified data sources, further includes:

[0050] By adding the seventh annotation to the class that has been configured as a view, you can configure data permission control for the current view. When the data is displayed on the front end, by adding the seventh annotation @HroDataRestrict to the Class that has been configured as a view, you can control the permission of the configuration data of the current view to limit the data range that the current login account can view.

[0051] In some embodiments, step S103, after binding the specified data source to the current view to obtain configuration data of the current view so as to enable the current view to obtain data from one or more specified data sources and correspondingly the view columns in the current view obtain data from the data source columns in the specified data sources, further includes:

[0052] After parsing the configuration data of the current view from the source code at runtime, the dynamic bytecode technology is used to dynamically generate interface code for each view, and permission annotations are added to the interface code according to the eighth configuration annotation to implement permission control of the interface code. Specifically, after parsing the configuration data of the current view from the source code at runtime, the dynamic bytecode technology is used to dynamically generate code for each view, including defining classes (Class), interface methods (Method), adding permission annotations to classes (Class), adding interface parameters to interface methods, etc.

[0053] In some embodiments, step S104, parsing the configuration data of the current view, and writing and storing the parsed configuration data of the current view, includes:

[0054] Step S1041, scanning all target classes having the first annotation or the third annotation to obtain annotation information of each target class and class members included in the target class;

[0055] Step S1042, extracting the configuration information of the data source and the configuration information of the view according to the annotation information of the target class and the class members contained in the target class;

[0056] Step S1043, add the current program identifier; wherein the current program is set as the program that defines the configuration information of the current view. Specifically, by obtaining the annotation information on the Class and its Field, and extracting the configuration items of the data source and view according to the above annotation parameters, and adding the current program identifier, the entire system can mark that the data source and view are defined by the current program and the data is provided by the current program. The current program identifier is registered in the central storage that can be accessed by all other programs. The central storage of the back end is connected to the various servers of the back end. By adding the program identifier, the data stored in the various servers of the back end can be quickly retrieved.

[0057] In some embodiments, step S105, after receiving the request parameters for configuring the current view sent by the front end to obtain the configuration data of the current view, further includes: verifying the configuration data of the current view. Specifically, when the back end receives the request for querying data from the front end, it extracts the configuration data of the current view from the central storage according to the name / identifier of the current view in the request, and then performs necessary data operation verification to verify the deeper logical relationship, and then obtains the data source bound to the view, queries and obtains data from these data sources one by one, and assembles them together and returns them to the front end, so as to ensure the effective display of data. For example, an error message is sent when at least one of the following situations exists: the current view is not configured with a primary data source; the secondary data source is not configured with an associated data source column; the bound data source column does not exist; the view does not have at least one visible view column; and when verifying the identifier of the view column, the identifier of the view column is not unique.

[0058] The above describes the implementation methods and advantages of the embodiments of the present application through multiple embodiments. The following describes the specific processing process of the embodiments of the present application in detail with reference to specific examples.

[0059] 1. Configure the data source

[0060] A data source is a source that can provide data according to certain rules. A data source can provide data for a view, and one data source can provide data for multiple views.

[0061] Data sources usually correspond to table structures in databases. A data source configuration mainly includes the configuration of the data source itself (DataSource) and the configuration of the data source column (DataSource Column). The relationship between the two is that a data source contains a data source column, and a data source column must belong to a data source and cannot exist independently. The two are in a one-to-many relationship.

[0062] The classes (Class) and class members (Field) in the Java language perfectly conform to the above logical relationship, so this solution uses Class and Field to configure the data source and data source column respectively.

[0063] 1.1. Specific processing of configuring data source

[0064] Add the first annotation @HroDataSource to the Class to configure a Class as a data source. Add the first annotation @HroDataSource to annotate parameter names and data source configuration instructions as shown in Table 1:

[0065] Table 1 Data source configuration description

[0066]

[0067] Use the existing entity (a special class that is a collection of each type of data object) that corresponds one-to-one with the database table to define the elements in Table 1. Simply add the first annotation to quickly generate a data source, improve code reuse, and reduce repetitive development work.

[0068] 1.2. Specific processing of configuring data source columns

[0069] By adding the second annotation @HroDataSourceColumn to the Field, you can configure a Field as a data source column. See Table 2 for adding the second annotation @HroDataSourceColumn to annotate parameter names and data source column configuration instructions:

[0070] Table 2 Data source column configuration description

[0071]

[0072] As can be seen from the above description, each configuration item has a default value, so by default, the second annotation @HroDataSourceColumn does not need to be added, and all Fields in the Class automatically become data source columns to minimize the development workload.

[0073] By default, all fields automatically become data source columns. When reusing an existing class, some fields may not correspond to data source columns. For such fields, you can mark them as non-data source columns by adding the annotation @HroExclude, and such fields will be ignored during parsing.

[0074] 2. Configure the view

[0075] A view is a list that can be displayed on the front-end page. Configuring a view mainly includes data binding, view column configuration, interface permission configuration, data permission configuration, etc.

[0076] The relationship between Listview and Listview Column is one of inclusion and being included. The relationship between the two is one-to-many. Therefore, you can also use Class and Field in Java language to configure views and view columns respectively.

[0077] 2.1. Specific processing of configuration view

[0078] By adding the third annotation @HroListview to Class, you can define and configure a view.

[0079] Add the third annotation @HroListview to annotate the parameter name and view configuration instructions as shown in Table 3:

[0080] Table 3 View configuration description

[0081]

[0082] 2.2. Specific processing of data binding

[0083] Configure the data sources from which the current view can obtain data. By adding the fifth annotation @HroJoinDataSource to the Class, the specified data source can be bound to the current view. See Table 4 for data binding instructions:

[0084] Table 4 Data binding description

[0085]

[0086] A view can use, integrate or assemble data from multiple data sources by adding multiple @HroJoinDataSource annotations to define it.

[0087] 2.3 Specific processing of view column configuration

[0088] You can configure the view column by adding the fourth annotation @HroListviewColumn on Field. See Table 5 for the parameter name and view column configuration instructions for adding the fourth annotation @HroListviewColumn:

[0089] Table 5 View column configuration description

[0090]

[0091] 2.4. Specific processing of view column configuration translation information

[0092] In the data stored in the database, if the saved data is a code value, it needs to be translated into understandable text when displayed or exported on the front end.

[0093] You can configure translation information for a view column by adding the sixth annotation @HroTranslateColumn to the Field that has been configured as a view column. See Table 6 for instructions on adding the sixth annotation @HroTranslateColumn to annotate parameters and configure translation information:

[0094] Table 6 View column configuration translation information description

[0095]

[0096] 2.5. Specific processing of data permission configuration

[0097] When the data is displayed on the front end, by adding the seventh annotation @HroDataRestrict to the Class that has been configured as a view, permission control can be performed for the configuration data of the current view to limit the scope of data that the current login account can view.

[0098] 2.6. Specific processing of interface permission configuration

[0099] The bytecode technology can be used to dynamically generate interface code at runtime, and permission annotations can be added to the dynamically generated interface according to the eighth configuration @HroListview.apiAnnotations to implement interface permission control.

[0100] In the embodiment of the present application, a unified interface can be provided for the view component, so developers who use the view component in the future do not need to write the interface manually, and there is no opportunity to add permission control to the interface; and because the view is dynamically defined, the view component cannot know in advance which views will be defined, so it is impossible to write an interface and add permission control for each view in advance. In view of this, in this solution, after parsing the configuration data of the current view from the source code at runtime, the dynamic bytecode technology is used to dynamically generate code for each view, including defining classes (Class), interface methods (Method), adding permission annotations to classes (Class), adding interface parameters to interface methods, etc.

[0101] 3. Specific processing of parsing and storing the configuration data of the current view

[0102] When the program starts, all configuration data defined by the current program is first deleted from the back-end central storage, and then the parsed configuration data is written to the central storage, so that the configuration data can be updated by restarting the program.

[0103] When the program starts, the reflection technology in the Java language is used to scan all classes with @HroDataSource and @HroListview, obtain the annotation information on the class and its fields, and extract the configuration items of the data source and view according to the above annotation parameters, and add the current program identifier so that the data source and view can be marked system-wide as defined by the current program and provided by the current program. The current program identifier is registered in the central storage that can be accessed by all other programs.

[0104] 4. A specific process of querying the configuration data of the current view

[0105] When the front-end page is opened, the configuration data of the current view will be requested from the back-end. The request parameters may provide the name / ID of the current view, and / or the dynamic demand information for display (including specific requirements for displaying data, such as ascending and descending order of data). After receiving the request parameters, the back-end uses the name / ID of the current view to extract the configuration data of the current view from the central memory, configures the dynamic demand information that is consistent with the front-end display requirements, and returns it to the front-end. The front-end displays the list according to the configuration information.

[0106] All programs are equal in terms of obtaining the configuration data of the current view. For example, if a view is defined by program A, since all programs can access the central storage equally, program B can also obtain the exact same view configuration data from the central storage according to the name / identifier of the view, thereby improving the flexibility and scalability of the system.

[0107] 5. Another specific process for querying the configuration data of the current view

[0108] When the front-end page clicks on search or other actions that trigger search, it will request data from the back-end. After receiving the request for querying data, the back-end first completes the necessary verification. According to the name / identity of the current view carried in the request, the data source bound to the current view is obtained from the configuration data stored in the central storage, and data is obtained from these data sources one by one, and then assembled and returned to the front-end.

[0109] From the above configuration instructions, it can be seen that data sources can be defined, configured, and provided by different programs. The data required by a view can come from data sources of different programs, thereby realizing distributed data query.

[0110] Single data source query process:

[0111] 5.1.According to the name of the data source, obtain the configuration items of the data source, that is, obtain the elements defined for the data source;

[0112] 5.2. Get which program provides data for the data source from the configuration item of the data source;

[0113] 5.3. Obtain the data that needs to be obtained from the data source from each configuration item of the current view;

[0114] 5.4. For the primary data source, obtain the query conditions from the request sent by the front end; for the secondary data source, obtain the list of associated field values ​​from the current primary result set as the conditions;

[0115] 5.5. Call the data interface of the program;

[0116] 5.6. Assemble the data called from the program into the main result set.

[0117] 6. Front-end rendering

[0118] After the front end receives the data returned by the back end, it binds the data to the list displayed on the front end page.

[0119] Corresponding to the method embodiment of the present application, the present application also provides a rendering device for a page view, such as Figure 5 As shown, including:

[0120] A first configuration module 510, which is used to configure information of a data source and a data source column; wherein the data source includes a plurality of data source columns;

[0121] A second configuration module 520, which is used to configure information of a view and a view column; wherein a view includes a plurality of view columns, and each view includes a unique name or identifier;

[0122] A binding module 530 is used to bind the specified data source to the current view, and obtain the configuration data of the current view, so that the current view obtains data from one or more specified data sources, and correspondingly, the view columns in the current view obtain data from the data source columns in the specified data sources;

[0123] A parsing module 540, which is used to parse the configuration data of the current view, and write and store the parsed configuration data of the current view;

[0124] A receiving module 550 is used to receive a request parameter of the current view to be configured sent by the front end to obtain configuration data of the current view to be configured; wherein the request parameter includes a name or an identifier of the current view to be configured;

[0125] The sending module 560 is used to send the configuration data of the current view to be configured to the front end to render the page view.

[0126] The electronic device in the embodiment of the present application may be a user terminal device, a server, other computing devices, or a cloud server. Figure 6 A schematic diagram of the hardware structure of an electronic device according to an embodiment of the present application is shown. The electronic device may include a processor 601 and a memory 602 storing computer program instructions. When the processor 601 executes the computer program instructions, the process or function of any of the above-mentioned embodiments of the method is implemented.

[0127] Specifically, the processor 601 may include a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application. The memory 602 may include a large-capacity memory for data or instructions. For example, the memory 602 may be at least one of the following: a hard disk drive (HDD), a read-only memory (ROM), a random access memory (RAM), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a tape, a universal serial bus (USB) drive or other physical / tangible memory storage device. For another example, the memory 602 may include a removable or non-removable (or fixed) medium. For another example, the memory 602 may be inside or outside the integrated gateway disaster recovery device. The memory 602 may be a non-volatile solid-state memory. In other words, the memory 602 usually includes a tangible (non-transitory) computer-readable storage medium (such as a memory device) encoded with computer-executable instructions, and when the software is executed (such as executed by one or more processors), the operation described in the method of the embodiment of the present application can be performed. The processor 601 implements the process or function of any method in the above embodiments by reading and executing the computer program instructions stored in the memory 602.

[0128] In one example, Figure 6 The electronic device shown may also include a communication interface 603 and a bus 610. Among them, the processor 601, the memory 602, and the communication interface 603 are connected through the bus 610 and complete the communication between each other. The communication interface 603 is mainly used to realize the communication between each module, device, unit and / or device in the embodiment of the present application. The bus 610 includes hardware, software or both, and can couple the components of the online data traffic billing device to each other. For example, the bus may include at least one of the following: an accelerated graphics port (AGP) or other graphics bus, an enhanced industrial standard architecture (EISA) bus, a front-end bus (FSB), a hypertransport (HT) interconnect, an industrial standard architecture (ISA) bus, an infinite bandwidth interconnect, a low pin count (LPC) bus, a memory bus, a micro channel architecture (MCA) bus, a peripheral component interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a serial advanced technology attachment (SATA) bus, a video electronics standard association local (VLB) bus or other suitable buses. The bus 610 may include one or more buses. Although the embodiments of the present application describe or illustrate a specific bus, the embodiments of the present application may consider any suitable bus or interconnection method.

[0129] In combination with the method in the above embodiments, an embodiment of the present application also provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the process or function of any method in the above embodiments is implemented.

[0130] In addition, an embodiment of the present application further provides a computer program product, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the process or function of any one of the methods in the above embodiments is implemented.

[0131] The above exemplarily describes the flowcharts and / or block diagrams of the methods, devices, systems and computer program products of the embodiments of the present application, and describes the relevant various aspects. It should be understood that each box or combination thereof in the flowchart and / or block diagram can be implemented by computer program instructions, or by dedicated hardware that performs a specified function or action, or by a combination of dedicated hardware and computer instructions. For example, these computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to form a machine that enables these instructions executed by such a processor to enable the implementation of the functions / actions specified in each box or combination thereof in the flowchart and / or block diagram. Such a processor can be a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit.

[0132] The functional blocks shown in the structured block diagram of the embodiment of the present application can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application-specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc.; when implemented in software, it is a program or code segment used to perform the required task. The program or code segment can be stored in a memory, or transmitted on a transmission medium or a communication link via a data signal carried in a carrier. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.

[0133] It should be noted that the present application is not limited to the specific configurations and processes described above or shown in the figures. The above is only a specific implementation mode of the present application. Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working process of the described system, device, module or unit can refer to the corresponding process in the method embodiment without further description. It should be understood that the scope of protection of the present application is not limited to this. Any technician familiar with the technical field can think of various equivalent modifications or substitutions within the technical scope disclosed in the present application, and these modifications or substitutions should be included in the scope of protection of the present application.

Claims

1. A method for rendering a page view, characterized in that: The page view is set to a list displayed on the front-end page, and the method includes: Configure information about a data source and a data source column; wherein the data source includes a plurality of data source columns; Configure information about views and view columns; wherein a view includes multiple view columns, and each view includes a unique name or identifier; Bind the specified data source to the current view to obtain the configuration data of the current view, so that the current view can obtain data from one or more specified data sources, and correspondingly, the view columns in the current view obtain data from the data source columns in the specified data sources; Parsing the configuration data of the current view, and writing and storing the parsed configuration data of the current view; Receiving a request parameter of the current view to be configured sent by the front end to obtain configuration data of the current view to be configured; wherein the request parameter includes a name or an identifier of the current view to be configured; The configuration data of the current view to be configured is sent to the front end to render the page view; wherein, By adding the fifth annotation to the class, one or more of the following elements are defined: the name of the specified data source to be bound; when the data of the specified data source is associated with the main result set, the associated field on the main result set; when the data of the specified data source is associated with the main result set, the associated field on the specified data source; and the default query condition of the specified data source in the current view; Define the names of the specified data sources bound to the current view as employee data and company data, call employee data to get data table 1, call company data to get data table 2; associate data table 1 to get the main result set, and define the associated fields on the main result set as the main data source columns; associate data table 2, and remove all the same fields on data table 2 and the main data source columns, and use the fields on the main data source columns to call the associated fields in data table 2, and define the associated fields in data table 2 as the secondary data source columns; match the main data source columns and the secondary data source columns, so as to assemble data table 1 and data table 2 together, realize binding the specified data source to the current view, and obtain the configuration data of the current view; Configure a class as a data source by adding the first annotation to the class; and / or, By adding a second annotation to the class member field to configure it as a data source column; and / or, Configure a class as a view by adding a third annotation to the class; and / or, By adding the fourth annotation to the field, it is configured as a view column; Parsing the configuration data of the current view, and writing and storing the parsed configuration data of the current view, including: scanning all target classes having the first annotation or the third annotation to obtain annotation information of each target class and class members contained in the target class; extracting the configuration information of the data source and the configuration information of the view according to the annotation information of the target class and the class members contained in the target class; adding a current program identifier; wherein the current program is set to be a program that defines the configuration information of the current view; The data source is defined and configured by different programs, and the data required by the current view comes from the data sources of different programs; wherein, the data stored in each server is obtained by adding the current program identifier.

2. The method according to claim 1, characterized in that The information for configuring the data source includes defining one or more of the following elements: the name of the data source, the database and the data table; and / or, Configuring the information of the data source column includes defining one or more of the following elements: a data source column identifier, a database table field fully qualified name, a query expression, and a format string; and / or, The information for configuring the view includes defining one or more of the following elements: the name or identifier of the view, the display name, the sorting rule, whether to lock the header when displaying, the number of fixed columns on the left when displaying, the number of fixed columns on the right when displaying, and dynamic annotations; and / or, The information for configuring a view column includes defining one or more of the following elements: the view column identifier, the display position order when displaying, the display name, the bound data source, the bound data source column, the query expression, whether it is visible when displaying, whether it is exportable, whether it is sortable, the horizontal alignment style when displaying, the vertical alignment style when displaying, the column width when displaying, the formatting style when displaying, the formatting style when exporting, and whether to display summary data when displaying.

3. The method according to claim 1, characterized in that After the specified data source is bound to the current view to obtain configuration data of the current view so as to enable the current view to obtain data from one or more specified data sources, and the view columns in the current view correspondingly obtain data from the data source columns in the specified data sources, the method further includes: By adding the sixth annotation to the field configured as a view column, the translation information is configured for a view column; wherein the configuration translation information is set to convert the code field into text when the stored data is a code field; the configuration translation information for a view column specifically includes: Get the original code field; Obtain the target data source required to provide translation data according to the set query conditions; Match the text field of the target data source with the original code field; if they match, update the text field of the target data source to the current view column or other specified view columns.

4. The method according to claim 1, characterized in that After the specified data source is bound to the current view to obtain configuration data of the current view so as to enable the current view to obtain data from one or more specified data sources, and the view columns in the current view correspondingly obtain data from the data source columns in the specified data sources, the method further includes: By adding the seventh annotation to the class that has been configured as a view, you can configure data permission control for the current view; and / or, After parsing the configuration data of the current view from the source code at runtime, the interface code is dynamically generated for each view using dynamic bytecode technology, and permission annotations are added to the interface code according to the eighth configuration annotation to implement permission control of the interface code.

5. The method according to claim 1, characterized in that: The request parameter also includes dynamic demand information during display; the method also includes: When a data query request sent by the front end is received, the configuration data of the current view to be configured is extracted according to the name or identifier of the current view to be configured, and the data source bound to the current view is queried according to the dynamic demand information during the display, and the queried data is bound from the data source column to the corresponding view column, and a corresponding data list is generated to be sent to the front end to display the data list.

6. The method according to any one of claims 1 to 5, characterized in that: After receiving the request parameters for configuring the current view sent by the front end to obtain the configuration data of the current view, the method further includes: Verify the configuration data of the current view to send error information and / or warning information; wherein, An error message is sent if at least one of the following situations exists: the current view is not configured with a primary data source; the secondary data source is not configured with an associated data source column; the bound data source column does not exist; the view does not have at least one visible view column; and when the view column identifier is verified, the view column identifier is not unique.

7. A rendering device for a page view, characterized in that: The page view is set to the list displayed on the front-end page, including: A first configuration module, which is used to configure information of a data source and a data source column; wherein the data source includes a plurality of data source columns; A second configuration module, which is used to configure information of a view and a view column; wherein a view includes a plurality of view columns, and each view includes a unique name or identifier; A binding module is used to bind the specified data source to the current view, obtain the configuration data of the current view, so that the current view obtains data from one or more specified data sources, and correspondingly, the view column in the current view obtains data from the data source column in the specified data source; A parsing module, configured to parse the configuration data of the current view, and write and store the parsed configuration data of the current view; A receiving module, which is used to receive the request parameters of the current view to be configured sent by the front end to obtain the configuration data of the current view to be configured; wherein the request parameters include the name or identifier of the current view to be configured; A sending module, which is used to send the configuration data of the current view to be configured to the front end to render the page view; wherein, By adding the fifth annotation to the class, one or more of the following elements are defined: the name of the specified data source to be bound; when the data of the specified data source is associated with the main result set, the associated field on the main result set; when the data of the specified data source is associated with the main result set, the associated field on the specified data source; and the default query condition of the specified data source in the current view; Define the names of the specified data sources bound to the current view as employee data and company data, call employee data to get data table 1, call company data to get data table 2; associate data table 1 to get the main result set, and define the associated fields on the main result set as the main data source columns; associate data table 2, and remove all the same fields on data table 2 and the main data source columns, and use the fields on the main data source columns to call the associated fields in data table 2, and define the associated fields in data table 2 as the secondary data source columns; match the main data source columns and the secondary data source columns, so as to assemble data table 1 and data table 2 together, realize binding the specified data source to the current view, and obtain the configuration data of the current view; Configure a class as a data source by adding the first annotation to the class; and / or, By adding a second annotation to the class member field to configure it as a data source column; and / or, Configure a class as a view by adding a third annotation to the class; and / or, By adding the fourth annotation to the field, it is configured as a view column; Parsing the configuration data of the current view, and writing and storing the parsed configuration data of the current view, including: scanning all target classes having the first annotation or the third annotation to obtain annotation information of each target class and class members contained in the target class; extracting the configuration information of the data source and the configuration information of the view according to the annotation information of the target class and the class members contained in the target class; adding a current program identifier; wherein the current program is set to be a program that defines the configuration information of the current view; The data source is defined and configured by different programs, and the data required by the current view comes from the data sources of different programs; wherein, the data stored in each server is obtained by adding the current program identifier.

Citation Information

Patent Citations

  • Method and device for binding associated object

    CN113032393A