Short message generation method and device, equipment, medium and product

By using the correlation between each data table in the database, dynamically read data from the database and generate SMS content, the problem of SMS generation in the prior art relying on predefined data items is solved, and the flexibility and diversity of SMS templates are realized.

CN119829570AActive Publication Date: 2025-04-15CHINA CONSTRUCTION BANK +1
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411742111.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-29
Publication Date
2025-04-15
Estimated Expiration
2044-11-29

AI Technical Summary

Technical Problem

The existing SMS generation methods rely on predefined data items and parsing interfaces, resulting in the generated SMS content being limited and cannot flexibly adapt to changes in the database data structure.

Method used

Through the association relationship between each data table in the database, the data content that can be used in the SMS template is expanded, data can be read dynamically from the database, and SMS content is generated. The specific methods include obtaining the SMS template, analyzing and extracting the query field information, generating query statements based on the query field information, querying the database, parsing and extracting the field data, and converting the format and replacing the placeholder in the SMS template.

Benefits of technology

It realizes the flexibility and diversity of SMS templates, can adapt to changes in database data structures, supports more complex queries and data combinations, and generates personalized and customized SMS content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119829570A_ABST
    Figure CN119829570A_ABST
Patent Text Reader

Abstract

The invention provides a short message generation method and device, equipment, a medium and a product. Relates to the technical field of data analysis. The method comprises the following steps: acquiring a short message template, and extracting query field information from the short message template; obtaining at least one query field and a query table where each query field is located from the query field information; dividing the plurality of query tables into at least one association table pair according to preset relation information of a database; generating a query statement according to the at least one association table pair and the query field, and querying from a database according to the query statement to obtain query result data; extracting field data corresponding to the query field information from the query result data; and replacing the query field information in the short message template with the field data in the preset format according to the second position of the query field information in the short message template to obtain the short message content. According to the method provided by the invention, the available data content in the short message template is expanded through the association relationship among the data tables in the database.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data analysis technology, and in particular to a method, device, equipment, medium and product for generating short messages. Background Art

[0002] The technology of filling SMS templates based on data in a database to automatically generate SMS content has become widely popular.

[0003] In the prior art, it is usually necessary to predefine data items and data usage, and set up a parsing interface for the data items in the background of the SMS generation system. Then, the SMS template is written based on these predefined data items. Finally, the SMS generation system reads the corresponding data from the database by calling the background parsing interface to replace the data items in the SMS template, thereby generating a SMS.

[0004] However, in the existing SMS generation method, the setting of the SMS template depends on predefined data items, resulting in restrictions on the content of the generated SMS. Summary of the invention

[0005] The present application provides a method, device, equipment, medium and product for generating a short message, which are used to expand the data content that can be used in a short message template through the association relationship between data tables in a database.

[0006] In a first aspect, the present application provides a method for generating a text message, the method comprising:

[0007] Acquire a short message template, parse the short message template, identify a target identifier from the short message template to extract the target identifier, determine a first position of the target identifier in the short message template, extract query field information from the short message template according to the target identifier and the first position, and associate a second position of the query field information with the first position of the target identifier;

[0008] Acquire at least one query field and the query table where each query field is located from the query field information;

[0009] If the number of query tables is greater than or equal to 2, the multiple query tables are divided into at least one associated table pair according to the preset relationship information of the database. When there are at least two associated table pairs, the at least two associated table pairs can be associated into a virtual table. Each associated table pair consists of two query tables and / or a query table and another data table other than the query table. The preset relationship information is used to indicate the association relationship between fields and tables in the database.

[0010] Generate a query statement according to at least one associated table pair and a query field, and query the database to obtain query result data according to the query statement;

[0011] Parse the query result data, determine the field data corresponding to the query field information from the query result data, and extract the field data;

[0012] Verify the data format of the field data, and if the data format is inconsistent with the preset format, convert the data format of the field data into the preset format to obtain the field data in the preset format;

[0013] According to the second position of the query field information in the SMS template, the query field information in the SMS template is replaced with field data in a preset format to obtain SMS content.

[0014] In a possible design, multiple query tables are divided into at least one associated table pair according to preset relationship information of the database, including:

[0015] Acquire at least one first association table of each query table from the preset relationship information;

[0016] Determine at least one first association group from the plurality of query tables according to each first association table, each first association group being one of the following: a single query table, a table pair, a table group, the single query table not existing in the first association table of any query table, one query table in the table pair being the first association table of another query table in the table pair, and the first association table in the table group being the same first association table of two query tables in the table group;

[0017] An association table pair is extracted from at least one first association group.

[0018] In one possible design, extracting an association table pair from at least one first association group includes:

[0019] Treat each table pair as an associated table pair, and split each table group into two associated table pairs;

[0020] Take the first association group as the current association group and perform the relationship iteration process multiple times:

[0021] Merging at least two current association groups including the same data table into a second association group;

[0022] If there is a second association group, stop extracting the association table pairs;

[0023] If there are multiple second association groups, at least one second association table of each data table in each second association group is determined, and at least one third association group is determined from the multiple second association groups according to each second association table, and the third association group is used as the current association group, each third association group is one of the following: a single second association group, a group pair, or a group, wherein the first data table of one second association group in the group pair is the second association table of the second data table of another second association group in the group pair, and the second association table in the group group is the same second association table of the third data tables of two second association groups in the group group;

[0024] The first data table and the second data table are taken as an association table pair, and two association table pairs are generated according to the third data tables of two second association groups in the group and the same second association table.

[0025] In a possible design, generating a query statement according to at least one associated table pair and a query field includes:

[0026] Parse the preset relationship information to obtain the relationship between the two data tables in the association table pair;

[0027] According to the association relationship, determine the association fields between the two data tables in the association table pair;

[0028] Generate query statements based on query fields, associated fields, and associated table pairs.

[0029] In a possible design, after generating the query statement, the method further includes:

[0030] Optimize query statements by creating composite indexes.

[0031] In a possible design, the process of generating a text message template includes:

[0032] Display preset relationship information;

[0033] Receiving query field information selected by the user from the preset relationship information;

[0034] Generate SMS template based on query field information.

[0035] In a possible design, a text message template is generated according to the query field information, including:

[0036] Receive text information input by a user, the text information including an insertion position of query field information, the insertion position being a second position;

[0037] Generate SMS template based on text information and query field information.

