CN117591089A - Service data storage method, device, equipment and storage medium - Google Patents

Service data storage method, device, equipment and storage medium Download PDF

Info

Publication number
CN117591089A
CN117591089A CN202311624345.XA CN202311624345A CN117591089A CN 117591089 A CN117591089 A CN 117591089A CN 202311624345 A CN202311624345 A CN 202311624345A CN 117591089 A CN117591089 A CN 117591089A
Authority
CN
China
Prior art keywords
service data
data
custom
target service
type converter
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311624345.XA
Other languages
Chinese (zh)
Inventor
苗春雨
林剑辉
吴鸣旦
叶张乐
夏玮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Shuyu Technology Co ltd
Original Assignee
Zhejiang Shuyu Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Shuyu Technology Co ltd filed Critical Zhejiang Shuyu Technology Co ltd
Priority to CN202311624345.XA priority Critical patent/CN117591089A/en
Publication of CN117591089A publication Critical patent/CN117591089A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computing Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a business data storage method, a device, equipment and a storage medium, which relate to the technical field of computers and comprise the following steps: when a service data storage request sent by a client is received, searching a self-defined type converter through a type converter register, and acquiring target service data to be stored through the self-defined type converter; verifying the validity of the target service data through a custom data verifier; if the validity of the target service data passes, performing type conversion on the target service data through the custom type converter to obtain converted service data, and storing the converted service data. The method and the device can flexibly check the validity of the service data, convert formats of different types of service data, can decouple the service code without invading the service code, and further improve the maintainability, expandability and reusability of the system.

Description

