CN-115391334-B - Method for processing serial number, server, computer device and storage medium
Abstract
The application discloses a serial number processing method, a server, a computer device and a storage medium, wherein the serial number processing method comprises the steps of creating an original record of the serial number, wherein the serial number comprises a primary key, a name and a packet characterization, and the original record comprises the primary key, the name, the packet, a start number of the serial number, an end number of the serial number and a current position; in response to the allocation request, an allocation record is generated and an allocated sequence of sequence numbers is returned, wherein the allocation record is characterized as a record in which the current position in the original record was moved one position back. The serial number main key is shorter, the storage space is not wasted, and the query efficiency is high.
Inventors
- LI YABIN
Assignees
- 平安银行股份有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20220721
Claims (8)
- 1. A method for processing a serial number, comprising: Creating an original record of a sequence number, wherein the sequence number comprises a primary key, a name, and a packet characterization, the original record comprising the primary key, the name, the packet, a start number of the sequence number, an end number of the sequence number, and a current location; generating an allocation record in response to an allocation request and returning an allocated sequence of the sequence numbers, wherein the allocation record is characterized as a record in the original record in which the current position is moved one position backward; In response to receiving a release sequence number, wherein the name and the packet of the release sequence number are the same as the name and the packet in the original record, a first sub-record is newly added in the allocation record to update the allocation record table, wherein the first sub-record characterizes the release sequence number, and the first sub-record is characterized in the same way as the allocation record and is positioned below the allocation record; Obtaining a continuous serial number from the updated distribution record, and modifying the distribution record according to the continuous serial number, wherein in the modified distribution record, the end number of the first serial number in the continuous serial number is modified to increase the number of the continuous serial number, and the rest serial numbers in the continuous serial number are marked as modified; Wherein the consecutive sequence numbers include a first sequence number and a second sequence number, wherein an end number of the first sequence number is greater than a current position of the second sequence number, and a difference between the end number of the first sequence number and the current position of the second sequence number is 1.
- 2. The method as recited in claim 1, further comprising: And responding to the fact that the current position is the same as the end number of the serial number, and recovering the corresponding distribution record.
- 3. The method as recited in claim 1, further comprising: And responding to another allocation request, processing the allocation record so that a first sub-record corresponding to the release sequence number is marked as allocated, and returning the release sequence number, wherein the other allocation request characterizes that the request is allocated with the release sequence number.
- 4. The method as recited in claim 1, further comprising: and acquiring an unreleased serial number from the updated distribution record, and adding a second sub-record in the updated distribution record, wherein the second sub-record characterizes the unreleased serial number, so that the unreleased serial number is released.
- 5. The method of claim 4, wherein the obtaining the unreleased sequence number from the updated allocation record is performed at a preset time interval.
- 6. A server comprising a processor, a memory and a transceiver, the transceiver being for communication connection with a client terminal and a banking terminal, the memory storing a computer program, the processor being for executing the computer program to implement the method of any one of claims 1 to 5.
- 7. A computer device, comprising: A processor; A memory coupled to the processor for storing a computer program executable on the processor; wherein the processor, when executing the computer program, implements the method of any of claims 1 to 5.
- 8. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a computer program which, when executed by a processor, implements the method of any of claims 1 to 5.
Description
Method for processing serial number, server, computer device and storage medium Technical Field The present application relates to the field of financial technologies, and in particular, to a serial number processing method, a server, a computer device, and a storage medium. Background The serial number is used for uniquely representing the system element, is widely applied to the field of Internet and can be optimized. The self-increasing serial number has the disadvantages of still occupying the release and having no perception of overflowing, and the self-increasing serial number wager can never reach the upper use limit, so that the maximum length of the serial number has to be set long, the serial number occupies more space and occupies more storage space, and the serial number inquiry efficiency is lower. Disclosure of Invention In view of the above, the present application provides a serial number processing method, a server, a computer device and a storage medium, so as to solve the problems of more occupation of a self-increasing serial number, large occupation of memory and low query efficiency in the prior art. In order to solve the technical problems, the first technical scheme provided by the application is that a processing method of a serial number is provided, which comprises the steps of creating an original record of the serial number, wherein the serial number comprises a primary key, a name and a packet characterization, the original record comprises the primary key, the name, the packet, a start number of the serial number, an end number of the serial number and a current position, responding to an allocation request, generating an allocation record, and returning an allocated sequence in the serial number, wherein the allocation record is characterized in that the current position in the original record is moved backwards by one position. Optionally, further comprising retrieving the corresponding allocation record in response to the current location being the same as the end number of the serial number. Optionally, further comprising, in response to receiving a release sequence number, and wherein the name and the packet of the release sequence number are the same as the name and the packet in the original record, adding a first sub-record in the allocation record to update the allocation record table, wherein the first sub-record characterizes the release sequence number and the first sub-record is characterized in the same manner as the allocation record and is located below the allocation record. Optionally, the method further comprises processing the allocation record in response to another allocation request, so that a first sub-record corresponding to the release sequence number is marked as allocated, and returning the release sequence number, wherein the other allocation request characterizes that the release sequence number is allocated. Optionally, the method further comprises the steps of obtaining an unreleased serial number from the updated distribution record, and adding a second sub-record in the updated distribution record, wherein the second sub-record characterizes the unreleased serial number, so that the unreleased serial number is released. Optionally, the acquiring the unreleased serial number from the updated allocation record is performed at a preset time interval. Optionally, the method further comprises the steps of obtaining continuous serial numbers from the updated distribution record and modifying the distribution record according to the continuous serial numbers, wherein in the modified distribution record, the end number of a first serial number in the continuous serial numbers is modified to be increased by the number of the continuous serial numbers, the rest serial numbers in the continuous serial numbers are marked as modified, the continuous serial numbers comprise a first serial number and a second serial number, the end number of the first serial number is larger than the current position of the second serial number, and the difference between the end number of the first serial number and the current position of the second serial number is 1. In order to solve the technical problem, a second technical scheme provided by the application is that a server comprises a processor, a memory and a transceiver, wherein the transceiver is used for being in communication connection with a client terminal and a bank terminal, the memory stores a computer program, and the processor is used for executing the computer program to realize the method of any one of the above. In order to solve the technical problem, the third technical scheme provided by the application is that a computer device is provided, which comprises a processor and a memory, wherein the memory is connected with the processor and is used for storing a computer program which can run on the processor, and the method of any one of the above is realized when the processor executes the computer p