Serial number management

This article introduces the application of Sequence in CRudAPI through product code and order Sequence number.

The profile

The serial number

MySQL database has no separate Sequence; MySQL database supports only increment primary key; MySQL database supports only increment primary key; MySQL database has no separate Sequence; MySQL database supports only increment primary key; MySQL database has no separate Sequence; MySQL database supports only increment primary key; MySQL database has no separate Sequence; MySQL database supports only increment primary key; MySQL database has no separate Sequence; MySQL database supports only increment primary key; MySQL database has no separate Sequence; MySQL database supports only increment primary key; MySQL database has no separate Sequence; MySQL database supports only increment primary key; MySQL database has no separate Sequence; MySQL database supports only increment primary key; MySQL itself can’t implement this, so CrudAPI encapsulates complex serial numbers, supports strings and numbers, custom formats, and can be set to timestamps. Can be used for product coding, order sequence number and other scenarios!

Configuration Serial number

The product code

The product code is a string in the format of PROD_% 09D, indicating that the length is 9 and the width is not sufficient. The minimum value starts from 1, the maximum value is 999999999, the next value is 1, and the step size is 1.

Serial number of sales order

The product code is in the format of ‘SO’yyyyMMddHHmmssSSS, where SO indicates the prefix and is accurate to year, month, day, hour, minute, second, millisecond

The table definition configures the serial number attribute

The product code

Product table configures the serial number field

Serial number of sales order

The sales order table configures the serial number field

Verifying serial number function

product

Create a product through THE UI, because the encoding field is set to the serial number, so leave it blank, so that the background will automatically generate the encoding, if the encoding field is manually entered, the value of the manual input will take.

The generated encoding is PROD_000000001, as expected.

Sales order

Create sales orders through Postman

UI view the order list, the sequence number is SO20210212110955912 is generated successfully

senior

Serial number API

Serial numbers provide an API to get the next value, and are suitable for UI customization scenarios where the value is explicitly displayed on the UI, which is more intuitive, but may waste the value if the user does not click save or fails to save. Check out the Swagger documentation:The demo. Crudapi. Cn/swagger – UI….

validation

The next value obtained from Postman is PROD_000000002

summary

In this paper, the automatic assignment function of specific field is realized by configuring serial number, without encoding, and supports secondary development. At present, the product and sales orders are isolated in single table. Later, we will introduce how to configure the table relationship to achieve one-to-many, one-to-one, many-to-many and other master and child tables.

Attached the demo presentation

This system is a production-level zero-code platform, which is different from automatic code generator. It does not need to generate business code such as Controller, Service, Repository, Entity, etc. It can be used when the program is running. You can override basic business-neutral CRUD RESTful apis.

Website address: crudapi. Cn test address: demo. Crudapi. Cn/crudapi/log…