Service data storage method, device, equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a storage medium for storing service data.
Background
Currently, in the process of service development, some ORM (Object-Relational Mapping, object-relation mapping) frames, such as Mybatis (an excellent java-based persistent layer frame) and Hibernate (an Object-relation mapping frame of open source code) frames, are generally adopted to simplify interaction between service codes and databases, however, service data formats in the service codes are complex, data formats convertible by self-contained type converters in the frames are very limited, and validity and correctness of the service data cannot be verified.
In order to verify the validity of service data, currently, the main stream mode is to use Java Bean Validation (a framework for verifying parameters by configuring notes in Java) and Spring Validation (a set of verification components packaged by Spring framework) combined mode to perform data verification, extract corresponding service data from service codes and set the corresponding service data in corresponding attributes in service objects, however, the verification mode does not support dynamic verification rules, and a custom verifier is required to be written, and meanwhile, for larger application programs or complex data structures, configuration may become very complex, maintenance is not easy, and expandability is poor; in addition, the format conversion of the file object cannot be performed in the above manner, the file object needs to be acquired in a service code and stored in a database, and huge potential safety hazards exist when the file object is invaded into the service code.
In summary, how to solve the above-mentioned problems is a problem that still further needs to be solved in the art.
Disclosure of Invention
In view of this, an object of the present application is to provide a method, apparatus, device, and storage medium for storing service data, which are applied to a database, and can flexibly check validity of service data, and perform format conversion on different types of service data, so that the service data can be decoupled from service codes without intrusion of service codes, thereby improving maintainability, expandability, and reusability of a system. The specific scheme is as follows:
in a first aspect, the present application discloses a service data storage method, applied to a database, including:
when a service data storage request sent by a client is received, searching a self-defined type converter through a type converter register, and acquiring target service data to be stored through the self-defined type converter;
verifying the validity of the target service data through a custom data verifier;
if the validity of the target service data passes, performing type conversion on the target service data through the custom type converter to obtain converted service data, and storing the converted service data.
Optionally, the service data storage method further includes:
acquiring user-defined data verification strategies preset for different types of service data and data verification rules formulated for the user-defined data verification strategies;
storing each self-defined data verification policy and the corresponding data verification rule into the self-defined data verifier, and injecting the self-defined data verifier into a Bean object of a Spring container.
Optionally, the verifying, by a custom data checker, the validity of the target service data includes:
acquiring the custom data checker from the Bean object of the Spring container, and searching the custom data check strategy corresponding to the type of the target service data through the custom data checker;
and verifying the validity of the target service data through the data verification rule corresponding to the custom data verification strategy.
Optionally, the obtaining, by the custom type converter, the target service data to be stored includes:
and acquiring target service data to be stored through the custom type converter and based on a reflection mechanism.
Optionally, the service data storage method further includes:
acquiring the pre-established custom type converter and the custom data checker, and injecting the custom data checker into the custom type converter through a constructor;
registering the custom type converter through the type converter registrar.
Optionally, the service data storage method further includes:
judging whether a file object exists in the target service data;
if the target service data does not have the file object, executing the step of verifying the validity of the target service data through a self-defined data verifier;
if the file object exists in the target service data, an AOP agent is automatically created through a Spring framework, and the validity of the file object in the target service data is checked through the AOP agent.
Optionally, the obtaining, by the custom type converter, the target service data to be stored includes:
and acquiring target service data to be stored through the Sql Session interface and by utilizing the self-defined type converter.
In a second aspect, the present application discloses a service data storage device, applied to a database, including:
the searching module is used for searching the self-defined type converter through the type converter register when receiving the service data storage request sent by the client;
the data acquisition module is used for acquiring target service data to be stored through the custom type converter;
the verification module is used for verifying the validity of the target service data through a self-defined data verifier;
the format conversion module is used for carrying out type conversion on the target service data through the custom type converter if the validity check of the target service data is passed, so as to obtain converted service data;
and the storage module is used for storing the converted service data.
In a third aspect, the present application discloses an electronic device comprising a processor and a memory; the processor implements the service data storage method when executing the computer program stored in the memory.
In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein the computer program when executed by the processor implements the aforementioned business data storage method.
When a service data storage request sent by a client is received, a user-defined type converter is searched through a type converter register, target service data to be stored is obtained through the user-defined type converter, the validity of the target service data is checked through a user-defined data checker, if the validity check of the target service data is passed, the type conversion is carried out on the target service data through the user-defined type converter to obtain converted service data, and the converted service data is stored. According to the method and the device, the user-defined type converter is searched through the type converter registry, the service data is checked through the user-defined data checker, and then the format conversion is carried out on the service data through the user-defined type converter, so that the format conversion and check functions are decoupled from the service codes, the legality of the service data can be flexibly checked, the format conversion is carried out on the service data of different types, the service codes do not need to be invaded, the service codes can be decoupled, the maintainability, the expandability and the reusability of the system are improved, in addition, a plurality of mainstream ORM frameworks can be adapted, the data format conversion and the expansion of the check functions can be carried out according to different service requirements, and the method and the device have strong expansibility.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present application, and that other drawings may be obtained according to the provided drawings without inventive effort to a person skilled in the art.
FIG. 1 is a flow chart of a method for storing business data disclosed in the present application;
fig. 2 is a schematic diagram of a specific service data storage method disclosed in the present application;
FIG. 3 is a flowchart of a specific business data storage method disclosed in the present application;
fig. 4 is a schematic diagram of a specific service data storage method disclosed in the present application;
FIG. 5 is a schematic structural diagram of a service data storage device disclosed in the present application;
fig. 6 is a block diagram of an electronic device disclosed in the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
The embodiment of the application discloses a business data storage method, which is applied to a database, and is shown in fig. 1, and the method comprises the following steps:
step S11: when a service data storage request sent by a client is received, searching a self-defined type converter through a type converter register, and acquiring target service data to be stored through the self-defined type converter.
The data storage scheme provided by the application is applied to a database, when a service data storage request sent by a client is received, such as when a user submits service data, a pre-established self-defined Type converter (Type Handler) is searched through a Type converter register (Type Handler Registry), and then target service data to be stored is obtained through the searched self-defined Type converter (Type Handler); the Type converter registry (Type Handler Registry) is used for flexibly registering and acquiring the custom Type converter (Type Handler) into an ORM framework, and has easy maintenance and reusability; the self-defined Type converter (Type Handler) is used for converting different types of service data, such as the conversion between Java types and JDBC (Java Data Base Connectivity, a specification defined by Java operation of various databases), so that the query result can be correctly mapped into Java objects, the expansion of conversion functions and service code coupling are realized, and the development efficiency is improved.
Specifically, the obtaining, by the custom type converter, the target service data to be stored may include: and acquiring target service data to be stored through the custom type converter and based on a reflection mechanism. In this embodiment, the target service data to be stored may be obtained by a pre-created custom type converter and based on a reflection mechanism.
Step S12: and verifying the validity of the target service data through a custom data verifier.
In this embodiment, after the target service Data to be stored is obtained through the custom type converter, further, validity, such as validity and correctness, of the target service Data is checked through a custom Data verifier (Data verifier); the Data verifier (Data verifier) is used for verifying the validity of service Data, such as input verification, format verification, range verification, uniqueness verification, deletion detection, type detection, repeated detection and the like, so that the reliability and the safety of an application program can be improved, the quality of the Data can be effectively improved, incorrect Data is prevented from being processed, and errors in the Data processing process are reduced.
In this embodiment, referring to fig. 2, a user-defined data verifier is further required to be injected into a Bean object of a Spring container in advance, and the specific process includes: acquiring user-defined data verification strategies preset for different types of service data and data verification rules formulated for the user-defined data verification strategies; storing each self-defined data verification policy and the corresponding data verification rule into the self-defined data verifier, and injecting the self-defined data verifier into a Bean object of a Spring container. In this embodiment, corresponding custom Data verification policies set for different types of service Data and corresponding Data verification rules formulated for each custom Data verification policy are obtained first, then all the custom Data verification policies and corresponding Data verification rules are saved to a custom Data verifier (Data verifier), and the custom Data verifier (Data verifier) is injected into a Bean object of a Spring container.
Correspondingly, the verifying, by the custom data checker, the validity of the target service data may specifically include: acquiring the custom data checker from the Bean object of the Spring container, and searching the custom data check strategy corresponding to the type of the target service data through the custom data checker; and verifying the validity of the target service data through the data verification rule corresponding to the custom data verification strategy. In this embodiment, when verifying the validity of the target service Data, a pre-created custom Data verifier (Data verifier) may be first obtained from the Bean object of the Spring container, then a custom Data verification policy corresponding to the type of the target service Data is searched by the custom Data verifier (Data verifier), and then the validity and correctness of the target service Data are verified by a Data verification rule corresponding to the custom Data verification policy.
In addition, referring to fig. 2, the custom data checker is located in the custom type converter, and the specific implementation process includes: acquiring the pre-established custom type converter and the custom data checker, and injecting the custom data checker into the custom type converter through a constructor; registering the custom type converter through the type converter registrar. That is, a pre-created custom Data verifier (Data verifier) is injected into a custom Type converter (Type Handler) by a constructor, and the custom Type converter (Type Handler) is registered by a Type converter register so as to manage the custom Type converter (Type Handler) to process business program codes.
Step S13: if the validity of the target service data passes, performing type conversion on the target service data through the custom type converter to obtain converted service data, and storing the converted service data.
In this embodiment, if the validity of the target service data passes, the target service data may be subjected to Type conversion by the custom Type conversion (Type Handler), for example, JDBC Type is converted into Java Type, or Java Type is converted into JDBC Type, so as to obtain corresponding converted service data, and then the converted service data is stored, that is, the converted service data is stored in a database, and in a specific embodiment, data required by a user may be extracted from the converted service data and stored in the database. Wherein the data type conversion includes, but is not limited to, conversion of data of a character string, an integer, a date, etc.
In this embodiment, before verifying the validity of the target service data, the method specifically further includes: judging whether a file object exists in the target service data; if the target service data does not have the file object, executing the step of verifying the validity of the target service data through a self-defined data verifier; if the file object exists in the target service data, an AOP (Aspect Oriented Programming, section-oriented programming) agent is automatically created through a Spring framework, and the validity of the file object in the target service data is checked through the AOP agent. In this embodiment, if the target service data does not have a file object, the validity of the target service data may be directly checked by a custom data verifier (datavalidizer); if the file object exists, an AOP agent can be automatically created through a Spring framework, and then the validity of the file object in the target service data is checked through the created AOP agent.
It can be seen that, when a service data storage request sent by a client is received, the embodiment of the application searches for a custom type converter through a type converter register, acquires target service data to be stored through the custom type converter, checks validity of the target service data through a custom data checker, if the validity check of the target service data is passed, performs type conversion on the target service data through the custom type converter to obtain converted service data, and stores the converted service data. According to the embodiment of the application, the user-defined type converter is searched through the type converter register, the service data is checked through the user-defined data checker, and then the format conversion is carried out through the service data of the user-defined type converter, so that the format conversion and check function and the service code are decoupled, the validity of the service data can be flexibly checked, the format conversion of different types of service data is carried out, the service code is not required to be invaded, the service code can be decoupled, the maintainability, the expandability and the reusability of the system are improved, in addition, a plurality of main stream ORM frameworks can be adapted, and the data format conversion and the check function can be expanded according to different service requirements, so that the system has strong expandability.
The embodiment of the application discloses a specific service data storage method, which is applied to a database, and is shown in fig. 3, and the method comprises the following steps:
step S21: when a service data storage request sent by a client is received, searching a self-defined type converter through a type converter register, and acquiring target service data to be stored through an Sql Session interface and by utilizing the self-defined type converter.
In this embodiment, as shown in fig. 4, when a client sends a service data storage request, the service data storage request may be sent to a database through an Sql Session interface, then a user-defined type converter is searched through a type converter register in the database, and target service data to be stored is obtained through an Sql Session (corresponding to a Connection object in JDBC) interface and the user-defined type converter; the database comprises a basic supporting layer and a core processing layer, wherein the basic supporting layer specifically comprises a constructor, a Bean object of a Spring container and a type converter register; the core processing layer specifically comprises a custom type converter, a constructor and a custom data verifier, and the custom data verifier is connected with the connection pool and can be used for verifying the frequency of interval control verification.
Step S22: and judging whether a file object exists in the target service data.
Step S23: and if the target service data does not have the file object, verifying the validity of the target service data through a self-defined data verifier.
In this embodiment, if the target service data does not have a file object, the validity of the target service data may be checked by a custom data checker, for example, JDBC type and JAVA type data are checked.
Step S24: if the file object exists in the target service data, an AOP agent is automatically created through a Spring framework, and the validity of the file object in the target service data is checked through the AOP agent.
Step S25: if the validity of the target service data passes, performing type conversion on the target service data through the custom type converter to obtain converted service data, and storing the converted service data.
For more specific processing procedures in the steps S22, S24, and S25, reference may be made to the corresponding contents disclosed in the foregoing embodiments, and no detailed description is given here.
It can be seen that, in the embodiment of the present application, a type converter register is used to find a custom type converter, and a custom data checker is used to check service data, and an AOP agent automatically created by a Spring framework is used to check a file object in the service data, and then a custom type converter is used to perform format conversion on the service data, so that in the service development process, optimization and customization can be performed according to specific scenes and requirements, thereby flexibly implementing format conversion and check of the service data, more meeting actual requirements, and having high flexibility; in addition, the method can be adapted to a plurality of ORM frameworks, has good expandability, can perform data format conversion and verification function expansion according to specific service requirements, and has strong expandability; in addition, the customized checker can be used for customized type converters according to service customized check rules, can be used for services, and has reusability.
Correspondingly, the embodiment of the application also discloses a service data storage device, which is applied to the database, and referring to fig. 5, the device comprises:
the searching module 11 is configured to search for a custom type converter through the type converter register when receiving a service data storage request sent by the client;
the data acquisition module 12 is configured to acquire target service data to be stored through the custom type converter;
the verification module 13 is configured to verify, by using a custom data verifier, validity of the target service data;
a format conversion module 14, configured to, if the validity check of the target service data passes, perform type conversion on the target service data by using the custom type converter, so as to obtain converted service data;
and the storage module 15 is used for storing the converted service data.
The specific workflow of each module may refer to the corresponding content disclosed in the foregoing embodiment, and will not be described herein.
It can be seen that, in this embodiment of the present application, when a service data storage request sent by a client is received, a type converter register is used to search for a custom type converter, a target service data to be stored is obtained through the custom type converter, then a custom data checker is used to check the validity of the target service data, if the validity check of the target service data is passed, the custom type converter is used to perform type conversion on the target service data to obtain converted service data, and the converted service data is stored. According to the embodiment of the application, the user-defined type converter is searched through the type converter register, the service data is checked through the user-defined data checker, and then the format conversion is carried out through the service data of the user-defined type converter, so that the format conversion and check function and the service code are decoupled, the validity of the service data can be flexibly checked, the format conversion of different types of service data is carried out, the service code is not required to be invaded, the service code can be decoupled, the maintainability, the expandability and the reusability of the system are improved, in addition, a plurality of main stream ORM frameworks can be adapted, and the data format conversion and the check function can be expanded according to different service requirements, so that the system has strong expandability.
In some specific embodiments, the service data storage device may further include:
the information acquisition unit is used for acquiring user-defined data verification strategies preset for different types of service data and data verification rules formulated for the user-defined data verification strategies;
the information storage unit is used for storing each self-defined data verification strategy and the corresponding data verification rule into the self-defined data verifier;
and the injection unit is used for injecting the custom data checker into the Bean object of the Spring container.
In some specific embodiments, the verification module 13 may specifically include:
the verifier acquisition unit is used for acquiring the self-defined data verifier from the Bean object of the Spring container;
a verification policy searching unit, configured to search, by using the custom data verifier, the custom data verification policy corresponding to the type of the target service data;
and the first verification unit is used for verifying the validity of the target service data through the data verification rule corresponding to the custom data verification policy.
In some specific embodiments, the data acquisition module 12 may specifically include:
the first data acquisition unit is used for acquiring target service data to be stored through the custom type converter and based on a reflection mechanism.
In some specific embodiments, the service data storage device may further include:
a converter and verifier acquisition unit for acquiring the pre-created custom type converter and the custom data verifier;
a checker injection unit for injecting the custom data checker into the custom type converter through a constructor;
and the registration unit is used for registering the self-defined type converter through the type converter register.
In some specific embodiments, the service data storage device may further include:
the judging unit is used for judging whether a file object exists in the target business data;
the second checking unit is used for executing the step of checking the validity of the target service data through the custom data checker if the file object does not exist in the target service data;
and the third verification unit is used for automatically creating an AOP agent through a Spring framework and verifying the validity of the file object in the target service data through the AOP agent if the file object exists in the target service data.
In some specific embodiments, the data acquisition module 12 may specifically include:
and the second data acquisition unit is used for acquiring target service data to be stored through the Sql Session interface and by utilizing the custom type converter.
Further, the embodiment of the present application further discloses an electronic device, and fig. 6 is a structural diagram of the electronic device 20 according to an exemplary embodiment, where the content of the drawing is not to be considered as any limitation on the scope of use of the present application.
Fig. 6 is a schematic structural diagram of an electronic device 20 according to an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input output interface 25, and a communication bus 26. Wherein the memory 22 is configured to store a computer program that is loaded and executed by the processor 21 to implement the relevant steps in the service data storage method disclosed in any of the foregoing embodiments. In addition, the electronic device 20 in the present embodiment may be specifically an electronic computer.
In this embodiment, the power supply 23 is configured to provide an operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and an external device, and the communication protocol to be followed is any communication protocol applicable to the technical solution of the present application, which is not specifically limited herein; the input/output interface 25 is used for acquiring external input data or outputting external output data, and the specific interface type thereof may be selected according to the specific application requirement, which is not limited herein.
The memory 22 may be a carrier for storing resources, such as a read-only memory, a random access memory, a magnetic disk, or an optical disk, and the resources stored thereon may include an operating system 221, a computer program 222, and the like, and the storage may be temporary storage or permanent storage.
The operating system 221 is used for managing and controlling various hardware devices on the electronic device 20 and computer programs 222, which may be Windows Server, netware, unix, linux, etc. The computer program 222 may further include a computer program capable of performing other specific tasks in addition to the computer program capable of performing the business data storage method performed by the electronic device 20 as disclosed in any of the foregoing embodiments.
Further, the application also discloses a computer readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the previously disclosed business data storage method. For specific steps of the method, reference may be made to the corresponding contents disclosed in the foregoing embodiments, and no further description is given here.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, so that the same or similar parts between the embodiments are referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The foregoing has described in detail a method, apparatus, device and storage medium for storing service data provided in the present application, and specific examples have been applied herein to illustrate the principles and embodiments of the present application, where the foregoing examples are provided to assist in understanding the method and core idea of the present application; meanwhile, as those skilled in the art will have modifications in the specific embodiments and application scope in accordance with the ideas of the present application, the present description should not be construed as limiting the present application in view of the above.