[0038] In a second aspect, the present application provides a text message generating device, comprising:

[0039] an acquisition module, configured to acquire a short message template, parse the short message template, identify a target identifier from the short message template to extract the target identifier, determine a first position of the target identifier in the short message template, and extract query field information from the short message template according to the target identifier and the first position, wherein a second position of the query field information is associated with the first position of the target identifier;

[0040] A query table module, used for obtaining at least one query field and a query table where each query field is located from the query field information;

[0041] An association table pair module, for dividing the multiple query tables into at least one association table pair according to preset relationship information of the database if the number of query tables is greater than or equal to 2, when there are at least two association table pairs, the at least two association table pairs can be associated into a virtual table, each association table pair is composed of two query tables, and / or, is composed of a query table and other data tables other than a query table, and the preset relationship information is used to indicate the association relationship between fields and tables in the database;

[0042] A query module, used to generate a query statement according to at least one associated table pair and a query field, and query the database to obtain query result data according to the query statement;

[0043] An extraction module is used to parse the query result data, determine the field data corresponding to the query field information from the query result data, and extract the field data;

[0044] The format conversion module is used to verify the data format of the field data, and if the data format is inconsistent with the preset format, convert the data format of the field data into the preset format to obtain the field data in the preset format;

[0045] The replacement module is used to replace the query field information in the SMS template with field data in a preset format according to the second position of the query field information in the SMS template to obtain SMS content.

[0046] In one possible design, the association table pair module includes: a first association table module, a first association group module and an association table pair module;

[0047] A first association table module, used to obtain at least one first association table of each query table from preset relationship information;

[0048] A first association group module, used for determining at least one first association group from a plurality of query tables according to each first association table, each first association group being one of the following: a single query table, a table pair, a table group, a single query table not existing in a first association table of any query table, a query table in a table pair being a first association table of another query table in the table pair, and a first association table in a table group being a same first association table of two query tables in the table group;

[0049] The module for extracting association table pairs is used to extract association table pairs from at least one first association group.

[0050] In a possible design, the module for extracting association table pairs includes: a first confirmation module, an iteration module; wherein the iteration module includes: a second association group module, a stop extraction module, a third association group module and a second confirmation module;

[0051] A first confirmation module, used for treating each table pair as an associated table pair and splitting each table group into two associated table pairs;

[0052] The iteration module is used to take the first association group as the current association group and perform the relationship iteration process multiple times:

[0053] A second association group module, configured to merge at least two current association groups including the same data table into a second association group;

[0054] A stop extraction module, used for stopping the extraction of association table pairs if there is a second association group;

[0055] a third association group module, for determining, if there are multiple second association groups, at least one second association table of each data table in each second association group, and determining at least one third association group from the multiple second association groups according to each second association table, and using the third association group as the current association group, wherein each third association group is one of the following: a single second association group, a pair, or a group, wherein a first data table of one second association group in the pair is a second association table of a second data table of another second association group in the pair, and a second association table in the group is a same second association table of third data tables of two second association groups in the group;

[0056] The second confirmation module is used to regard the first data table and the second data table as an association table pair, and to generate two association table pairs according to the third data tables of two second association groups in the group and the same second association table.

[0057] In a possible design, the query module includes: a parsing module, an association field module and a query statement module;

[0058] A parsing module, used to parse the preset relationship information to obtain the association relationship between the two data tables in the association table pair;

[0059] The association field module is used to determine the association fields between two data tables in the association table pair according to the association relationship;

[0060] The query statement module is used to generate query statements based on query fields, associated fields and associated table pairs.

[0061] In a possible design, the SMS generating device further includes: an optimization module:

[0062] The optimization module is used to optimize query statements by creating composite indexes.

[0063] In a possible design, the SMS generating device further includes a display module, a receiving module and a first generating module;

[0064] A display module, used for displaying preset relationship information;

[0065] A receiving module, used to receive query field information selected by a user from preset relationship information;

[0066] The first generating module is used to generate a short message template according to the query field information.

[0067] In one possible design, the first generation module includes: an input module and a second generation module;

[0068] An input module, used to receive text information input by a user, wherein the text information includes an insertion position of query field information;

[0069] The second generating module is used to generate a short message template according to the text information and the query field information.

[0070] In a third aspect, the present application provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor;

[0071] Memory stores computer-executable instructions;

[0072] The processor executes the computer execution instructions stored in the memory to implement a method for generating short messages according to the first aspect of the invention.

[0073] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, a method for generating text messages is implemented as described in the first aspect of the invention.

[0074] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, is used to implement a method for generating text messages as described in the first aspect of the invention.

[0075] The present application provides a method, device, equipment, medium and product for generating short messages, the method comprising: obtaining a short message template, parsing the short message template, identifying a target identifier from the short message template to extract the target identifier, and determining a first position of the target identifier in the short message template, and extracting query field information from the short message template according to the target identifier and the first position, wherein the second position of the query field information is associated with the first position of the target identifier; obtaining at least one query field and a query table where each query field is located from the query field information; if the number of query tables is greater than or equal to 2, dividing the multiple query tables into at least one associated table pair according to preset relationship information of the database, and when there are at least two associated table pairs, the at least two associated table pairs can be associated into a virtual table, and each associated table pair consists of two The method comprises the steps of: comprising: forming a query table, and / or forming a query table and other data tables other than the query table, wherein the preset relationship information is used to indicate the association relationship between fields and tables in the database; generating a query statement according to at least one association table pair and a query field, and obtaining query result data from the database according to the query statement; parsing the query result data, determining the field data corresponding to the query field information from the query result data, and extracting the field data; verifying the data format of the field data, and converting the data format of the field data into the preset format when the data format is inconsistent with the preset format, and obtaining the field data in the preset format; replacing the query field information in the SMS template with the field data in the preset format according to the second position of the query field information in the SMS template, and obtaining the SMS content.The following technical effects are achieved: by means of the association relationship between the data tables in the database, the data content that can be used in the SMS template is expanded, so that all the fields in the database can be used in the SMS template, and it is no longer limited to reading data from the database according to pre-defined data items and parsing interfaces; by making multiple associated table pairs have an association relationship, all associated table pairs in the database can be directly or indirectly associated with each other, that is, by associating at least two associated table pairs into a virtual table, it is convenient to generate query statements, so as to query the database to obtain query result data; according to the query statement, data is dynamically read from the database, and even if the data structure in the database changes, through the association relationship between the data tables in the database, the server can still accurately obtain the query result data according to the query statement, so that it can still Generate SMS correctly; by utilizing the association between data tables in the database, more complex queries and data combinations can be supported. For example, more personalized and customized SMS content can be generated based on the user's transaction history, preferences and other information; by introducing query field information in the SMS template, the SMS content can be dynamically generated according to the actual situation, making the SMS template more flexible and able to adapt to different data content without the need to manually write static text for each possible SMS content; by filling the query field information in the placeholder of the SMS template, when writing the SMS template, it is possible to flexibly reference the data in the database as needed, so that the generated SMS content is no longer limited to pre-defined data items, thereby overcoming the limitations of the existing technology in SMS generation and providing a more flexible and efficient solution for SMS communication. BRIEF DESCRIPTION OF THE DRAWINGS

