Code name conversion method and device

By obtaining the annotation of entity class fields and caching Chinese names, and comparing the basic parameter dictionary with business code, the correlation display performance problem between code and Chinese is solved, and rapid response and efficient development are achieved.

CN119917097AInactive Publication Date: 2025-05-02KUNSHAN EAST CHINA INFORMATION TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510412620.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-03
Publication Date
2025-05-02
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In actual business, the code and corresponding Chinese need to be frequently associated and displayed, resulting in a large number of join statements written, resulting in performance problems and inefficient development.

Method used

By obtaining the annotations of the entity class field, determine the basic parameter code, and cache the Chinese name into the basic parameter dictionary, load the basic parameter code from the database, compare the dictionary with the business code, find the corresponding Chinese name, and combine and output the basic parameter code and Chinese name.

Benefits of technology

It realizes the rapid completion of Chinese and English display of multiple fields, avoids a large number of join statements, improves response speed, and solves the problem of inefficient development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119917097A_ABST
    Figure CN119917097A_ABST
Patent Text Reader

Abstract

The invention discloses a code name conversion method and device, and the method comprises the steps: obtaining all entity class fields, and determining basic parameter codes used by the fields according to the annotations on the fields; caching Chinese names of annotations of all entity class fields into a basic parameter dictionary; reading the basic parameter code from a database, and loading the basic parameter code into a cache; obtaining a to-be-converted service code; comparing a business code to be converted with data in the basic parameter dictionary so as to find a Chinese name corresponding to the business code to be converted; obtaining a basic parameter code corresponding to the service code from a cache; the basic parameter codes corresponding to the service codes and the corresponding Chinese names are combined and output; according to the technical scheme, the Chinese and English display problem of multiple fields can be quickly completed, compiling of a large number of join statements is avoided, the response speed is increased, and the technical problem of low development efficiency is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing, and in particular to a code name conversion method and device. Background Art

[0002] In actual business, there will be many codes and corresponding Chinese characters, such as the customs general trade, which is coded as 0110. In actual storage, the corresponding codes are usually stored, and the corresponding Chinese characters are not redundant. The codes and Chinese characters are usually stored as basic parameters in a basic parameter table. If the business needs to display the corresponding Chinese characters, it can only associate the basic coding table. Once there are many fields, there will be a large number of join statements, which will cause serious performance problems, and also bring a large number of coding problems, resulting in low development efficiency. Summary of the invention

[0003] In order to solve the above problems, the present invention provides a solution which can automatically convert code names, does not require a large number of join statements, and has a fast response speed.

[0004] On the one hand, the present invention provides a method for converting code names, including: obtaining all entity class fields, and determining the basic parameter codes used by the fields according to the annotations on the fields; caching the annotated Chinese names of all entity class fields in a basic parameter dictionary; reading the basic parameter codes from a database, and loading the basic parameter codes into the cache; obtaining a business code to be converted; comparing the business code to be converted with the data in the basic parameter dictionary to find the corresponding Chinese name; obtaining the basic parameter code corresponding to the business code from the cache; merging the basic parameter code corresponding to the business code with the corresponding Chinese name; and outputting the merged basic parameter code and the corresponding Chinese name.

[0005] Optionally, the merged basic parameter code and the corresponding Chinese name are generated into a json string and output.

[0006] Optionally, a serializer is used to output the merged basic parameter code and the corresponding Chinese name.

[0007] Optionally, the entity class fields and corresponding annotations are formed by batch importing an existing fixed parameter dictionary table.

[0008] Optionally, the entity class fields and corresponding annotations are formed according to a user-defined field name table.

[0009] Optionally, the entity class fields and corresponding annotations are formed by a result table automatically generated by the business.

[0010] On the other hand, the present invention also provides a code name conversion device, including: a first acquisition module, used to acquire all entity class fields, and determine the basic parameter code used by the field according to the annotation on the field; a cache module, used to cache the annotated Chinese names of all entity class fields into a basic parameter dictionary; a loading module, used to read the basic parameter code from a database, and load the basic parameter code into the cache; a second acquisition module, used to acquire the business code to be converted; a comparison module, used to compare the business code to be converted with the data in the basic parameter dictionary to find the corresponding Chinese name; a third acquisition module, used to acquire the basic parameter code corresponding to the business code from the cache; a merging module, used to merge the basic parameter code corresponding to the business code with the corresponding Chinese name; an output module, used to output the merged basic parameter code and the corresponding Chinese name.

