A method and system for achieving efficient data storage in semiconductor MES systems by extending MyBatisPlus.
By introducing a data versioning mechanism and a logical deletion mechanism into the semiconductor MES system, combined with optimistic locking concurrency control and full update functionality, the consistency and reliability issues of data storage in semiconductor manufacturing using the MyBatisPlus framework are resolved, achieving efficient data storage and management.
Patent Information
- Application Number
- CN202512015788.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-30
- Publication Date
- 2026-03-10
- Estimated Expiration
- 2045-12-30
AI Technical Summary
In the semiconductor manufacturing process, when data is stored using the MyBatisPlus framework, it is impossible to detect version conflicts in real time during data updates, leading to data overwriting and loss, which affects the consistency and reliability of production data.
A data versioning mechanism and a logical deletion mechanism are introduced, and optimistic locking concurrency control is used to generate data version check results. The MyBatisPlus framework is extended to implement full update functionality, define full update SQL statements, enhance SQL injection capabilities and mappers, and ensure the consistency and reliability of data operations.
It enables real-time detection of data conflict risks in concurrent write scenarios, ensuring data integrity and reliability, and improving the flexibility of data management and the accuracy and stability of system decisions.
Smart Images

Figure CN121434222B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of semiconductor intelligent manufacturing technology, specifically to a method and system for achieving efficient data storage in a semiconductor MES system by extending MyBatisPlus. Background Technology
[0002] Semiconductor manufacturing-related products, abbreviated as IC (Integrated Circuit), also known as microcircuits, microchips, wafers, and chips, are a way to miniaturize circuits in electronics, and are often manufactured on the surface of semiconductor wafers. The MES system is essentially a digital model of the real-time operation of a semiconductor manufacturing plant (FAB). The data it stores is a true reflection of the real-time production status of the FAB, which requires the MES system to accurately and flexibly maintain its modeling data.
[0003] Currently, in the field of semiconductor intelligent manufacturing, when using the MyBatisPlus framework for data storage, due to the frequent data updates and intensive concurrent operations in semiconductor manufacturing execution systems, existing technical solutions cannot detect version conflicts in real time when directly using the default MyBatisPlus mechanism for data persistence. When concurrent writes occur without version consistency verification, data overwriting and loss can occur, affecting the consistency and reliability of semiconductor production data.
[0004] Therefore, this paper proposes an extended MyBatisPlus system and method for achieving efficient data storage in semiconductor manufacturing to address the aforementioned issues. Summary of the Invention
[0005] To address the shortcomings of existing technologies, this invention provides a method and system for achieving efficient data storage in a semiconductor MES system by extending MyBatisPlus. This solves the problems mentioned in the background art, such as the inability to detect version conflicts during data updates in real time, and the impact on the consistency and reliability of semiconductor production data.
[0006] To achieve the above objectives, the present invention provides the following technical solution: a method and system for achieving efficient data storage in a semiconductor MES system by extending MyBatisPlus, the method comprising the following steps:
[0007] S1. Introduce a data versioning mechanism and a logical deletion mechanism. Add a data version field and a data availability status field to the database table, and initialize the version information and set the availability status when the data is created.
[0008] S2. Based on the data version mechanism, perform optimistic locking concurrency control processing to generate data version check results;
[0009] S3. Based on the data version check results and logical deletion mechanism, perform data operation processing to generate data update and deletion instructions;
[0010] S4. In response to the data operation processing, extend the MyBatisPlus framework to supplement the full update function, define a template method for full data update, and implement the pre-generation of full update SQL statements;
[0011] S5. Based on the template method of the full update data, perform custom SQL injection processing, and implant the template method into the injector to enhance the SQL injection function;
[0012] S6. Extend the MyBatisPlus default mapper by using a custom SQL mapper, and use the custom SQL injector to complete the mapping between template methods and data access objects;
[0013] S7. During the system startup phase, replace the custom SQL injector and create a data access factory. Perform data operations based on the data version mechanism, logical deletion mechanism, and template method for full data update to generate data storage results.
[0014] Preferably, the introduction of the data versioning mechanism and logical deletion mechanism in S1, which involves adding a data version field and a data availability status field to the database table, and initializing the version information and setting the availability status when the data is created, includes the following operations:
[0015] S11. When creating a database table, introduce a data version field. The field type is a 32-bit positive integer, and initialize the version information to 0 when the first data record is created.
[0016] The initialization formula for the version field is normalized as follows:
[0017] ;
[0018] in, As the initial value for the data version, this formula normalizes the version value to a zero starting point, ensuring the consistency of the baseline for data version management;
[0019] S12. When creating a database table, introduce a data availability status field with a boolean type, and set the status to available when the data record is first created;
[0020] S13. Optimistic locking concurrency control is supported through the data version field, and logical deletion function is implemented through the data availability status field.
[0021] Preferably, the optimistic locking concurrency control processing based on the data version mechanism in S2, which generates the data version check result, includes the following operations:
[0022] S21. Include the current data version value as the expected version in the data update request;
[0023] S22. Read the actual version value of the target data from the database, compare it with the expected version, and generate a data version check result;
[0024] S23. When the data version check result is consistent, perform the update operation and accumulate the data version; when inconsistent, abandon the update and notify the operator of the data conflict.
[0025] The normalized formula for version checking is as follows:
[0026] ;
[0027] in, This is the expected version number. This is the actual version number. Let be the threshold, and the threshold is defined as . This indicates that the versions must be strictly consistent to pass the check.
[0028] Preferably, the data operation processing in step S3 based on the data version check result and logical deletion mechanism to generate data update and deletion instructions includes the following operations:
[0029] S31. When the data operation is an update, optimistic locking is performed based on the data version check result to generate a data update instruction.
[0030] S32. When the data operation is deletion, replace physical deletion with logical deletion and generate a data deletion instruction by modifying the data availability status field.
[0031] S33. Integrate the data update and deletion instructions to ensure that the operation complies with concurrency control and data security requirements.
[0032] Preferably, in S4, in response to the data operation processing, the MyBatisPlus framework is extended to supplement the full update function, a template method for full data update is defined, and the pre-generation of full update SQL statements includes the following operations:
[0033] S41. Design a full update template interface to support the generation of update SQL statements based on all attributes of a data object;
[0034] S42. Implement a template for full update of a single data record, obtain all attribute values of the object through reflection, and construct a full update SQL;
[0035] S43. Implement a full batch data update template to optimize batch operation performance and reduce database overhead by using pre-compiled SQL.
[0036] Preferably, the template method based on the full update data in S5 is used for custom SQL injection processing. The template method is implanted into the injector to enhance the SQL injection function, including the following operations:
[0037] S51. Inherit the default AbstractSqlInjector class of MyBatisPlus and retain the original methods of the framework;
[0038] S52. By overriding the inspectInject method, register the full template update method as a new SQL method;
[0039] S53. Implant the full update template method into the injector to enhance the SQL injection function.
[0040] Preferably, the step S6, which extends the MyBatisPlus default mapper with a custom SQL mapper and uses the custom SQL injector to complete the mapping between template methods and data access objects, includes the following operations:
[0041] S61. Extend the BaseMapper interface of MyBatisPlus and add a full update method definition;
[0042] S62. Associate the custom SQL injector with the data access object through XML configuration and annotation.
[0043] S63. Generate proxy instances for each type of data access object to implement the mapping between template methods and objects.
[0044] Preferably, in step S7, during the system startup phase, the custom SQL injector is replaced and a data access factory is created. Data operations are performed based on the data versioning mechanism, logical deletion mechanism, and template method for full data update, generating data storage results including the following operations:
[0045] S71. Replace the custom SQL injector in the system to complete the integration of the full update function;
[0046] S72. Create a data access factory to manage the query, addition, update, and deletion operations of data access objects;
[0047] S73. Based on the data versioning mechanism, logical deletion mechanism, and full update method, perform data operations and generate data storage results.
[0048] Preferably, the method further includes a data recovery operation: when an operator accidentally deletes data, the data availability status field is reset to available through the recovery interface provided by the logical deletion mechanism, thereby achieving rapid data recovery.
[0049] Preferably, the system includes:
[0050] The optimistic locking module adds and initializes a data version field in the database table through the version field management unit, and compares the expected version with the actual version using the version checking unit, and outputs the data version checking result.
[0051] The logical deletion module adds and sets the data availability status field in the database table through the status field management unit, converts the deletion operation into a status flag through the status update unit, and automatically hides the logically deleted data through the query filtering unit.
[0052] The extension module receives the data version check results and status update instructions, defines single and batch full update methods through the full update template unit, uses the SQL injector unit to inherit and extend the MyBatisPlus default injector to inject template methods, and uses the mapper unit to implement the binding of template methods with data access objects.
[0053] The loading module loads a custom SQL injector at system startup via the injector replacement unit, manages data operation instances using the data access factory unit, and performs data storage operations based on the outputs of the optimistic locking module, logical deletion module, and extension module.
[0054] Compared with existing technologies, this invention provides a method and system for achieving efficient data storage in a semiconductor MES system by extending MyBatisPlus, which has the following beneficial effects:
[0055] 1. In this invention, by introducing a data versioning mechanism and optimistic locking concurrency control, version consistency verification is automatically performed before data update operations, enabling the system to detect data conflict risks in concurrent write scenarios in real time, avoiding data overwriting and loss problems caused by version inconsistency, ensuring the data integrity and data consistency of semiconductor factory production data in multi-person collaborative scenarios, and further improving the data reliability of the manufacturing execution system.
[0056] 2. In this invention, by introducing a logical deletion mechanism and managing the data availability status field, the deletion operation is transformed into a reversible status update operation, enabling the system to retain data recovery capability when deleting key process parameters. At the same time, the automatic query filtering mechanism blocks logically deleted data, reducing the complexity of data retrieval, ensuring the security and traceability of semiconductor production data, and further improving the flexibility of system data management.
[0057] 3. In this invention, a template method for full data update is defined by extending the MyBatisPlus framework, and full synchronization of data objects and database records is achieved based on a custom SQL injector and a custom SQL mapper. This ensures the complete consistency between memory data and database stored data when the system processes real-time data from the device, avoiding the problem of data field inconsistency caused by partial updates, and further improving the accuracy and stability of decision-making in the intelligent manufacturing system. Attached Figure Description
[0058] Figure 1 This is a flowchart illustrating the steps of the method for achieving efficient data storage in the semiconductor MES system of the present invention by extending MyBatisPlus;
[0059] Figure 2 This is a schematic diagram of the architecture of the semiconductor MES system of the present invention, which achieves efficient data storage by extending MyBatisPlus.
[0060] Figure 3 This is a schematic diagram illustrating the operating principle of the present invention.
[0061] Figure 4 This is a flowchart illustrating the steps of optimistic locking and logical deletion in this invention. Detailed Implementation
[0062] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0063] One embodiment of this invention discloses a method for efficiently storing data in an extended semiconductor MES system by extending MyBatis Plus. MyBatis Plus is an enhanced toolkit of the excellent data persistence framework MyBatis. While retaining the flexibility of MyBatis, it significantly improves development efficiency through built-in common functions, simplified configuration, and extended plugins. MyBatis Plus provides two data update strategies: partial data update and full data update, but does not provide a strategy that supports both partial and full data updates simultaneously. Please refer to [link to relevant documentation]. Figure 1-4 The specific implementation of this method is as follows, including the following steps:
[0064] S1. Introduce a data versioning mechanism and a logical deletion mechanism. Add a data version field and a data availability status field to the database table, and initialize the version information and set the availability status when the data is created.
[0065] S2. Optimistic locking concurrency control is performed based on the data versioning mechanism to generate data version check results;
[0066] S3. Based on the data version check results and logical deletion mechanism, perform data operation processing and generate data update and deletion instructions;
[0067] S4. In response to data operation and processing, the MyBatisPlus framework is extended to supplement the full update function, defining a template method for full data update and implementing the pre-generation of full update SQL statements; among them, the SQL statements are used to operate and define the standard structured query language of relational databases, and the core functions cover data query, update, structure management and access control.
[0068] S5. Custom SQL injection is performed based on the template method of full data update, and the template method is injected into the injector to enhance the SQL injection function.
[0069] S6. Extend the MyBatisPlus default mapper by using a custom SQL mapper, and use a custom SQL injector to complete the mapping between template methods and data access objects;
[0070] S7. During the system startup phase, replace the custom SQL injector and create a data access factory. Perform data operations based on the data version mechanism, logical deletion mechanism, and template method for full data update, and generate data storage results.
[0071] S1 introduces a data versioning mechanism and a logical deletion mechanism, adding data version fields and data availability status fields to the database table, and initializing version information and setting availability status when data is created, including the following operations:
[0072] S11. When creating a database table, introduce a data version field. The field type is a 32-bit positive integer, and initialize the version information to 0 when the first data record is created.
[0073] The initialization formula for the version field is normalized as follows:
[0074] ;
[0075] in, As the initial value for the data version, this formula normalizes the version value to a zero starting point, ensuring the consistency of the baseline for data version management;
[0076] S12. When creating a database table, introduce a data availability status field with a boolean type, and set the status to available when the data record is first created;
[0077] S13. Support optimistic locking concurrency control through the data version field, and implement logical deletion function through the data availability status field.
[0078] S2's optimistic locking concurrency control based on a data versioning mechanism generates data version check results through the following operations:
[0079] S21. Include the current data version value as the expected version in the data update request;
[0080] S22. Read the actual version value of the target data from the database, compare it with the expected version, and generate a data version check result;
[0081] Specifically, the version comparison algorithm employs database transaction isolation levels to ensure read consistency. The comparison process includes: first, executing a SELECT query to obtain the actual version; then, performing an atomic comparison with the expected version; if they match, execution continues; otherwise, it rolls back. The algorithm flow is normalized as follows:
[0082] ;
[0083] in, The function name is a boolean value. and This result directly determines whether subsequent operations should continue or be rolled back. For the Boolean value "true", For the Boolean value "false", This is the actual version number of the variable. The subscript "actual" indicates that this is the current version number of the target data actually read from the database. The variable is the expected version number. The subscript "expected" indicates that this is the data version number held and expected by the client when the update operation is initiated. "A conditional keyword, meaning "if". This is a conditional keyword, meaning "otherwise," used to control update operations based on the comparison results and avoid dirty reads.
[0084] S23. When the data version check result is consistent, perform the update operation and accumulate the data version; when inconsistent, abandon the update and notify the operator of the data conflict.
[0085] The normalized formula for version checking is as follows:
[0086] ;
[0087] in, This is the expected version number. This is the actual version number. Let be the threshold, and the threshold is defined as . This indicates that the versions must be strictly consistent to pass the check.
[0088] S3 performs data operations based on data version check results and logical deletion mechanisms, generating data update and deletion commands including the following operations:
[0089] S31. When the data operation is an update, optimistic locking is performed based on the data version check result to generate a data update instruction.
[0090] S32. When the data operation is deletion, replace physical deletion with logical deletion and generate a data deletion instruction by modifying the data availability status field.
[0091] Specifically, this includes: first, reading the current status field value of the data; then, determining whether deletion is allowed based on the version check result; if allowed, performing a status update, changing the data availability status field from "available" to "invalid," with the status transition formula normalized as follows:
[0092] ;
[0093] in, This is the data state before the operation. This refers to the data status after the operation. For state transition functions, threshold Defined as the tolerance parameter for state transitions, and This ensures that state changes are strictly synchronized and adds exception handling to trigger transaction rollback when the states are inconsistent.
[0094] S33. Integrate data update and deletion commands to ensure that operations comply with concurrency control and data security requirements.
[0095] In S4, in response to data manipulation, the MyBatisPlus framework is extended to supplement the full update functionality. A template method for full data update is defined, and the pre-generation of full update SQL statements includes the following operations:
[0096] S41. Design a full update template interface to support the generation of update SQL statements based on all attributes of a data object;
[0097] S42. Implement a template for full update of a single data record, obtain all attribute values of the object through reflection, and construct a full update SQL;
[0098] Specifically, this includes: implementing the Java Reflection API through reflection; the algorithm steps include: obtaining the object's Class instance, iterating through the DeclaredFields list, ignoring static fields, dynamically generating SQL placeholders, and introducing a caching mechanism to optimize performance and reduce reflection overhead. The cache size threshold is defined as follows:
[0099] ;
[0100] The formula for representing the maximum number of cached objects is enhanced as follows:
[0101] ;
[0102] in, For a data object, it is a collection of all fields. A collection of database table fields. The system load factor is dynamically adjusted to ensure mapping integrity and a threshold. This represents the upper limit of the field mapping deviation, and This ensures that all fields are mapped completely without omission.
[0103] S43. Implement a full batch data update template to optimize batch operation performance and reduce database overhead by using pre-compiled SQL.
[0104] The batch processing algorithm uses JDBC batch processing mode, and the batch size is dynamically adjusted. The formula is:
[0105] ;
[0106] in, For the maximum allowable delay, To achieve adaptive optimization of the average operation time.
[0107] In S5, a custom SQL injection tool is used based on a template method that updates data across the entire database. This tool embeds the template method into the injection tool, allowing the program to automatically generate the corresponding SQL statement before each database operation and execute it through the MyBatis framework. This enhanced SQL injection functionality includes the following operations:
[0108] S51. Inherit the default AbstractSqlInjector class of MyBatisPlus and retain the original methods of the framework;
[0109] S52. By overriding the inspectInject method, register the full template update method as a new SQL method;
[0110] The normalization formula for template method registration is:
[0111] ;
[0112] in, This is a method for fully updating the template. This is an SQL injection instance. Register a function for the method, threshold This is the lower limit for the registration success rate, and This ensures successful method binding.
[0113] S53. Inject the full update template method into the injector to enhance SQL injection functionality.
[0114] In S6, extending the MyBatisPlus default mapper with a custom SQL mapper and using a custom SQL injector to map template methods to data access objects includes the following operations:
[0115] S61. Extend the BaseMapper interface of MyBatisPlus and add a full update method definition;
[0116] S62. Associate the custom SQL injector with the data access object through XML configuration and annotation.
[0117] S63. Generate proxy instances for each type of data access object to implement the mapping between template methods and objects;
[0118] The normalization formula for its mapping relationship is:
[0119] ;
[0120] in, For a full update of the template method set, Let r be the set of data access objects, representing the feature space of the target object (e.g., contour features, texture features, key point coordinate vectors, etc.) of the target object to be detected; m is the template transformation operator, m(r) indicates that m acts on r, meaning that the template transformation operation is applied to the target r to obtain the transformed target features; threshold As a mapping error tolerance, and This ensures that the mapping is unbiased.
[0121] In S7, during the system startup phase, a custom SQL injector is replaced and a data access factory is created. Data operations are performed based on data versioning mechanisms, logical deletion mechanisms, and template methods for full data updates, generating data storage results including the following operations:
[0122] S71. Replace the custom SQL injector in the system to complete the integration of the full update function;
[0123] S72. Create a data access factory to manage the query, addition, update, and deletion operations of data access objects;
[0124] The normalization formula for the factory instantiation process is:
[0125] ;
[0126] in, For custom SQL injection, For a collection of data access objects, Build functions for the factory, threshold Defined as the upper limit of instantiation time, and ,in This is the maximum allowed delay time of the system;
[0127] S73. Based on the data versioning mechanism, logical deletion mechanism, and full update method, perform data operations and generate data storage results.
[0128] The method also includes data recovery operations: when an operator accidentally deletes data, the data availability status field is reset to available through the recovery interface provided by the logical deletion mechanism, enabling rapid data recovery;
[0129] The normalized formula for determining the recovery condition is:
[0130] ;
[0131] in, This represents the current data status. The threshold is the baseline value for the failure state. For state difference tolerance, and This ensures that recovery operations are only performed on strictly failed states.
[0132] The system includes:
[0133] The optimistic locking module adds and initializes a data version field in the database table through the version field management unit, and compares the expected version with the actual version using the version checking unit, and outputs the data version checking result.
[0134] The logical deletion module adds and sets the data availability status field in the database table through the status field management unit, converts the deletion operation into a status flag through the status update unit, and automatically hides the logically deleted data through the query filtering unit.
[0135] The extension module receives data version check results and status update instructions. It defines single and batch full update methods through the full update template unit, uses the SQL injector unit to inherit and extend the MyBatisPlus default injector to inject template methods, and uses the mapper unit to bind template methods to data access objects.
[0136] The loading module loads a custom SQL injector at system startup via the injector replacement unit, manages data operation instances using the data access factory unit, and performs data storage operations based on the outputs of the optimistic locking module, logical deletion module, and extension module.
[0137] The normalized formula for the constraints of data flow between system modules is:
[0138] ;
[0139] in, For the processing time of each module, the threshold This is the upper limit of the total system response time, and ,in This refers to the threshold for real-time performance requirements in semiconductor manufacturing scenarios.
[0140] The method and operation steps of a semiconductor MES system to achieve efficient data storage by extending MyBatisPlus are as follows:
[0141] Step 1: Establishing the Data Infrastructure Mechanism
[0142] First, a data management foundation is established by introducing a data versioning mechanism and a logical deletion mechanism. A data version field and a data availability status field are added to the database table. When the data is created, the version information is initialized and the availability status is set. The data version field adopts a 32-bit positive integer type and is initially set to 0, which provides a basis for subsequent optimistic locking concurrency control. The data availability status field adopts a boolean type and is initially set to available, which supports the logical deletion function. This step ensures that the data has version management and status tracking capabilities during the creation stage.
[0143] Step 2: Concurrency Control and Data Operation Processing Steps
[0144] Optimistic locking concurrency control is implemented based on a data versioning mechanism. Data version check results are generated, and the current data version value is carried in the data update request as the expected version. This is compared and verified with the actual version value in the database. If the version checks match, the data update operation is executed and the version number is incremented. If the versions do not match, the operation is abandoned and a data conflict is notified. Data operation processing is performed based on the data version check results and the logical deletion mechanism. Version control is performed for update operations, and physical deletion is converted into logical deletion status updates for deletion operations, generating corresponding data update and deletion instructions.
[0145] Step 3: Framework Functionality Extension and Template Method Definition
[0146] In response to data operation and processing needs, the MyBatisPlus framework is extended to supplement the full update function. A template method for full data update is defined, including two template types: single data full update and batch data full update. Through reflection, all attribute fields of the data object are traversed to ensure a complete mapping relationship with the database table structure. Full update SQL statements are pre-generated to solve the problem of data field inconsistency caused by partial updates, and to provide basic support for full data synchronization.
[0147] Step 4: SQL Injector and Mapper Extension Steps
[0148] This code implements a custom SQL injection tool based on the template method for full data updates. It inherits from the default MyBatisPlus class, `AbstractSqlInjector`, and overrides the `inspectInject` method. The full update template method is embedded into the injector, enhancing SQL injection capabilities. While retaining the framework's original methods, it expands the full update capability by extending the default MyBatisPlus mapper with a custom SQL mapper. The custom SQL injector establishes the mapping relationship between the template method and the data access object, generating a proxy instance with full update capabilities for each type of data access object.
[0149] Step 5: System Integration and Data Operation Execution Steps
[0150] During the system startup phase, a custom SQL injector is replaced and a data access factory is created to achieve complete integration of various functional modules. The data access factory manages data operation instances based on the dependency injection mechanism, uniformly handles query, add, update and delete operations, and executes data operations based on the data version mechanism, logical deletion mechanism and template method of full data update. Data consistency and reliability are ensured through version checking, status update and full synchronization, and finally data storage results that meet the requirements of semiconductor intelligent manufacturing are generated.
[0151] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0152] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A method for a semiconductor MES system to achieve efficient data storage by extending MyBatisPlus, characterized in that, The method comprises the following steps: S1, introducing a data version mechanism and a logical deletion mechanism, adding a data version field and a data availability state field in a database table, and initializing version information and setting the availability state when data is created; S2, performing optimistic lock concurrency control processing based on the data version mechanism to generate a data version check result; S3, performing data operation processing according to the data version check result and the logical deletion mechanism to generate data update and deletion instructions; S4, in response to the data operation processing, extending the MyBatisPlus framework to supplement the full update function, defining a template method for full update data, and realizing pre-generated full update SQL statements; S5, based on the template method for full update data, performing custom SQL injector processing, implanting the template method into the injector, and enhancing the SQL injection function; S6, extending the MyBatisPlus default mapper through the custom SQL mapper, and completing the mapping of the template method and the data access object by using the custom SQL injector; S7, in the system startup stage, replacing the custom SQL injector and creating a data access factory, performing data operation based on the data version mechanism, the logical deletion mechanism and the template method for full update data, and generating data storage results; In the S5, based on the template method for full update data, performing custom SQL injector processing, implanting the template method into the injector, and enhancing the SQL injection function, comprising the following operations: S51, inheriting the default AbstractSqlInjector class of MyBatisPlus, and retaining the original method of the framework; S52, by rewriting the inspectInject method, registering the full update template method as a new SQL method; S53, implanting the full update template method into the injector to enhance the SQL injection function; In the S6, extending the MyBatisPlus default mapper through the custom SQL mapper, and completing the mapping of the template method and the data access object by using the custom SQL injector, comprising the following operations: S61, extending the BaseMapper interface of MyBatisPlus, and adding full update method definition; S62, associating the custom SQL injector and the data access object through XML configuration and annotation method; S63, generating a proxy instance for each class of data access object to realize the mapping of the template method and the object.
2. The method for efficient data storage of the semiconductor MES system by extending MyBatisPlus according to claim 1, characterized in that, In the S1, introducing the data version mechanism and the logical deletion mechanism, adding the data version field and the data availability state field in the database table, and initializing the version information and setting the availability state when the data is created, comprising the following operations: S11, introducing the data version field when creating the database table, the field type is 32-bit positive integer, and initializing the version information to 0 when creating the data record for the first time; Wherein, the initialization formula of the version field is normalized as: ; wherein, is the initial value of the data version, the formula normalizes the version value to a zero starting point, ensuring the benchmark consistency of data version management; S12, introducing the data availability state field when creating the database table, the field type is Boolean, and setting the state to available when creating the data record for the first time; S13, support optimistic lock concurrency control through the data version field, and implement logical deletion function through the data available state field.
3. The method for efficient data storage of the semiconductor MES system through the extension of MyBatisPlus according to claim 1, characterized in that, The optimistic lock concurrency control processing based on the data version mechanism in S2 generates a data version check result, including the following operations: S21, carry the current data version value as the expected version in the data update request; S22, read the actual version value of the target data from the database, compare it with the expected version, and generate a data version check result; S23, when the data version check result is consistent, execute the update operation and accumulate the data version, and when it is inconsistent, abandon the update and notify the operator of data conflict; Wherein, the condition formula of version check is normalized as: ; wherein, is an expected version number, is an actual version number, is a threshold value, and the threshold value is defined as , indicates that the versions must be strictly identical to pass the check.
4. The method for efficient data storage of the semiconductor MES system through the extension of MyBatisPlus according to claim 1, characterized in that, The data operation processing according to the data version check result and the logical deletion mechanism in S3 generates data update and deletion instructions, including the following operations: S31, when the data operation is update, execute the optimistic lock control based on the data version check result, and generate the data update instruction; S32, when the data operation is delete, replace physical deletion with logical deletion, and generate the data deletion instruction by modifying the data available state field; S33, integrate the data update instruction and the deletion instruction to ensure that the operation meets the requirements of concurrency control and data security.
5. The method for efficient data storage of the semiconductor MES system through the extension of MyBatisPlus according to claim 1, characterized in that, The MyBatisPlus framework is extended to supplement the full update function in response to the data operation processing in S4, a template method for full update data is defined, and the pre-generated full update SQL statement is implemented, including the following operations: S41, design a full update template interface to support generating update SQL statements based on all properties of data objects; S42, implement a single data full update template to obtain all property values of the object through the reflection mechanism and construct a full update SQL; S43, implement a batch data full update template to optimize batch operation performance and reduce database overhead by using precompiled SQL.
6. The method for efficient data storage of the semiconductor MES system of claim 1, wherein, In the system startup phase, the custom SQL injector is replaced and the data access factory is created in S7, and the data operation is executed based on the data version mechanism, the logical deletion mechanism and the template method for full update data to generate data storage results, including the following operations: S71, replace the custom SQL injector in the system to complete the integration of the full update function; S72, create a data access factory to manage query, add, update and delete operations of data access objects; S73, execute data operation and generate data storage result based on data version mechanism, logical deletion mechanism and full update method.
7. The method for efficient data storage of the semiconductor MES system of claim 1, wherein, The method further includes a data recovery operation: when the operator mistakenly deletes data, the data available state field is reset to available through the recovery interface provided by the logical deletion mechanism to realize fast data recovery.
8. A system for efficiently storing data by extending MyBatisPlus in a semiconductor MES system, for implementing the method of any one of claims 1-7, characterized in that the system It includes: An optimistic lock module, which adds and initializes a data version field in a database table through a version field management unit, compares the expected version with the actual version through a version check unit, and outputs a data version check result; The logic deletion module adds and sets a data available state field in a database table through a state field management unit, converts a deletion operation into a state mark through a state update unit, and automatically shields logically deleted data through a query filtering unit; The extension module receives the data version check result and the state update instruction, defines a single and batch full update method through a full update template unit, inherits and extends a MyBatisPlus default injector implanted template method through a SQL injector unit, and realizes the binding of the template method and a data access object through a mapper unit; The loading module loads a custom SQL injector at system startup through an injector replacement unit, manages data operation instances through a data access factory unit, and executes a data storage operation based on the output of the optimistic lock module, the logic deletion module and the extension module.
Citation Information
Patent Citations
A system and method for realizing master data version management based on an optimistic lock mechanism under the background of big data
CN109446214A
SQL extraction method and device for MyBatis application program
CN111949491A