[0076] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0077] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0078] Figure 1 A flow chart of a method for generating a short message provided in an embodiment of the present application Figure 1 ;

[0079] Figure 2 A flow chart of a method for generating a short message provided in an embodiment of the present application Figure 2 ;

[0080] Figure 3 A schematic diagram of an association relationship between fields provided in an embodiment of the present application;

[0081] Figure 4 A schematic diagram of the structure of a text message generating device provided in an embodiment of the present application;

[0082] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0083] Reference numerals:

[0084] 410 - acquisition module; 420 - query table module; 430 - association table pair module; 440 - query module; 450 - extraction module; 460 - format conversion module; 470 - replacement module;

[0085] 510 - processor; 520 - memory; 530 - communication component; 540 - bus. DETAILED DESCRIPTION

[0086] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0087] In the embodiments of the present application, words such as "first" and "second" are used to distinguish between identical or similar items with substantially the same functions and effects. Those skilled in the art will appreciate that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit the difference. It should be noted that in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way. In the embodiments of the present application, "at least one" refers to one or more, and "more" refers to two or more.

[0088] It should be noted that the "at..." in the embodiment of the present application can be the instant when a certain situation occurs, or can be a period of time after a certain situation occurs, and the embodiment of the present application does not specifically limit this. In addition, the text message generation method provided in the embodiment of the present application is only used as an example, and the text message generation method can also include more or less content.

[0089] In the technical solution of this application, the collection, storage, use, processing, transmission, provision and disclosure of information such as financial data or user data involved shall comply with the provisions of relevant laws and regulations and shall not violate public order and good morals.

[0090] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.

[0091] In modern communications, SMS is a fast, direct and popular way of information transmission, and is widely used in various scenarios. The technology of filling SMS templates based on data in the database and automatically generating SMS content through the SMS generation system has become an important means to improve communication efficiency.

[0092] In the existing SMS generation method, it is necessary to determine in advance the data items that need to be displayed in the SMS, such as user name, order number, and product name, based on actual needs. And in the background of the SMS generation system, set up corresponding parsing interfaces for these data items to facilitate reading the corresponding data from the database. Then, based on these predefined data items, write SMS templates, which usually contain placeholders to be replaced by actual data later. Finally, the SMS generation system calls the background parsing interface based on the data items in the SMS template, reads the corresponding data from the database, and replaces the placeholders in the template to generate the final SMS content.

[0093] However, the existing technology has the following limitations:

[0094] First, data content is limited: Since the setting of SMS templates depends on predefined data items, the generated SMS content is limited by these predefined data items. Only limited data in the database can be used to generate SMS content, and data corresponding to undefined data items cannot be selected. When more diverse data needs to be displayed, data items and parsing interfaces need to be reset, which increases the complexity of SMS generation system development and maintenance.

[0095] Secondly, lack of flexibility: when the data structure in the database changes, such as adding new data tables or data fields, the existing SMS templates and parsing interfaces cannot directly adapt to these changes, resulting in SMS generation failure or inaccurate content, thereby limiting the flexibility and diversity of the generated SMS content.

[0096] Based on this, the embodiment of the present application provides a method, device, equipment, medium and product for generating short messages, which can be used in the field of data analysis technology, and is intended to solve the above technical problems of the prior art. When using the short message template, a query statement is generated according to the association relationship between the fields in the database, and the association relationship between the pre-set fields and the data table, so that the query statement is used to query the database to obtain the query result data, and the short message content is generated according to the query result data. In this way, through the association relationship between the data tables in the database, the data content that can be used in the short message template is expanded, so that all the fields in the database can be used in the short message template, so that it is no longer necessary to read data from the database according to the pre-defined data items and parsing interface, but dynamically read data from the database according to the query statement. In this way, even if the data structure in the database changes, according to the query statement, the short message generation system can still correctly generate short messages. Moreover, due to the use of the data association relationship in the database, the method in the embodiment of the present application can support more complex queries and data combinations. For example, more personalized and customized short message content can be generated according to the user's transaction history, preferences and other information. Secondly, when writing the short message template, the method in the embodiment of the present application can flexibly reference the data in the database as needed. So that the generated short message content is no longer limited to the pre-defined data items. It overcomes the limitations of existing technologies in SMS generation and provides a more flexible and efficient solution for SMS communication.

[0097] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0098] According to the content of the first aspect of the present application, this embodiment discloses a method for generating a text message.

[0099] Figure 1 A flow chart of a method for generating a short message provided in an embodiment of the present application Figure 1 .like Figure 1 As shown, the method includes:

[0100] S101, obtaining a text message template, parsing the text message template, identifying a target identifier from the text message template to extract the target identifier, determining a first position of the target identifier in the text message template, and extracting query field information from the text message template according to the target identifier and the first position.

[0101] In an embodiment of the present application, the execution entity of the SMS generation method can be a server, which can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server, etc., and no specific restrictions are made here.

[0102] The server may store a short message template in advance. When the server automatically generates a short message, the short message template may be obtained from the server's storage, and query field information may be extracted from the short message template. The query field information is used to indicate the type of field data to be filled in the short message template and the type of data table where the field data to be filled in the short message template is located. In addition, the query field information may also include field data that can be provided externally by the database and the data table where it is located.

[0103] In a possible implementation, the process of generating a text message template includes: displaying preset relationship information; receiving query field information selected by a user in the preset relationship information; and generating a text message template according to the query field information.