[0011] The beneficial effects of the present invention over the prior art are as follows: the conversion method obtains all entity class fields, determines the basic parameter codes used by the fields according to the annotations on the fields, reads the basic parameter codes from the database, loads the basic parameter codes into the cache, compares the basic parameter dictionary with the business code to be converted, and then selects the corresponding Chinese name. This not only can quickly complete the Chinese and English display problems of multiple fields, but also avoids the writing of a large number of join statements, improves the response speed, and solves the technical problem of low development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Figure 1 is a flow chart of a code name conversion method provided by an embodiment of the present invention; Figure 2 It is a structural diagram of a code name conversion device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0013] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0014] Reference Figure 1 This embodiment provides a method for converting a code name, comprising the following steps: S10: Obtain all entity class fields, and determine the basic parameter code used by the field according to the annotations on the field.

[0015] It should be noted that the entity class fields and corresponding annotations are formed by batch importing an existing fixed parameter dictionary table, or can be formed according to a user-defined field name table, or formed by a result table automatically generated by the business. In this embodiment, the existing fixed parameter dictionary table is initially formed by batch importing, and then the result table is automatically generated by the business, so that a dynamic basic parameter dictionary can be obtained, thereby improving the accuracy and efficiency of code name conversion.

[0016] S20: Cache the Chinese names of the annotations of all entity class fields into the basic parameter dictionary.

[0017] S30: Reading a basic parameter code from a database, and loading the basic parameter code into a cache.

[0018] It should be noted that the database S40: Obtain the service code to be converted.

[0019] It should be noted that the business code to be converted can be input by the user through the client, or it can be provided by the system during the data processing process.

[0020] S50: Compare the service code to be converted with the data in the basic parameter dictionary to find the corresponding Chinese name.

[0021] Specifically, find the Chinese name corresponding to each business code and generate a temporary data dictionary based on the code.

[0022] S60: Acquire a basic parameter code corresponding to the service code from the cache.

[0023] S70: Merge the basic parameter code corresponding to the service code with the corresponding Chinese name.

[0024] S80: Output the combined basic parameter code and the corresponding Chinese name.

[0025] Specifically, in this embodiment, the merged basic parameter code and the Chinese name of the response are used to generate a json string through a serializer and finally output. This can quickly complete the Chinese and English display problems of multiple fields, avoid the writing of a large number of join statements, improve the response speed, and solve the technical problem of low development efficiency.

[0026] Reference Figure 2 This embodiment also provides a code name conversion device, including: The first acquisition module 100 is used to obtain all entity class fields and determine the basic parameter code used by the field according to the annotation on the field; it should be noted that since the specific acquisition method and process have been explained in detail in step S10 of the above-mentioned code name conversion method, it will not be repeated here.

[0027] The cache module 200 is used to cache the annotated Chinese names of all entity class fields into the basic parameter dictionary; it should be noted that since the specific cache method and process have been explained in detail in step S20 of the above-mentioned code name conversion method, they will not be repeated here.

[0028] The loading module 300 is used to read the basic parameter code from the database and load the basic parameter code into the cache; it should be noted that since the specific loading method and process have been explained in detail in step S30 of the above-mentioned code name conversion method, they will not be repeated here.

[0029] The second acquisition module 400 is used to acquire the service code to be converted. It should be noted that since the specific acquisition method and process have been described in detail in step S40 of the above-mentioned code name conversion method, they will not be repeated here.

[0030] The comparison module 500 is used to compare the business code to be converted with the data in the basic parameter dictionary to find the corresponding Chinese name; it should be noted that since the specific comparison method and process have been explained in detail in step S50 of the above-mentioned code name conversion method, it will not be repeated here.

[0031] The third acquisition module 600 is used to obtain the basic parameter code corresponding to the business code from the cache; it should be noted that since the specific acquisition method and process have been explained in detail in step S60 of the above-mentioned code name conversion method, it will not be repeated here.