Claims (10)

1. A business data storage method, characterized by being applied to a database, comprising:
when a service data storage request sent by a client is received, searching a self-defined type converter through a type converter register, and acquiring target service data to be stored through the self-defined type converter;
verifying the validity of the target service data through a custom data verifier;
if the validity of the target service data passes, performing type conversion on the target service data through the custom type converter to obtain converted service data, and storing the converted service data.
2. The traffic data storage method according to claim 1, further comprising:
acquiring user-defined data verification strategies preset for different types of service data and data verification rules formulated for the user-defined data verification strategies;
storing each self-defined data verification policy and the corresponding data verification rule into the self-defined data verifier, and injecting the self-defined data verifier into a Bean object of a Spring container.
3. The service data storage method according to claim 2, wherein the verifying the validity of the target service data by the custom data verifier includes:
acquiring the custom data checker from the Bean object of the Spring container, and searching the custom data check strategy corresponding to the type of the target service data through the custom data checker;
and verifying the validity of the target service data through the data verification rule corresponding to the custom data verification strategy.
4. The service data storage method according to claim 1, wherein the obtaining, by the custom type converter, the target service data to be stored includes:
and acquiring target service data to be stored through the custom type converter and based on a reflection mechanism.
5. The traffic data storage method according to claim 1, further comprising:
acquiring the pre-established custom type converter and the custom data checker, and injecting the custom data checker into the custom type converter through a constructor;
registering the custom type converter through the type converter registrar.
6. The traffic data storage method according to claim 1, further comprising:
judging whether a file object exists in the target service data;
if the target service data does not have the file object, executing the step of verifying the validity of the target service data through a self-defined data verifier;
if the file object exists in the target service data, an AOP agent is automatically created through a Spring framework, and the validity of the file object in the target service data is checked through the AOP agent.
7. The service data storage method according to any one of claims 1 to 6, wherein the obtaining, by the custom type converter, the target service data to be stored includes:
and acquiring target service data to be stored through the Sql Session interface and by utilizing the self-defined type converter.
8. A business data storage device, characterized by being applied to a database, comprising:
the searching module is used for searching the self-defined type converter through the type converter register when receiving the service data storage request sent by the client;
the data acquisition module is used for acquiring target service data to be stored through the custom type converter;
the verification module is used for verifying the validity of the target service data through a self-defined data verifier;
the format conversion module is used for carrying out type conversion on the target service data through the custom type converter if the validity check of the target service data is passed, so as to obtain converted service data;
and the storage module is used for storing the converted service data.
9. An electronic device comprising a processor and a memory; wherein the processor, when executing the computer program stored in the memory, implements the business data storage method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program; wherein the computer program, when executed by a processor, implements a business data storage method as claimed in any one of claims 1 to 7.
CN202311624345.XA 2023-11-30 2023-11-30 Service data storage method, device, equipment and storage medium Pending CN117591089A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311624345.XA CN117591089A (en) 2023-11-30 2023-11-30 Service data storage method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311624345.XA CN117591089A (en) 2023-11-30 2023-11-30 Service data storage method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117591089A true CN117591089A (en) 2024-02-23