[0104] Specifically, in a database, preset relationship information is used to indicate the association between fields and tables in the database. A table refers to a data table stored in the database, and a field refers to specific field data in the data table. The server can provide a user with an interface and / or application programming interface (API) that can be displayed and operated. Through the interface and / or API, the server can display the association between fields and tables in the database to the user, and receive the query field information selected by the user from the preset relationship information. Thus, a text message template is generated based on the query field information.

[0105] Further, generating a short message template according to the query field information includes: receiving text information input by a user, the text information including an insertion position of the query field information; generating a short message template according to the text information and the query field information. That is, the server receives the text information input by the user through the operation interface and / or API, and then can generate a short message template according to the text information and the query field information.

[0106] The specific SMS template can be as follows: "Dear ${cust.custname}, your order ${ordr.orderid} amount: ${sum(ordr.payamount)} has not been completed, please complete the transaction in time". Among them, the identified target identifier is ${}, ${} can specifically represent a placeholder, and the information filled in the placeholder ${} is the query field information. ${cust.custname} represents the customer's name in the customer table. The front part cust refers to the customer table, and the back part custname refers to the customer's name. This position will be replaced by the actual customer name; ${ordr.orderid} represents the order number in the order table. The front part ordr refers to the order table, and the back part orderid refers to the order number. This position will be replaced by the actual order number; ${sum(ordr.payamount)} represents the total amount of the orders in the order table, where sum is a summation function used to calculate the total amount of the order, ordr refers to the order table, and payamount refers to the amount of the order. This position will be replaced by the actual amount value. For example, if the customer's name is Zhang San, the order number is 123456, and the total amount of the order is 200 yuan, then the content of the final SMS sent will be:

[0107] "Dear Zhang San, your order 123456 amount: 200 has not been completed, please complete the transaction in time."

[0108] Specifically, the server can parse the obtained SMS template to find the target identifier. This can be achieved through regular expressions or other string matching technologies. For example, if the target identifier is in the form of double curly brackets (such as {{name}}, indicating that the user's name needs to be queried), then the regular expression {{(.*?)}} can be used to match all target identifiers.

[0109] After the target identifier is identified from the SMS template, the target identifier can be extracted, and the first position of the target identifier in the SMS template can be determined, as well as the query field information corresponding to the target identifier. Since the second position of the query field information is associated with the first position of the target identifier, the query field information can be extracted from the SMS template based on the target identifier and the first position. For example, the target identifier can be a placeholder ${}, so the query field information filled in each placeholder ${} can be determined based on the placeholder ${}.

[0110] This embodiment introduces query field information into the SMS template so that the SMS content can be dynamically generated according to the actual situation, thereby making the SMS template more flexible and adaptable to different data contents without manually writing static text for each possible SMS content.

[0111] S102: Acquire at least one query field and a query table where each query field is located from the query field information.

[0112] Specifically, the server may determine the query field and the query table where each query field is located from each query field information of the SMS template.

[0113] Specifically, the query field information may be cust.custname (customer name in the customer table), ordr.orderid (order number in the order table), and sum(ordr.payamount) (the total amount of the orders in the order table) in the above embodiment.

[0114] The query fields are custname (user name), orderid (order number), and payamount (order amount).

[0115] The query table where the query field custname is located is cust (customer table), and the query tables where the query fields orderid and payamount are located are both ordr (order table).

[0116] S103: If the number of query tables is greater than or equal to 2, divide the multiple query tables into at least one associated table pair according to preset relationship information of the database.

[0117] Specifically, when there are at least two associated table pairs, the at least two associated table pairs can be associated into a virtual table, and each associated table pair consists of two query tables and / or a query table and another data table other than the query table.

[0118] By associating multiple associated table pairs, all associated table pairs in the database can be directly or indirectly associated with each other. That is, by associating at least two associated table pairs into a virtual table, it is easy to generate query statements, thereby querying the database to obtain query result data.

[0119] If there is only one association table pair, a query statement can be directly generated according to the two query tables in the association table pair.

[0120] Specifically, the preset relationship information can be represented by the symbol <->. Specifically, the symbol <-> represents a bidirectional association, that is, in the database, the field on the right side of the symbol <-> can be found from the field on the left side of the symbol <->, and the field on the left side of the symbol <-> can also be found from the field on the right side of the symbol <->. For example, in the above cust (customer table), the fields in the table have the following association relationship:

[0121] custid (customer ID, which is the unique identifier of the customer) <-> custname (customer name), indicating that the customer ID is associated with the customer name. In the data table, the customer name can be found from the customer ID, and the customer ID can also be found from the customer name.

[0122] custid<->custphone (customer's phone number), indicating that the customer ID is associated with the customer's phone number.

[0123] custid<->custaddress (customer's address), indicating that the customer ID is associated with the customer's address.

[0124] In ordr (order table), the fields have the following associations:

[0125] custid<->orderid, indicating that the customer ID is associated with the order number.

[0126] orderid<->ordertime, indicating that the order number is associated with the order time.

[0127] orderid<->payamount, indicating that the order number is associated with the order amount.

[0128] The relationship between the customer table and the order table is:

[0129] cust.custid<->ordr.custid, which means that the customer ID in the customer table is associated with the customer ID in the order table. In the database, the customer ID in the order table can be found from the customer ID in the customer table, and the customer ID in the customer table can also be found from the customer ID in the order table.

[0130] That is to say, through the customer ID, the association between the customer table and the order table can be established. There is an association between fields, which can be that the two fields belong to the same data table or correspond to the same meaning.

[0131] S104: Generate a query statement according to at least one associated table pair and a query field, and obtain query result data from a database according to the query statement.

[0132] Specifically, after the server divides multiple query tables into at least one associated table pair and associates all data tables in the database into a virtual table through the associated table pair, it can generate a corresponding query statement based on the associated table pair and the query field. Then, based on the query statement, it searches the database for the query result data to be filled into the SMS template.

[0133] That is, the server may generate a query statement, such as a Structured Query Language (SQL) query statement, from preset relationship information in the database according to the query field information in the SMS template.

[0134] S105: Parse the query result data, determine the field data corresponding to the query field information from the query result data, and extract the field data.

[0135] Specifically, after obtaining the query result data, the field data corresponding to the query field information in the SMS template can be extracted from the query result data. Specifically, the query result data can be parsed first to determine the specific data structure of the query result data. Then, the field data corresponding to the query field information is found from the query result data, and the field data corresponding to the query field information is extracted.

[0136] S106: Verify the data format of the field data, and if the data format is inconsistent with the preset format, convert the data format of the field data into the preset format to obtain the field data in the preset format.

[0137] Specifically, after extracting the field data, the server can further verify whether the extracted field data conforms to the preset data format. When the data format of the field data is inconsistent with the preset format of the SMS template to be filled, the data format of the field data is converted to the preset format, thereby obtaining the field data in the preset format.

[0138] S107 . According to the second position of the query field information in the SMS template, the query field information in the SMS template is replaced with field data in a preset format to obtain SMS content.

[0139] Specifically, the query field information is filled in the placeholder of the SMS template. The second position of the query field information in the SMS template can be determined through the first position of the placeholder in the SMS template, and then the SMS content can be automatically generated by replacing the query field information in the SMS template with field data in a preset format.

[0140] The present embodiment provides a method for generating a short message, including: obtaining a short message template, parsing the short message template, identifying a target identifier from the short message template to extract the target identifier, and determining a first position of the target identifier in the short message template, and extracting query field information from the short message template according to the target identifier and the first position, wherein a second position of the query field information is associated with the first position of the target identifier; obtaining at least one query field and a query table where each query field is located from the query field information; if the number of query tables is greater than or equal to 2, dividing the multiple query tables into at least one associated table pair according to preset relationship information of a database, when there are at least two associated table pairs, the at least two associated table pairs can be associated into a virtual table, each associated table pair consists of two query tables, and / or, consisting of a query table and other data tables outside the query table, the preset relationship information is used to indicate the association relationship between fields and tables in the database; a query statement is generated according to at least one associated table pair and the query field, and query result data is obtained from the database according to the query statement; the query result data is parsed, the field data corresponding to the query field information is determined from the query result data, and the field data is extracted; the data format of the field data is verified, and if the data format is inconsistent with the preset format, the data format of the field data is converted to the preset format to obtain the field data in the preset format; according to the second position of the query field information in the SMS template, the query field information in the SMS template is replaced with the field data in the preset format to obtain the SMS content.The following technical effects are achieved: by means of the association relationship between the data tables in the database, the data content that can be used in the SMS template is expanded, so that all the fields in the database can be used in the SMS template, and it is no longer limited to reading data from the database according to pre-defined data items and parsing interfaces; by making multiple associated table pairs have an association relationship, all associated table pairs in the database can be directly or indirectly associated with each other, that is, by associating at least two associated table pairs into a virtual table, it is convenient to generate query statements, so as to query the database to obtain query result data; according to the query statement, data is dynamically read from the database, and even if the data structure in the database changes, through the association relationship between the data tables in the database, the server can still accurately obtain the query result data according to the query statement, so that it can still Generate SMS correctly; by utilizing the association between data tables in the database, more complex queries and data combinations can be supported. For example, more personalized and customized SMS content can be generated based on the user's transaction history, preferences and other information; by introducing query field information in the SMS template, the SMS content can be dynamically generated according to the actual situation, making the SMS template more flexible and able to adapt to different data content without the need to manually write static text for each possible SMS content; by filling the query field information in the placeholder of the SMS template, when writing the SMS template, it is possible to flexibly reference the data in the database as needed, so that the generated SMS content is no longer limited to pre-defined data items, thereby overcoming the limitations of the existing technology in SMS generation and providing a more flexible and efficient solution for SMS communication.

[0141] Figure 2 A flow chart of a method for generating a short message provided in an embodiment of the present application Figure 2 In one possible example, Figure 2 As shown, in this embodiment Figure 1 Based on the embodiment, how to divide the association table pairs and how to generate the query statements are further described in detail. Figure 2 As shown, the method includes:

[0142] S201. Obtain a text message template, parse the text message template, identify a target identifier from the text message template to extract the target identifier, determine a first position of the target identifier in the text message template, and extract query field information from the text message template according to the target identifier and the first position.

[0143] S202: Acquire at least one query field and a query table where each query field is located from the query field information.

[0144] S201 - S202 are similar to S101 - S102 and will not be described in detail in this embodiment.

[0145] S203: If the number of query tables is greater than or equal to 2, obtain at least one first association table of each query table from preset relationship information.

[0146] Specifically, as shown in the above embodiment, if the customer table is used as the query table, the order table can be the first associated table of the customer table.

[0147] If the parameters that the database can provide are: cust.custphone (the customer's phone number in the customer table) and ordr.ordertime (the time of the order in the order table). The query fields are custname, orderid, payamount, custphone and ordertime. Then, through the query field information cust.custphone, each query field can be queried in the database. Specifically, through the association relationship custphone<->custid, custid can be queried, and then through the association relationship custid<->custname, the query field custname can be queried; through the association relationship cust.custid<->ordr.custid, the order table can be searched from the customer table, and then in the order table, through the association relationship custid<->orderid, the query field orderid can be searched, and finally through the association relationship orderid<->payamount, the query field payamount can be searched.

[0148] Alternatively, each query field can be queried in the database by querying the field information ordertime. The method is similar to searching for each query field by querying the field information cust.custphone, which will not be repeated here.

[0149] Furthermore, Figure 3 A schematic diagram of the association relationship between fields provided in the embodiment of the present application. Figure 3 As shown, in the database, there are three data tables, namely Table 1, Table 2 and Table 3. Table 1 includes: field 11, field 12, field 13, field 14 and field 15, and the fields in Table 1 are mutually related; Table 2 includes: field 21, field 11, field 23, field 24 and field 25, and the fields in Table 2 are mutually related; Table 3 includes: field 31, field 32, field 33, field 34 and field 15, and the fields in Table 3 are also mutually related. Further, field 11 in Table 1 is mutually related to field 11 in Table 2, and field 15 in Table 1 is also mutually related to field 15 in Table 3.

[0150] If Table 1 is used as a query table, both Table 2 and Table 3 can be the first associated tables of Table 1; if Table 2 and Table 3 are used as query tables, Table 1 is the first associated table of both Table 2 and Table 3.

[0151] If the field to be queried is field 33, and the parameter provided is field 25. Then, it can be determined that the query tables are table 3 and table 2 first, and then according to the preset relationship information: field 15 in table 1 and field 15 in table 3 are mutually related, it is determined that the first associated table of query table 3 is table 1. At the same time, according to the preset relationship information: field 11 in table 1 and field 11 in table 2 are mutually related, it is determined that the first associated table of query table 2 is table 1. Since there is a mutual relationship between the fields in table 1, field 15 and field 11 in table 1 are mutually related. Therefore, according to the provided query field 25, the path for searching the query field 33 can be determined.

[0152] S204: Determine at least one first association group from a plurality of query tables according to each first association table.

[0153] In the embodiment of the present application, each first association group is one of the following: a single query table, a table pair, a table group, a single query table does not exist in the first association table of any query table, a query table in a table pair is the first association table of another query table in the table pair, and the first association table in a table group is the same first association table of the two query tables in the table group. For example, in the above embodiment, the query tables are Table 2 and Table 3. Since Table 1 is the first association table of Table 2 and Table 3 at the same time, Table 1, Table 2 and Table 3 form a table group.

[0154] S205: Take each table pair as an associated table pair, and split each table group into two associated table pairs.

[0155] Specifically, extracting the association table pair from at least one first association group includes: taking each table pair directly as an association table pair. And splitting each table group into two association table pairs, the two association table pairs split out are respectively composed of a query table and another data table other than the query table. For example, in the above embodiment, the query tables are Table 2 and Table 3, and the table group composed of Table 1, Table 2 and Table 3 is split into two association table pairs, then one association table pair is composed of Table 1 and Table 2, and the other association table pair is composed of Table 1 and Table 3.

[0156] S206: Use the first association group as the current association group.

[0157] Specifically, the first association group is used as the current association group, and the relationship iteration process is performed multiple times, so as to extract multiple association table pairs directly or indirectly related to the query field from the database.

[0158] S207: Merge at least two current association groups including the same data table into a second association group.

[0159] Specifically, the relationship iteration process includes: if there are at least two current association groups including the same data table among the multiple current association groups of the database, the current association groups including the same data table are merged into a second association group.

[0160] S208: If there is a second association group, stop extracting association table pairs.

[0161] Specifically, if there is only one second association group, since at least two current groups merged into the second association group include the same data table, association table pairs have been extracted between all data tables with association relationships in the second association group, and direct or indirect association relationships have been established, there is no need to repeatedly extract association table pairs.

[0162] S209: If there are multiple second association groups, determine at least one second association table of each data table in each second association group, and determine at least one third association group from the multiple second association groups according to each second association table, and use the third association group as the current association group.

[0163] In an embodiment of the present application, each third association group is one of the following: a single second association group, a group pair, or a group. The first data table of a second association group in the group pair is the second association table of the second data table of another second association group in the group pair, and the second association table in the group is the same second association table of the third data tables of two second association groups in the group.

[0164] Specifically, the data table in a single second association group does not exist in the second association table of each data table in any other second association group. In the two second association groups of a pair, the first data table in one second association group is the second association table of the second data table of the other second association group. For example: assuming that the pair includes a second association group A and a second association group B, when a data table c in the second association group A is the second association table of a data table d in the second association group B, then the data table c is the first data table, and the data table d is the second data table.

[0165] In order to understand the concept of a group, this implementation assumes that the group includes a second association group E, a second association group F, and a second association table g. The second association table g is a second association table common to data table e in the second association group E and data table f in the second association group F. The third data table refers to data table e and data table f.

[0166] The existence of multiple second association groups means that the number of the second association groups is greater than or equal to 2.

[0167] S210: The first data table and the second data table are taken as an association table pair, and two association table pairs are generated according to the third data tables of two second association groups in the group and the same second association table.

[0168] Specifically, the process of extracting the association table pair according to the second association table includes: taking the first data table and the second data table with direct association relationship in the pair as an association table pair, and forming association table pairs with the second association tables in the group respectively from the third data tables of the two second association groups in the group.

[0169] After extracting the association table pairs, the process returns to step S207. At this time, since the third association group has been used as the current association group in step S209, the current association group in the returned step S207 refers to the third association group, and at least two current association groups including the same data table are merged into a second association group, and then the number of second association groups is determined. If there are multiple second association groups, the relationship iteration steps S207-S210 are executed multiple times until there is only one second association group, and then the extraction of association table pairs is stopped.

[0170] S211. Analyze the preset relationship information to obtain the association relationship between the two data tables in the association table pair.

[0171] Specifically, after the server extracts all the associated table pairs from the database and associates all the associated table pairs into a virtual table, it can further read the preset relationship information pre-stored in the database and parse the association relationship between the two data tables in the associated table pair.

[0172] S212: Determine the association field between two data tables in the association table pair according to the association relationship.

[0173] Specifically, the server can determine the associated fields between the two data tables in the associated table pair according to the association relationship between the two data tables. The associated fields can be fields with the same meaning in the two data tables, or can be a primary key field in one data table and a foreign key field in the other data table.

[0174] S213: Generate a query statement according to the query field, the associated field and the associated table pair.

[0175] Specifically, the query field can usually be a data column that the user expects to retrieve from the database. The query field can come from one data table or from multiple data tables connected by association relationships. The server can select the associated table pair to be connected based on the data table where the query field is located and the associated fields between the various data tables. Then, the SQL query statement's join clause (Join Clause) is constructed through the associated table pair and the associated fields, and the query field is specified by constructing the select clause (Select Clause), thereby generating a complete query statement.

[0176] S214. Optimize the query statement by creating a composite index.

[0177] Specifically, after generating a query statement, the server can further check the correctness of the query statement, such as ensuring that the syntax of the SQL statement is correct to avoid query failures caused by syntax errors and ensure that the generated query statement can be executed correctly. Verify whether the query logic is as expected, ensure that there are no redundant data table connections, no unnecessary field connections, and ensure that only necessary query fields are included in the selection clause to reduce data transmission and processing time. In one possible implementation, in order to improve the query efficiency of multiple query fields, a composite index can be created in the query statement by selecting an appropriate column order to further optimize the query statement.

[0178] S215. Obtain query result data from the database according to the query statement.

[0179] S216: Parse the query result data, determine the field data corresponding to the query field information from the query result data, and extract the field data.

[0180] S217: Verify the data format of the field data, and if the data format is inconsistent with the preset format, convert the data format of the field data into the preset format to obtain the field data in the preset format.

[0181] S218. According to the second position of the query field information in the SMS template, the query field information in the SMS template is replaced with field data in a preset format to obtain SMS content.

[0182] S215-S218 are similar to S104-S107, and the parts with the same contents will not be described in detail in this embodiment.

[0183] A text message generation method provided in an embodiment of the present application optimizes the query statement by checking the correctness of the query statement and creating a composite index after generating the query statement, thereby ensuring that the generated query statement is not only correct but also optimized in performance, thereby improving the efficiency and response speed of database queries, and further improving the efficiency and accuracy of text message generation.

[0184] The embodiment of the present invention can divide the electronic device or the main control device into functional modules according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present invention is schematic and is only a logical function division. There may be other division methods in actual implementation.

[0185] Figure 4 This is a schematic diagram of the structure of a text message generating device provided in an embodiment of the present application. Figure 4 As shown, the SMS generating device includes: an acquisition module 410, a query table module 420, an association table pair module 430, a query module 440, an extraction module 450, a format conversion module 460 and a replacement module 470;

[0186] The acquisition module 410 is used to acquire a short message template, parse the short message template, identify a target identifier from the short message template to extract the target identifier, determine a first position of the target identifier in the short message template, and extract query field information from the short message template according to the target identifier and the first position, wherein a second position of the query field information is associated with the first position of the target identifier;

[0187] A query table module 420, configured to obtain at least one query field and a query table where each query field is located from the query field information;

[0188] The association table pair module 430 is used to divide the multiple query tables into at least one association table pair according to the preset relationship information of the database if the number of query tables is greater than or equal to 2. When there are at least two association table pairs, the at least two association table pairs can be associated into a virtual table. Each association table pair consists of two query tables and / or a query table and another data table other than the query table. The preset relationship information is used to indicate the association relationship between fields and tables in the database.

[0189] A query module 440, configured to generate a query statement according to at least one associated table pair and a query field, and query the database according to the query statement to obtain query result data;

[0190] The extraction module 450 is used to parse the query result data, determine the field data corresponding to the query field information from the query result data, and extract the field data;

[0191] The format conversion module 460 is used to verify the data format of the field data, and if the data format is inconsistent with the preset format, convert the data format of the field data into the preset format to obtain the field data in the preset format;

[0192] The replacement module 470 is used to replace the query field information in the SMS template with field data in a preset format according to the second position of the query field information in the SMS template to obtain SMS content.

[0193] In one possible design, the association table pair module 430 includes: a first association table module, a first association group module, and an association table pair module;

[0194] A first association table module, used to obtain at least one first association table of each query table from preset relationship information;

[0195] A first association group module, used for determining at least one first association group from a plurality of query tables according to each first association table, each first association group being one of the following: a single query table, a table pair, a table group, a single query table not existing in a first association table of any query table, a query table in a table pair being a first association table of another query table in the table pair, and a first association table in a table group being a same first association table of two query tables in the table group;

[0196] The module for extracting association table pairs is used to extract association table pairs from at least one first association group.

[0197] In a possible design, the module for extracting association table pairs includes: a first confirmation module, an iteration module; wherein the iteration module includes: a second association group module, a stop extraction module, a third association group module and a second confirmation module;

[0198] A first confirmation module, used for treating each table pair as an associated table pair and splitting each table group into two associated table pairs;

[0199] The iteration module is used to take the first association group as the current association group and perform the relationship iteration process multiple times:

[0200] A second association group module, configured to merge at least two current association groups including the same data table into a second association group;

[0201] A stop extraction module, used for stopping the extraction of association table pairs if there is a second association group;

[0202] a third association group module, for determining, if there are multiple second association groups, at least one second association table of each data table in each second association group, and determining at least one third association group from the multiple second association groups according to each second association table, and using the third association group as the current association group, wherein each third association group is one of the following: a single second association group, a pair, or a group, wherein a first data table of one second association group in the pair is a second association table of a second data table of another second association group in the pair, and a second association table in the group is a same second association table of third data tables of two second association groups in the group;

[0203] The second confirmation module is used to regard the first data table and the second data table as an association table pair, and to generate two association table pairs according to the third data tables of two second association groups in the group and the same second association table.

[0204] In one possible design, the query module 440 includes: a parsing module, an association field module, and a query statement module;

[0205] A parsing module, used to parse the preset relationship information to obtain the association relationship between the two data tables in the association table pair;

[0206] The association field module is used to determine the association fields between two data tables in the association table pair according to the association relationship;

[0207] The query statement module is used to generate query statements based on query fields, associated fields and associated table pairs.

[0208] In a possible design, the SMS generating device further includes: an optimization module:

[0209] The optimization module is used to optimize query statements by creating composite indexes.

[0210] In a possible design, the SMS generating device further includes a display module, a receiving module and a first generating module;

[0211] A display module, used for displaying preset relationship information;

[0212] A receiving module, used to receive query field information selected by a user from preset relationship information;

[0213] The first generating module is used to generate a short message template according to the query field information.

[0214] In one possible design, the first generation module includes: an input module and a second generation module;

[0215] An input module, used to receive text information input by a user, wherein the text information includes an insertion position of query field information;

[0216] The second generating module is used to generate a short message template according to the text information and the query field information.

[0217] The present embodiment provides a text message generation device that can execute a text message generation method of the above-mentioned embodiment. The implementation principle and technical effect are similar, and the present embodiment will not be repeated here.

[0218] In a specific implementation of the aforementioned SMS generating device, each module may be implemented as a processor, and the processor may execute computer-executable instructions stored in the memory, so that the processor executes the aforementioned SMS generating method.

[0219] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 5 As shown, the electronic device includes: at least one processor 510 and a memory 520. The electronic device also includes a communication component 530. The processor 510, the memory 520 and the communication component 530 are connected via a bus 540.

[0220] In the specific implementation process, at least one processor 510 executes the computer execution instructions stored in the memory 520, so that at least one processor 510 executes a text message generation method executed by the electronic device side as above.

[0221] The specific implementation process of the processor 510 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.

[0222] In the above embodiments, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

[0223] The memory may include a high-speed RAM memory, and may also include a non-volatile storage NVM, such as at least one disk storage.

[0224] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of this application is not limited to only one bus or one type of bus.

[0225] The above-mentioned functions implemented by the electronic device and the main control device introduce the scheme provided by the embodiment of the present invention. It can be understood that in order to implement the above-mentioned functions, the electronic device or the main control device includes a hardware structure and / or software module corresponding to the execution of each function. In combination with the units and algorithm steps of each example described in the embodiment disclosed in the embodiment of the present invention, the embodiment of the present invention can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the technical solution of the embodiment of the present invention.

[0226] The embodiment of the present application also provides a computer-readable storage medium, in which computer execution instructions are stored. When the computer execution instructions are executed on a computer, the computer executes the technical solution of the SMS generation method of the above embodiment.

[0227] An embodiment of the present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium. When at least one processor executes the computer program, the technical solution of the SMS generation method in the above embodiment can be implemented.

[0228] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules is only a logical function division, and there may be other division methods in actual implementation, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.

[0229] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to implement the solution of this embodiment.

[0230] In addition, each functional module in each embodiment of the present application can be integrated into one processing unit, or each module can exist physically separately, or two or more modules can be integrated into one unit. The above-mentioned module-composed unit can be implemented in the form of hardware or in the form of hardware plus software functional units.

[0231] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the methods of various embodiments of the present application.

[0232] The above storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The storage medium can be any available medium that can be accessed by a general or special purpose computer.

[0233] An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the storage medium can also exist as discrete components in an electronic control unit or a main control device.

[0234] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0235] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for generating a short message, characterized in that: include: Acquire a short message template, parse the short message template, identify a target identifier from the short message template to extract the target identifier, determine a first position of the target identifier in the short message template, and extract query field information from the short message template according to the target identifier and the first position, wherein a second position of the query field information is associated with the first position of the target identifier; Acquire at least one query field and a query table where each query field is located from the query field information; If the number of the query tables is greater than or equal to 2, the plurality of query tables are divided into at least one associated table pair according to preset relationship information of the database. When there are at least two associated table pairs, at least two associated table pairs can be associated into a virtual table. Each associated table pair consists of two query tables and / or one query table and another data table other than the query table. The preset relationship information is used to indicate the association relationship between fields and tables in the database. Generate a query statement according to the at least one associated table pair and the query field, and query the database according to the query statement to obtain query result data; Parsing the query result data, determining field data corresponding to the query field information from the query result data, and extracting the field data; Verifying the data format of the field data, and if the data format is inconsistent with a preset format, converting the data format of the field data into the preset format to obtain field data in the preset format; According to the second position of the query field information in the SMS template, the query field information in the SMS template is replaced with the field data in the preset format to obtain SMS content.

2. The method according to claim 1, characterized in that The dividing the plurality of query tables into at least one associated table pair according to preset relationship information of the database comprises: Acquire at least one first association table of each of the query tables from the preset relationship information; Determine at least one first association group from the plurality of query tables according to each of the first association tables, each of the first association groups being one of the following: a single query table, a table pair, or a table group, the single query table not existing in the first association table of any query table, one query table in the table pair being the first association table of another query table in the table pair, and the first association table in the table group being the same first association table of two query tables in the table group; The association table pair is extracted from at least one first association group.

3. The method according to claim 2, characterized in that The extracting the association table pair from at least one first association group comprises: Taking each of the table pairs as an associated table pair, and splitting each of the table groups into two associated table pairs; The first association group is used as the current association group, and the relationship iteration process is performed multiple times: Merging at least two current association groups including the same data table into a second association group; If there is one second association group, stop extracting the association table pair; If there are multiple second association groups, at least one second association table of each data table in each second association group is determined, and at least one third association group is determined from the multiple second association groups according to each of the second association tables, and the third association group is used as the current association group, and each of the third association groups is one of the following: a single second association group, a pair, or a group, wherein the first data table of one of the second association groups in the pair is the second association table of the second data table of another second association group in the pair, and the second association table in the group is the same second association table of the third data tables of two second association groups in the group; The first data table and the second data table are taken as one association table pair, and two association table pairs are generated according to the third data tables of two second association groups in the group and the same second association table.

4. The method according to claim 3, characterized in that Generating a query statement according to the at least one association table pair and the query field includes: Parsing the preset relationship information to obtain the association relationship between the two data tables in the association table pair; According to the association relationship, determining the association fields between the two data tables in the association table pair; The query statement is generated according to the query field, the associated field and the associated table pair.

5. The method according to claim 4, characterized in that After generating the query statement, the method further includes: The query statement is optimized by creating a composite index.

6. The method according to any one of claims 1 to 5, characterized in that The generation process of the SMS template includes: Displaying the preset relationship information; Receiving query field information selected by a user from the preset relationship information; The SMS template is generated according to the query field information.

7. The method according to claim 6, characterized in that The generating the SMS template according to the query field information includes: receiving text information input by a user, wherein the text information includes an insertion position of the query field information, and the insertion position is the second position; The SMS template is generated according to the text information and the query field information.

8. A short message generating device, characterized in that: include: an acquisition module, configured to acquire a short message template, parse the short message template, identify a target identifier from the short message template to extract the target identifier, determine a first position of the target identifier in the short message template, and extract query field information from the short message template according to the target identifier and the first position, wherein a second position of the query field information is associated with the first position of the target identifier; A query table module, used for acquiring at least one query field and a query table where each query field is located from the query field information; An association table pair module, for dividing the plurality of query tables into at least one association table pair according to preset relationship information of the database if the number of the query tables is greater than or equal to 2; when there are at least two association table pairs, at least two association table pairs may be associated into a virtual table, each of the association table pairs consisting of two query tables, and / or, consisting of one query table and another data table other than the query table, the preset relationship information being used to indicate the association relationship between fields and tables in the database; A query module, configured to generate a query statement according to the at least one associated table pair and the query field, and query the database according to the query statement to obtain query result data; An extraction module, used to parse the query result data, determine field data corresponding to the query field information from the query result data, and extract the field data; A format conversion module, used for verifying the data format of the field data, and if the data format is inconsistent with a preset format, converting the data format of the field data into a preset format to obtain field data in a preset format; A replacement module is used to replace the query field information in the SMS template with the field data in the preset format according to the second position of the query field information in the SMS template to obtain SMS content.

9. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.

11. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 7 when being executed by a processor.

Citation Information

Patent Citations

  • Short message processing method and device, electronic equipment and storage medium

    CN111428463A

  • SQL statement generation method and system oriented to medical data and medium

    CN117609277A

  • Push message generation method and device, equipment, storage medium and program product

    CN118200394A

  • Method, system and non-transitory storage medium for generating and outputting a message

    US20240086633A1