[0032] The merging module 700 is used to merge the basic parameter code corresponding to the business code with the corresponding Chinese name; it should be noted that since the specific merging method and process have been explained in detail in step S70 of the above-mentioned code name conversion method, it will not be repeated here.

[0033] The output module 800 is used to output the combined basic parameter code and the corresponding Chinese name. It should be noted that since the specific output method and process have been described in detail in step S80 of the above code name conversion method, they will not be repeated here.

[0034] The conversion method obtains all entity class fields, determines the basic parameter code used by the field according to the annotation on the field, reads the basic parameter code from the database, loads the basic parameter code into the cache, compares the basic parameter dictionary with the business code to be converted, and then selects the corresponding Chinese name. This not only can quickly complete the Chinese and English display of multiple fields, but also avoids the writing of a large number of join statements, improves the response speed, and solves the technical problem of low development efficiency.

[0035] In addition, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium may store a program, and when the program is executed, the program includes part or all of the steps of the code name conversion method recorded in the above method embodiment.

[0036] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0037] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a memory, including several instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0038] A person skilled in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable memory, and the memory may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0039] The exemplary flow chart for the code name conversion method according to an embodiment of the present invention has been described above with reference to the accompanying drawings. It should be noted that the large amount of details included in the above description are only exemplary illustrations of the present invention, rather than limitations of the present invention. In other embodiments of the present invention, the method may have more, less or different steps, and the order, inclusion, function, etc. of the steps may be different from those described and illustrated.

Claims

1. A method for converting a code name, characterized in that: include: Get all entity class fields and determine the basic parameter code used by the fields based on the annotations on the fields; Cache the Chinese names of annotations of all entity class fields into the basic parameter dictionary; Reading a basic parameter code from a database and loading the basic parameter code into a cache; Get the business code to be converted; Compare the business code to be converted with the data in the basic parameter dictionary to find the corresponding Chinese name; Obtaining a basic parameter code corresponding to the business code from a cache; Merge the basic parameter code corresponding to the business code with the corresponding Chinese name; Output the merged basic parameter code and the corresponding Chinese name.

2. The conversion method according to claim 1, characterized in that: The merged basic parameter code and the corresponding Chinese name are generated into a json string and output.

3. The conversion method according to claim 1 or 2, characterized in that: Use the serializer to output the merged basic parameter code and the corresponding Chinese name.

4. The conversion method according to claim 1, characterized in that: The entity class fields and corresponding annotations are formed by batch importing an existing fixed parameter dictionary table.

5. The conversion method according to claim 1, characterized in that: The entity class fields and corresponding annotations are formed according to a user-defined field name table.

6. The conversion method according to claim 1, characterized in that: The entity class fields and corresponding annotations are formed by the result table automatically generated by the business.

7. A code name conversion device, characterized in that: include: The first acquisition module is used to acquire all entity class fields and determine the basic parameter code used by the field according to the annotations on the field; The cache module is used to cache the Chinese names of annotations of all entity class fields into the basic parameter dictionary; A loading module, used for reading a basic parameter code from a database and loading the basic parameter code into a cache; The second acquisition module is used to acquire the service code to be converted; A comparison module, used to compare the business code to be converted with the data in the basic parameter dictionary, so as to find the corresponding Chinese name; A third acquisition module is used to acquire a basic parameter code corresponding to the business code from a cache; A merging module, used to merge the basic parameter code corresponding to the business code with the corresponding Chinese name; The output module is used to output the merged basic parameter code and the corresponding Chinese name.

8. The conversion device according to claim 7, characterized in that: The merged basic parameter code and the corresponding Chinese name are generated into a json string and output.

9. The conversion device according to claim 7, characterized in that: Use the serializer to output the merged basic parameter code and the corresponding Chinese name.

10. A computer-readable storage medium, characterized in that: include: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of a code name conversion method as described in any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Data display method and device, equipment, storage medium and program product

    CN114090680A

  • Generation method and device of data processing component, electronic equipment and storage medium

    CN116909681A

  • Service code interpretation weaving method, service system and storage medium

    US20240385820A1

  • Dictionary data operation method and apparatus, readable storage medium, and terminal device

    WO2021218033A1