Family

ID=89913018

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311624345.XA Pending CN117591089A (en) 2023-11-30 2023-11-30 Service data storage method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117591089A (en)

Similar Documents

Publication Publication Date Title
US10585683B2 (en) Defining application programming interfaces (APIs) using object schemas
US9552237B2 (en) API validation system
RU2335799C2 (en) System and method, related to access to information
US10866828B2 (en) Extending object-schema-based application programming interfaces (APIs)
US20040205615A1 (en) Enhanced mechanism for automatically generating a transformation document
US8504543B1 (en) Automatic API generation for a web application
CN107222487B (en) Account docking system in hybrid cloud environment
RU2575987C2 (en) Data management in directory database
WO2012034440A1 (en) Method and device for generating database upgrading script
CN112560100B (en) Data desensitizing method and device, computer readable storage medium and electronic equipment
CN112559010B (en) Multi-application system data isolation implementation method and system based on micro-service
CN112699151B (en) Data processing method, device, equipment and medium
CN116955399A (en) Unified SQL query method, system and medium based on Calcite
CN110096541B (en) Method and device for data exchange between databases
CN115396180A (en) Micro service gateway unified authentication method, device, micro service gateway and storage medium
CN114281803A (en) Data migration method, device, equipment, medium and program product
US7076488B2 (en) XML-LDAP adapters and methods therefor
US8656275B2 (en) Matching various combinations of XPATH URIs to the same XML node
CN117591089A (en) Service data storage method, device, equipment and storage medium
US8621085B2 (en) Methods, systems, and computer program products for managing and utilizing connections between an application server and an enterprise information system based on a daytona architecture
CN113672233B (en) Server out-of-band management method, device and equipment based on Redfish
CN113468509B (en) User authentication migration method, device, equipment and storage medium
Goodwill Pure JSP--Java Server Pages: A Code-Intensive Premium Reference
CN114003583A (en) Method, device, medium and equipment for constructing target format data request body
CN111597389B (en) Data processing method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination