Method and device for dynamically creating query interface, storage medium and computer equipment
By dynamically creating query interface methods and utilizing request mapping processors and the MyBatis framework, the instant generation and invocation of interfaces are realized, solving the problems of long development cycles and high labor costs in the traditional query interface development model, and improving the response speed of medical data needs as well as the flexibility and security of the system.
Patent Information
- Application Number
- CN202610148635.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-02-02
- Publication Date
- 2026-04-28
AI Technical Summary
Traditional query interface development models suffer from long development cycles, high labor costs, rigid processes, and slow response times when faced with rapidly growing data volumes and diverse query needs, making it difficult to quickly adapt to the frequently changing business requirements in the healthcare field.
By receiving query interface requests, dynamically constructing route mappings and binding unified processing logic using request mapping processors, dynamically creating query statement encapsulation objects and associating them with routes, integrating the capabilities of Spring and MyBatis frameworks, supporting visual configuration and dynamic SQL execution, and realizing the instant generation and invocation of interfaces.
It shortened the development cycle, reduced labor costs, improved the response speed to temporary medical data needs, enhanced the system's flexibility and security, and ensured the instant generation and compliant use of interfaces.
Smart Images

Figure CN121935310A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of interface development technology, and in particular to a method, apparatus, storage medium and computer device for dynamically creating query interfaces. Background Technology
[0002] With the rapid development of information technology and the accelerated digitalization of the healthcare field, medical institutions and related enterprises are facing an increasing demand for data processing. Especially in the current environment, how to efficiently and flexibly respond to various query needs has become a pressing issue. Traditional query interface development models have revealed numerous problems when faced with rapidly increasing data volumes and diverse query requirements.
[0003] In the healthcare field, data analytics is crucial for improving the quality and efficiency of medical services. Whether it's clinical research, patient treatment outcome tracking, or public health monitoring, all rely on the effective analysis and utilization of large amounts of medical data.
[0004] However, existing traditional methods for querying and analyzing this data have significant shortcomings: First, they have long development cycles and high labor costs. Creating each query interface requires following a fixed development process, including writing components such as Controller, Service, and Mapper. This model results in even simple query functions requiring substantial time and human resources, significantly increasing project development costs and making it difficult for R&D teams to focus on more challenging core business logic development. Second, they suffer from rigid processes and slow response times. The unique nature of the healthcare industry means that its business needs may change frequently, especially temporary data query requirements or exploratory data analysis tasks. Traditional development models, due to their inherent complexity and lengthy development cycles, cannot quickly adapt to these changes, thus affecting decision-making speed and operational efficiency, which is particularly detrimental to the rapid response requirements of the healthcare environment.
[0005] Therefore, in order to overcome the above problems, improve the flexibility and efficiency of query interface development, and reduce unnecessary repetitive work, there is an urgent need for a more intelligent and dynamic query interface creation method. Summary of the Invention
[0006] In view of this, embodiments of this application provide a method, apparatus, storage medium, and computer device for dynamically creating query interfaces.
[0007] According to one aspect of this application, a method for dynamically creating a query interface is provided, the method comprising:
[0008] Receive a query interface creation request, wherein the query interface creation request includes interface configuration information and query statement; The request mapping processor constructs a request mapping information object based on the interface configuration information, associates the request mapping information object with a preset unified processing method, uses the preset unified processing method as the processing method of the request mapping information object, and registers the mapping relationship between the request mapping information object and the corresponding processing method in the routing table. A query statement encapsulation object is created based on the query statement, a unique identifier is assigned to the query statement encapsulation object, and the unique identifier is associated with the request mapping information object, so that when the request mapping information object is invoked, the query statement of the query statement encapsulation object corresponding to the unique identifier is executed through the preset unified processing method.
[0009] Optionally, creating a query statement encapsulation object based on the query statement includes: The query statement is parsed using a language-driven component to obtain the corresponding query statement executable object; A standard encapsulation object is created, and the executable object of the query statement is written into the standard encapsulation object to achieve standardized encapsulation of the query statement.
[0010] Optionally, the interface configuration information includes an access address and a specified request method; after associating the unique identifier with the request mapping information object, the method further includes: In response to a request operation to the access address, the target request method and target request parameters of the request operation are identified, and the target request method is determined based on whether it matches the specified request method. If the target request method matches the specified request method, then the target request mapping information object corresponding to the access address and the target unique identifier corresponding to the target request mapping information object are determined. The target processing method corresponding to the target request mapping information object is obtained from the routing table. The target processing method is used to execute the query statement of the query statement encapsulation object corresponding to the target unique identifier based on the target request parameters, and the query result is returned as a response. If the target request method does not match the specified request method, a message indicating that the target request method is not allowed will be output.
[0011] Optionally, the query statement includes at least one query type and the query range for each query type; the step of using the target processing method to execute the query statement encapsulation object corresponding to the target unique identifier based on the target request parameters, and returning the query result as a response, includes: Parse the target query parameters for each query type in the target request parameters, and verify whether the target query parameters are within the query range of the corresponding query type; If the verification result is yes, then the target processing method is used to execute the query statement of the query statement encapsulation object corresponding to the target unique identifier based on the target query parameters, and the query result corresponding to the target query parameters is returned as a response.
[0012] Optionally, the method further includes: Receive a query interface modification request, wherein the query interface modification request includes modifying the interface access address and interface modification information; The request mapping information object to be modified is determined based on the modified interface access address, and the unique identifier corresponding to the request mapping information object to be modified is obtained as the unique identifier to be modified. The interface modification information is parsed, and the modification is performed on the request mapping information object to be modified and / or the query statement encapsulation object corresponding to the unique identifier to be modified based on the parsing result of the interface modification information.
[0013] Optionally, modifying the request mapping information object to be modified and / or the query statement encapsulation object corresponding to the unique identifier to be modified based on the parsed interface modification information includes: If the parsing result includes interface configuration modification information, then the request mapping information object to be modified is modified based on the interface configuration modification information; If the parsing result includes query modification information, then the query statement and the query modification information in the encapsulated object of the query statement to be modified are parsed by the language-driven component to obtain the parsed query statement executable object, and the encapsulated object of the query statement to be modified is updated based on the parsed query statement executable object; wherein, the query modification information includes at least one of query type modification information and query range modification information.
[0014] Optionally, the method further includes: A visual interface is created; wherein the visual interface provides a query interface creation component and a query interface modification component; the query interface creation component is used to receive the input interface configuration information and query statement, and to generate a query interface creation request based on the input interface configuration information and query statement; the query interface modification component is used to receive the input modified interface access address and interface modification information, and to generate a query interface modification request based on the input modified interface access address and interface modification information. The visualization interface is configured with an automated query interface creation program so that the automated query interface creation program is triggered when the visualization interface generates a query interface creation request; wherein, the automated query interface creation program is used to construct a request mapping information object, register a routing table, create a query statement encapsulation object, and assign and associate unique identifiers for the query statement encapsulation objects; and, The visualization interface is configured with an automated query interface modification program so that the visualization interface triggers the execution of the automated query interface modification program when a query interface modification request is generated; wherein, the automated query interface modification program is used to determine the request mapping information object to be modified, parse the interface modification information, and modify the request mapping information to be modified and the encapsulated object of the query statement to be modified.
[0015] According to another aspect of this application, a device for dynamically creating a query interface is provided, the device comprising: The request receiving module is used to receive a query interface creation request, wherein the query interface creation request includes interface configuration information and query statement; The interface creation module is used to construct a request mapping information object based on the interface configuration information through the request mapping processor, associate the request mapping information object with a preset unified processing method, use the preset unified processing method as the processing method of the request mapping information object, and register the mapping relationship between the request mapping information object and the corresponding processing method in the routing table. The statement encapsulation module is used to create a query statement encapsulation object based on the query statement, assign a unique identifier to the query statement encapsulation object, and associate the unique identifier with the request mapping information object, so that when the request mapping information object is invoked, the query statement of the query statement encapsulation object corresponding to the unique identifier is executed through the preset unified processing method.
[0016] Optionally, the statement encapsulation module is specifically used for: The query statement is parsed using a language-driven component to obtain the corresponding query statement executable object; A standard encapsulation object is created, and the executable object of the query statement is written into the standard encapsulation object to achieve standardized encapsulation of the query statement.
[0017] Optionally, the device further includes: a query module, used for: In response to a request operation to the access address, the target request method and target request parameters of the request operation are identified, and the target request method is determined based on whether it matches the specified request method. If the target request method matches the specified request method, then the target request mapping information object corresponding to the access address and the target unique identifier corresponding to the target request mapping information object are determined. The target processing method corresponding to the target request mapping information object is obtained from the routing table. The target processing method is used to execute the query statement of the query statement encapsulation object corresponding to the target unique identifier based on the target request parameters, and the query result is returned as a response. If the target request method does not match the specified request method, a message indicating that the target request method is not allowed will be output.
[0018] Optionally, the query statement includes at least one query type and the query range for each query type; the query module is further configured to: Parse the target query parameters for each query type in the target request parameters, and verify whether the target query parameters are within the query range of the corresponding query type; If the verification result is yes, then the target processing method is used to execute the query statement of the query statement encapsulation object corresponding to the target unique identifier based on the target query parameters, and the query result corresponding to the target query parameters is returned as a response.
[0019] Optionally, the device further includes: an interface modification module, used for: Receive a query interface modification request, wherein the query interface modification request includes modifying the interface access address and interface modification information; The request mapping information object to be modified is determined based on the modified interface access address, and the unique identifier corresponding to the request mapping information object to be modified is obtained as the unique identifier to be modified. The interface modification information is parsed, and the modification is performed on the request mapping information object to be modified and / or the query statement encapsulation object corresponding to the unique identifier to be modified based on the parsing result of the interface modification information.
[0020] Optionally, the interface modification module is specifically used for: If the parsing result includes interface configuration modification information, then the request mapping information object to be modified is modified based on the interface configuration modification information; If the parsing result includes query modification information, then the query statement and the query modification information in the encapsulated object of the query statement to be modified are parsed by the language-driven component to obtain the parsed query statement executable object, and the encapsulated object of the query statement to be modified is updated based on the parsed query statement executable object; wherein, the query modification information includes at least one of query type modification information and query range modification information.
[0021] Optionally, the device further includes: a visual interface configuration module, used for: A visual interface is created; wherein the visual interface provides a query interface creation component and a query interface modification component; the query interface creation component is used to receive the input interface configuration information and query statement, and to generate a query interface creation request based on the input interface configuration information and query statement; the query interface modification component is used to receive the input modified interface access address and interface modification information, and to generate a query interface modification request based on the input modified interface access address and interface modification information. The visualization interface is configured with an automated query interface creation program so that the automated query interface creation program is triggered when the visualization interface generates a query interface creation request; wherein, the automated query interface creation program is used to construct a request mapping information object, register a routing table, create a query statement encapsulation object, and assign and associate unique identifiers for the query statement encapsulation objects; and, The visualization interface is configured with an automated query interface modification program so that the visualization interface triggers the execution of the automated query interface modification program when a query interface modification request is generated; wherein, the automated query interface modification program is used to determine the request mapping information object to be modified, parse the interface modification information, and modify the request mapping information to be modified and the encapsulated object of the query statement to be modified.
[0022] According to another aspect of this application, a storage medium is provided that stores a computer program thereon, which, when executed by a processor, implements the above-described method for dynamically creating a query interface.
[0023] According to another aspect of this application, a computer device is provided, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor executes the program to implement the above-described method for dynamically creating a query interface.
[0024] By employing the above technical solutions, this application provides a method, apparatus, storage medium, and computer device for dynamically creating query interfaces. This method receives a creation request containing interface configuration information and a query statement, dynamically constructs a route mapping using a request mapping processor, and binds it to unified processing logic. Simultaneously, it encapsulates the query statement into a uniquely identified object and associates it with the route, thereby achieving real-time generation and invocation of the interface without writing repetitive code. This embodiment integrates the capabilities of the Spring and MyBatis frameworks, supporting visual configuration, dynamic SQL execution, and access control, shortening the development cycle, reducing labor costs, and improving the response speed to temporary medical data needs.
[0025] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0026] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 A flowchart illustrating a method for dynamically creating a query interface according to an embodiment of this application is shown. Figure 2A A flowchart illustrating another method for dynamically creating a query interface provided in an embodiment of this application is shown; Figure 2B A flowchart illustrating another method for dynamically creating a query interface provided in an embodiment of this application is shown; Figure 3 This illustration shows a structural diagram of a device for dynamically creating a query interface according to an embodiment of this application; Figure 4 A schematic diagram of the device structure of a computer device provided in an embodiment of this application is shown. Detailed Implementation
[0027] The present application will be described in detail below with reference to the accompanying drawings and embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in the embodiments of the present application can be combined with each other.
[0028] This embodiment provides a method for dynamically creating query interfaces, such as... Figure 1 As shown, the method includes: Step 101: Receive a query interface creation request, wherein the query interface creation request includes interface configuration information and query statement.
[0029] In this embodiment, firstly, a query interface creation request is received. This request can be submitted by medical professionals or data analysts through a visual configuration platform, including interface configuration information (such as interface path, HTTP method, input parameter definition, access control policy, etc.) and a query statement conforming to the MyBatis XML syntax specification. For example, querying the follow-up records and medication status of hypertension patients in a certain department over the past 30 days. In healthcare scenarios, such temporary and exploratory data needs are extremely common. For example, disease control departments need to quickly calculate vaccination coverage rates in specific areas, or hospital management wants to view the incidence of surgical complications in real time. Traditional methods require multiple steps such as scheduling, coding, testing, and deployment, while this method allows users to directly complete the logic definition in the configuration interface and initiate interface creation requests without writing code, thus improving response speed.
[0030] Step 102: Construct a request mapping information object based on the interface configuration information through the request mapping processor, associate the request mapping information object with a preset unified processing method, use the preset unified processing method as the processing method of the request mapping information object, and register the mapping relationship between the request mapping information object and the corresponding processing method in the routing table.
[0031] Secondly, a `RequestMappingInfo` object (i.e., a request mapping information object) is dynamically constructed based on the aforementioned interface configuration information through the request mapping handler, and bound to a pre-defined unified processing method. This unified processing method is a pre-implemented generic controller method of the system, which may have capabilities such as parameter parsing, permission verification, logging, and exception handling. Subsequently, this mapping relationship is registered in the Spring MVC routing table (i.e., `RequestMappingHandlerMapping`), so that subsequent accesses to this URL can be correctly routed to this generic method. This mechanism fully reuses the dynamic extension capabilities of the Spring framework, avoiding the need to write separate controller layer code for each query.
[0032] Step 103: Create a query statement encapsulation object based on the query statement, assign a unique identifier to the query statement encapsulation object, and associate the unique identifier with the request mapping information object so that when the request mapping information object is invoked, the query statement of the query statement encapsulation object corresponding to the unique identifier is executed through the preset unified processing method.
[0033] Finally, the received query statement is parsed by MyBatis' XMLLanguageDriver, generating a SqlSource object, which is further encapsulated into a MappedStatement (query statement encapsulation object), and assigned a globally unique ID (e.g., "dynamic.query.12345"). This unique identifier is associated with the request mapping information object created in the previous step. When the dynamic interface is called externally, the unified processing method finds the corresponding unique identifier based on the request context, and then retrieves the corresponding MappedStatement from MyBatis' Configuration and executes the query. Because it is based on MyBatis' native mechanism, this solution naturally supports advanced features such as dynamic SQL, parameter binding, and result mapping, allowing medical developers to use their familiar SQL writing habits without learning new syntax. On the one hand, through visual configuration and dynamic registration mechanisms, the development cycle, which originally took days or even weeks, is compressed to minutes, enabling real-time responses to data needs from clinical, management, and research perspectives. On the other hand, relying on the Spring and MyBatis ecosystems to achieve non-intrusive integration ensures system stability and technical compatibility, while improving security and maintainability.
[0034] Optionally, in this embodiment of the application, the step of creating a query statement encapsulation object based on the query statement includes: parsing the query statement through a language-driven component to obtain a query statement executable object corresponding to the query statement; creating a standard encapsulation object and writing the query statement executable object into the standard encapsulation object to achieve standardized encapsulation of the query statement.
[0035] The query statement is parsed and structured using a language-driven component (such as XMLLanguageDriver in MyBatis) to generate an executable object (e.g., SqlSource or BoundSql) corresponding to the query statement. This executable object contains parameter mappings, dynamic SQL parsing results, and metadata required for execution. Subsequently, a standard encapsulation object (such as a lightweight encapsulation of MappedStatement or a custom query description class) is created, and the aforementioned executable object is written into it, thus achieving standardized, reusable, and manageable encapsulation of the original query statement. This process not only preserves the native data access framework's full support for complex SQL (such as conditional branches, loops, and nested queries), but also...
[0036] By applying the technical solution of this embodiment, a creation request containing interface configuration information and query statements is received. A request mapping processor dynamically constructs route mappings and binds them to unified processing logic. Simultaneously, the query statements are encapsulated as uniquely identified objects and associated with routes. This allows for the instant generation and invocation of interfaces without writing repetitive code. This embodiment integrates the capabilities of the Spring and MyBatis frameworks, supporting visual configuration, dynamic SQL execution, and access control. It shortens the development cycle, reduces labor costs, and improves the response speed to temporary medical data needs.
[0037] Optionally, in this embodiment of the application, the interface configuration information includes an access address and a specified request method; after step 103, the method further includes: Step 104: In response to a request operation on the access address, identify the target request method and target request parameters of the request operation, and determine whether the target request method matches the specified request method.
[0038] Step 105: If the target request method matches the specified request method, determine the target request mapping information object corresponding to the access address and the target unique identifier corresponding to the target request mapping information object. Obtain the target processing method corresponding to the target request mapping information object from the routing table. Use the target processing method to execute the query statement of the query statement encapsulation object corresponding to the target unique identifier based on the target request parameters, and return the query result as a response.
[0039] Step 106: If the target request method does not match the specified request method, output a message indicating that the target request method is not allowed.
[0040] In the above embodiments, the interface configuration information includes an access address (e.g., / api / v1 / patient / records) and a specified request method (e.g., GET or POST), used to define the calling specifications of the dynamic query interface. After associating the unique identifier of the query statement encapsulation object with the request mapping information object, when a request operation to the access address is received, the target request method of the request (e.g., the client actually sends POST) and its target request parameters are first identified; then, the target request method is compared with the specified request method preset in the interface configuration. If the two match (e.g., configured as GET and the actual request is also GET), the corresponding target request mapping information object is located according to the access address, and its associated target unique identifier is extracted from it; next, the unified processing method (i.e., the target processing method) bound to the mapping object is obtained from the routing table, the target request parameters are parsed by the method, the query statement encapsulation object corresponding to the target unique identifier is dynamically loaded, and the query logic within it is executed. Finally, the query results returned by the database are structured and returned to the caller as an HTTP response. For example, a department securely retrieves test reports via GET / api / v1 / lab / results?patientId=123. The system ensures that only read operations are allowed to prevent data risks caused by misuse of write methods. Conversely, if the target request method does not match the specified request method (e.g., the interface is configured to only allow GET, but the client incorrectly uses DELETE), the illegal request will be immediately blocked, and a standardized error message "Target request method not allowed" (e.g., HTTP 405 Method Not Allowed) will be returned. This effectively enhances the security, standardization, and robustness of the interface. Overall, this mechanism not only ensures that dynamic interfaces adhere to strict access control policies while being flexibly generated, but also provides crucial protection for compliant access to medical data, preventing data leaks or system anomalies caused by method abuse.
[0041] Optionally, in this embodiment, the query statement includes at least one query type and the query range of each query type; the step of using the target processing method to execute the query statement encapsulation object corresponding to the target unique identifier based on the target request parameters, and returning the query result as a response, includes: parsing the target query parameters of each query type in the target request parameters, and verifying whether the target query parameter is within the query range of the corresponding query type; if the verification result is yes, then using the target processing method to execute the query statement encapsulation object corresponding to the target unique identifier based on the target query parameters, and returning the query result corresponding to the target query parameter as a response.
[0042] In the above embodiments, the query statement includes specific SQL logic, as well as at least one structured query type (such as "query by patient ID", "statistics by time range", "grouping and summarizing by department") and the allowed query range for each query type (e.g., the time range is limited to the last 30 days, the patient age range is 0-120 years, and the department code must belong to a preset whitelist). During the execution phase, when the target processing method is called, it first parses the specific parameter values in the target request parameters corresponding to each query type (e.g., patientId=1001, startDate=2025-01-01, deptCode=CARDIOLOGY), and verifies item by item whether these target query parameters fall within the legal query range specified by their respective query type. If all parameters pass the verification (i.e., the verification result is "yes"), the query logic in the query statement encapsulation object corresponding to the unique identifier is allowed to continue execution, and the query results generated based on these controlled parameters are returned as a response; otherwise, if any parameter exceeds the preset range (e.g., requesting to query data for future dates or accessing information from unauthorized departments), execution is refused and a security error message is returned. This mechanism prevents invalid, unauthorized, or high-risk queries (such as full table scans or batch export of sensitive data) caused by malicious or accidental operations. On the other hand, it ensures that all dynamic queries always operate under the constraints of business rules and data governance strategies, thereby improving system security and stability while meeting the stringent requirements for compliance, minimum necessity principle, and privacy protection in the use of medical data.
[0043] Furthermore, as a refinement and extension of the specific implementation of the above embodiments, and to fully illustrate the specific implementation process of this embodiment, another method for dynamically creating query interfaces is provided, such as... Figure 2A As shown, the method includes: Step 201: Receive a query interface modification request, wherein the query interface modification request includes modifying the interface access address and interface modification information; Step 202: Determine the request mapping information object to be modified based on the modified interface access address, and obtain the unique identifier corresponding to the request mapping information object to be modified as the unique identifier to be modified; Step 203: Parse the interface modification information, and modify the request mapping information object to be modified and / or the query statement encapsulation object corresponding to the unique identifier to be modified based on the parsing result of the interface modification information.
[0044] Specifically, modifying the request mapping information object to be modified and / or the query statement encapsulation object corresponding to the unique identifier to be modified based on the parsed interface modification information includes: if the parsing result includes interface configuration modification information, then modifying the request mapping information object to be modified based on the interface configuration modification information; if the parsing result includes query modification information, then parsing the query statement in the query statement encapsulation object to be modified and the query modification information through a language-driven component to obtain a parsed query statement executable object, and updating the query statement encapsulation object to be modified based on the parsed query statement executable object; wherein, the query modification information includes at least one of query type modification information and query range modification information.
[0045] This application further implements flexible, secure, and non-intrusive modification capabilities for existing interfaces, making it particularly suitable for typical scenarios in the healthcare field where data requirements are frequently adjusted, query logic is optimized, or compliance changes are responded to. First, a query interface modification request is received. This request can be initiated by a qualified medical information administrator or business analyst through a visual management platform, containing the access address of the interface to be modified (e.g., / api / v1 / patient / chronic / stats) and specific interface modification information. This modification information may involve adjustments at the interface level (e.g., changing the request method from GET to POST, adding new request parameter validation rules, changing access permission roles, etc.), or it may include changes to the query logic itself (e.g., expanding the original statistical range from "last 30 days" to "last 90 days," or adding a dimension grouped by "medical insurance type"). Second, based on the provided modified interface access address, the corresponding request mapping information object to be modified is located in the registered routing table, and its associated unique identifier (i.e., the unique identifier to be modified) is extracted from it. Finally, the interface modification information is structured and parsed, and relevant components are selectively updated based on the parsing results: if the parsing results contain interface configuration modification information (such as new request methods, parameter formats, or authentication strategies), the corresponding fields of the request mapping information object to be modified are directly updated, thereby dynamically adjusting its routing behavior and security strategy; if the parsing results contain query modification information (for example, adding "diabetes" as a chronic disease type filtering condition, or correcting the age query range from 0–100 years to 0–120 years), the language-driven component (such as MyBatis' XMLLanguageDriver) is called to merge and parse the original query statement and the modified content, generating a new query statement executable object (such as the updated SqlSource or BoundSql), which replaces the original execution logic in the query statement encapsulation object to be modified. The query modification information can be further refined into query type modification (such as expanding from "single patient query" to "patient queue batch query") and query range modification (such as time window, geographical restrictions, data anonymization rules, etc.), making the modification process both flexible and controlled. This enables zero-code online iteration, allowing business personnel to independently optimize data interfaces and shorten the cycle from requirement submission to implementation.
[0046] Optionally, in this embodiment of the application, the method further includes: A visual interface is created; wherein the visual interface provides a query interface creation component and a query interface modification component; the query interface creation component is used to receive the input interface configuration information and query statement, and to generate a query interface creation request based on the input interface configuration information and query statement; the query interface modification component is used to receive the input modified interface access address and interface modification information, and to generate a query interface modification request based on the input modified interface access address and interface modification information. The visualization interface is configured with an automated query interface creation program so that the automated query interface creation program is triggered when the visualization interface generates a query interface creation request; wherein, the automated query interface creation program is used to construct a request mapping information object, register a routing table, create a query statement encapsulation object, and assign and associate unique identifiers for the query statement encapsulation objects; and, The visualization interface is configured with an automated query interface modification program so that the visualization interface triggers the execution of the automated query interface modification program when a query interface modification request is generated; wherein, the automated query interface modification program is used to determine the request mapping information object to be modified, parse the interface modification information, and modify the request mapping information to be modified and the encapsulated object of the query statement to be modified.
[0047] In this embodiment, a visual interface can be pre-created, providing a query interface creation component and a query interface modification component. The query interface creation component provides users with an intuitive UI to input interface configuration information (such as request methods, paths, parameters, etc.) and query statements (SQL or other forms). This information is used to generate a query interface creation request. This design allows non-technical users to participate in the interface creation process, lowering the technical barrier. The query interface modification component is used to modify the interface, allowing users to input the access address of a specific interface and the desired modifications (including but not limited to adjustments to interface configuration or query logic). This facilitates rapid response to changes in business needs. After creating the visual interface, an automated query interface creation program and an automated query interface modification program can be associated with it. Once the automated query interface creation program is associated, it will trigger execution once the query interface creation component on the visual interface receives the user-entered information and generates a query interface creation request. The automated query interface creation program is used to automate the method of dynamically creating query interfaces described above. It mainly includes: constructing request mapping information objects: automatically constructing request mapping information objects that can be recognized by the server based on the interface configuration information provided by the user; registering the routing table: adding the newly created interface to the system's routing table to ensure it can be correctly routed and processed; creating query statement encapsulation objects: generating corresponding query statement encapsulation objects based on the query statement input by the user; assigning and associating unique identifiers: assigning a unique identifier to each query statement encapsulation object and associating it with the request mapping information object for subsequent management and invocation. After the automated query interface modification program is associated, when modifications to an existing interface are needed, the user submits a modification request through the query interface modification component, triggering the automated query interface modification program. This program is used to automate the method of modifying query interfaces described above. It mainly includes: determining the request mapping information object to be modified: finding the corresponding request mapping information object from the registered routing table based on the modified interface access address provided by the user; parsing the interface modification information: analyzing the user-specified modification content to understand which parts need to be updated; and performing modification operations: adjusting the selected request mapping information object and / or its associated query statement encapsulation object according to the parsing results. The creation and maintenance of interfaces become more intuitive and efficient through visual interfaces and automated processes.
[0048] In a specific application scenario, such as Figure 2B The image shows a dynamic interface registration process based on Spring + MyBatis.
[0049] Step 1: Application startup triggers initialization. After JarvisDataServiceApplication starts, it sends an init message to DynamicDataApiManager to initiate the dynamic interface registration process.
[0050] Step 2: Query API Configuration. DynamicDataApiManager calls the method of DataApiConfigServiceImpl to send a "Query API Configuration" message, requesting to obtain the configuration information of all dynamic APIs.
[0051] The returned results include: URL: the API access path (e.g., / api / v1 / patient / search); Input parameter configuration: request parameter definitions (e.g., patientId, startDate); Output parameter configuration: response field mapping; Executed SQL: the corresponding SQL query statement (e.g., SELECT). FROM patient WHERE id = #{patientId}).
[0052] Step 3: Construct the request mapping object. DynamicDataApiManager constructs a RequestMappingInfo object based on the returned configuration information. This object encapsulates routing information such as the URL, HTTP method, and parameters, in a format recognizable by Spring MVC.
[0053] Step 4: Register the controller. Register the constructed RequestMappingInfo into the RequestMappingHandlerMapping using the `register controller` message. This step essentially tells Spring, "There is now a new interface that can handle requests," ensuring that subsequent requests to the specified URL will be correctly routed to the unified processing logic (such as methods annotated with `@RequestMapping`).
[0054] Step 5: Construct the MappedStatement. DynamicDataApiManager uses SQL statements (from the configuration) to parse and construct MappedStatement objects through MyBatis' language-driven components (such as XMLLanguageDriver). MappedStatement is the core object in MyBatis representing an executable SQL statement, containing information such as the SQL text, parameter types, and result mappings.
[0055] Step 6: Register with MyBatis configuration. Add the constructed MappedStatement to the Configuration object, i.e., write it into the MyBatis global configuration context. This way, when the unified processing method calls SqlSession.selectList() or a similar method, it can find and execute this SQL based on a unique identifier (such as dynamic.query.patient.search).
[0056] Furthermore, as Figure 1 In terms of specific implementation of the method, this application provides a device for dynamically creating a query interface, such as... Figure 3 As shown, the device includes: The request receiving module is used to receive a query interface creation request, wherein the query interface creation request includes interface configuration information and query statement; The interface creation module is used to construct a request mapping information object based on the interface configuration information through the request mapping processor, associate the request mapping information object with a preset unified processing method, use the preset unified processing method as the processing method of the request mapping information object, and register the mapping relationship between the request mapping information object and the corresponding processing method in the routing table. The statement encapsulation module is used to create a query statement encapsulation object based on the query statement, assign a unique identifier to the query statement encapsulation object, and associate the unique identifier with the request mapping information object, so that when the request mapping information object is invoked, the query statement of the query statement encapsulation object corresponding to the unique identifier is executed through the preset unified processing method.
[0057] Optionally, in this embodiment of the application, the statement encapsulation module is specifically used for: The query statement is parsed using a language-driven component to obtain the corresponding query statement executable object; A standard encapsulation object is created, and the executable object of the query statement is written into the standard encapsulation object to achieve standardized encapsulation of the query statement.
[0058] Optionally, in this embodiment, the apparatus further includes a query module, used for: In response to a request operation to the access address, the target request method and target request parameters of the request operation are identified, and the target request method is determined based on whether it matches the specified request method. If the target request method matches the specified request method, then the target request mapping information object corresponding to the access address and the target unique identifier corresponding to the target request mapping information object are determined. The target processing method corresponding to the target request mapping information object is obtained from the routing table. The target processing method is used to execute the query statement of the query statement encapsulation object corresponding to the target unique identifier based on the target request parameters, and the query result is returned as a response. If the target request method does not match the specified request method, a message indicating that the target request method is not allowed will be output.
[0059] Optionally, in this embodiment of the application, the query statement includes at least one query type and the query range of each query type; the query module is further configured to: Parse the target query parameters for each query type in the target request parameters, and verify whether the target query parameters are within the query range of the corresponding query type; If the verification result is yes, then the target processing method is used to execute the query statement of the query statement encapsulation object corresponding to the target unique identifier based on the target query parameters, and the query result corresponding to the target query parameters is returned as a response.
[0060] Optionally, in this embodiment, the apparatus further includes: an interface modification module, used for: Receive a query interface modification request, wherein the query interface modification request includes modifying the interface access address and interface modification information; The request mapping information object to be modified is determined based on the modified interface access address, and the unique identifier corresponding to the request mapping information object to be modified is obtained as the unique identifier to be modified. The interface modification information is parsed, and the modification is performed on the request mapping information object to be modified and / or the query statement encapsulation object corresponding to the unique identifier to be modified based on the parsing result of the interface modification information.
[0061] Optionally, in this embodiment of the application, the interface modification module is specifically used for: If the parsing result includes interface configuration modification information, then the request mapping information object to be modified is modified based on the interface configuration modification information; If the parsing result includes query modification information, then the query statement and the query modification information in the encapsulated object of the query statement to be modified are parsed by the language-driven component to obtain the parsed query statement executable object, and the encapsulated object of the query statement to be modified is updated based on the parsed query statement executable object; wherein, the query modification information includes at least one of query type modification information and query range modification information.
[0062] Optionally, in this embodiment, the device further includes: a visual interface configuration module, used for: A visual interface is created; wherein the visual interface provides a query interface creation component and a query interface modification component; the query interface creation component is used to receive the input interface configuration information and query statement, and to generate a query interface creation request based on the input interface configuration information and query statement; the query interface modification component is used to receive the input modified interface access address and interface modification information, and to generate a query interface modification request based on the input modified interface access address and interface modification information. The visualization interface is configured with an automated query interface creation program so that the automated query interface creation program is triggered when the visualization interface generates a query interface creation request; wherein, the automated query interface creation program is used to construct a request mapping information object, register a routing table, create a query statement encapsulation object, and assign and associate unique identifiers for the query statement encapsulation objects; and, The visualization interface is configured with an automated query interface modification program so that the visualization interface triggers the execution of the automated query interface modification program when a query interface modification request is generated; wherein, the automated query interface modification program is used to determine the request mapping information object to be modified, parse the interface modification information, and modify the request mapping information to be modified and the encapsulated object of the query statement to be modified.
[0063] It should be noted that other corresponding descriptions of the functional units involved in the dynamic query interface creation device provided in this application embodiment can be found in the following references. Figure 1 The corresponding descriptions in the method shown in Figure 2 will not be repeated here.
[0064] This application also provides a computer device, which may specifically be a personal computer, a server, a network device, etc. Figure 4 As shown, the computer device includes a bus, a processor, memory, and a communication interface, and may also include an input / output interface and a display device. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database stores location information. The network interface allows communication with external terminals via a network connection. When the computer program is executed by the processor, it implements the steps in the various method embodiments.
[0065] Those skilled in the art will understand that Figure 4The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0066] In one embodiment, a computer-readable storage medium is provided, which may be non-volatile or volatile, having stored thereon a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0067] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0068] It should be noted that the user personal information involved in the embodiments of this application is all authorized (with the knowledge and consent) by the relevant parties or fully authorized by all parties, and the executing entity can obtain it through various legal and compliant means. The collection, storage, use, processing, transmission, provision, and disclosure of the information, data, and signals involved all comply with the relevant laws and regulations of the relevant countries and regions, and do not violate public order and good morals. It should be noted that if any software tools or components other than those of this company appear in the embodiments of this application, they are merely illustrative examples and do not represent actual use.
[0069] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, graphics processors, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0070] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0071] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for dynamically creating a query interface, characterized in that, The method includes: Receive a query interface creation request, wherein the query interface creation request includes interface configuration information and query statement; The request mapping processor constructs a request mapping information object based on the interface configuration information, associates the request mapping information object with a preset unified processing method, uses the preset unified processing method as the processing method of the request mapping information object, and registers the mapping relationship between the request mapping information object and the corresponding processing method in the routing table. A query statement encapsulation object is created based on the query statement, a unique identifier is assigned to the query statement encapsulation object, and the unique identifier is associated with the request mapping information object, so that when the request mapping information object is invoked, the query statement of the query statement encapsulation object corresponding to the unique identifier is executed through the preset unified processing method.
2. The method according to claim 1, characterized in that, The step of creating a query statement encapsulation object based on the query statement includes: The query statement is parsed using a language-driven component to obtain the corresponding query statement executable object; A standard encapsulation object is created, and the executable object of the query statement is written into the standard encapsulation object to achieve standardized encapsulation of the query statement.
3. The method according to claim 1, characterized in that, The interface configuration information includes an access address and a specified request method; after associating the unique identifier with the request mapping information object, the method further includes: In response to a request operation to the access address, the target request method and target request parameters of the request operation are identified, and the target request method is determined based on whether it matches the specified request method. If the target request method matches the specified request method, then the target request mapping information object corresponding to the access address and the target unique identifier corresponding to the target request mapping information object are determined. The target processing method corresponding to the target request mapping information object is obtained from the routing table. The target processing method is used to execute the query statement of the query statement encapsulation object corresponding to the target unique identifier based on the target request parameters, and the query result is returned as a response. If the target request method does not match the specified request method, a message indicating that the target request method is not allowed will be output.
4. The method according to claim 3, characterized in that, The query statement includes at least one query type and the query range for each query type; the step of using the target processing method to execute the query statement encapsulation object corresponding to the target unique identifier based on the target request parameters, and returning the query result as a response, includes: Parse the target query parameters for each query type in the target request parameters, and verify whether the target query parameters are within the query range of the corresponding query type; If the verification result is yes, then the target processing method is used to execute the query statement of the query statement encapsulation object corresponding to the target unique identifier based on the target query parameters, and the query result corresponding to the target query parameters is returned as a response.
5. The method according to any one of claims 1 to 4, characterized in that, The method further includes: Receive a query interface modification request, wherein the query interface modification request includes modifying the interface access address and interface modification information; The request mapping information object to be modified is determined based on the modified interface access address, and the unique identifier corresponding to the request mapping information object to be modified is obtained as the unique identifier to be modified. The interface modification information is parsed, and the modification is performed on the request mapping information object to be modified and / or the query statement encapsulation object corresponding to the unique identifier to be modified based on the parsing result of the interface modification information.
6. The method according to claim 5, characterized in that, The modification of the request mapping information object to be modified and / or the query statement encapsulation object corresponding to the unique identifier to be modified based on the parsed interface modification information includes: If the parsing result includes interface configuration modification information, then the request mapping information object to be modified is modified based on the interface configuration modification information; If the parsing result includes query modification information, then the query statement and the query modification information in the encapsulated object of the query statement to be modified are parsed by the language-driven component to obtain the parsed query statement executable object, and the encapsulated object of the query statement to be modified is updated based on the parsed query statement executable object; wherein, the query modification information includes at least one of query type modification information and query range modification information.
7. The method according to claim 5, characterized in that, The method further includes: A visual interface is created; wherein the visual interface provides a query interface creation component and a query interface modification component; the query interface creation component is used to receive the input interface configuration information and query statement, and to generate a query interface creation request based on the input interface configuration information and query statement; the query interface modification component is used to receive the input modified interface access address and interface modification information, and to generate a query interface modification request based on the input modified interface access address and interface modification information. The visualization interface is configured with an automated query interface creation program so that the automated query interface creation program is triggered when the visualization interface generates a query interface creation request; wherein, the automated query interface creation program is used to construct a request mapping information object, register a routing table, create a query statement encapsulation object, and assign and associate unique identifiers for the query statement encapsulation objects; and, The visualization interface is configured with an automated query interface modification program so that the visualization interface triggers the execution of the automated query interface modification program when a query interface modification request is generated; wherein, the automated query interface modification program is used to determine the request mapping information object to be modified, parse the interface modification information, and modify the request mapping information to be modified and the encapsulated object of the query statement to be modified.
8. A device for dynamically creating query interfaces, characterized in that, The device includes: The request receiving module is used to receive a query interface creation request, wherein the query interface creation request includes interface configuration information and query statement; The interface creation module is used to construct a request mapping information object based on the interface configuration information through the request mapping processor, associate the request mapping information object with a preset unified processing method, use the preset unified processing method as the processing method of the request mapping information object, and register the mapping relationship between the request mapping information object and the corresponding processing method in the routing table. The statement encapsulation module is used to create a query statement encapsulation object based on the query statement, assign a unique identifier to the query statement encapsulation object, and associate the unique identifier with the request mapping information object, so that when the request mapping information object is invoked, the query statement of the query statement encapsulation object corresponding to the unique identifier is executed through the preset unified processing method.
9. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 7.
10. A computer device, comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method of any one of claims 1 to 7.