Form design

In the previous article, we introduced some of the basic features of form design through a series of case studies. Form design plays an important role and is the core of crUDAPI, so this article will detail some of the other features of form design.

The profile

The column attribute of the form field

Listing English names describe
name English names
caption Chinese name
autoIncrement Self increasing or not
description describe
displayOrder Serial number, the order of display in the UI
dataType Data types such as strings, integers, and so on
seqId Serial number ID, which is used to set the serial number
indexName The index name
indexStorage Index storage, supports BTREE and HASH
indexType INDEX type: PRIMARY, UNIQUE, INDEX, and FULLTEXT
length The length of the
precision Precision, precision, indicating the number of significant digits in the field
scale Scale, value range, indicating the decimal place of the field
nullable Whether the value can be null
unsigned Unsigned or not
insertable Is it pluggable?
queryable Is it searchable?
systemable System Field
updatable Is it modifiable?
createdDate Creation time
lastModifiedDate Modify the time

Not all of these properties are valid at the same time. For example, unsigned is valid only if the dataType is a number, ignored if the dataType is a string, and so on.

System fields

When creating a form, five system fields are added by default: ID, name, fullTextBody, createdDate, and lastModifiedDate. Take customer as an example. The json content of the system field is as follows:

[{
    "autoIncrement": true."caption": "Number"."createdDate": 1613181300985."dataType": "BIGINT"."description": "Primary key"."displayOrder": 0."id": 253."indexType": "PRIMARY"."insertable": false."lastModifiedDate": 1613182114133."length": 20."name": "id"."nullable": false."queryable": false."systemable": true."unsigned": true."updatable": false
}, {
    "autoIncrement": false."caption": "Name"."createdDate": 1613181300985."dataType": "VARCHAR"."description": "Name"."displayOrder": 1."id": 254."insertable": true."lastModifiedDate": 1613182114133."length": 200."name": "name"."nullable": false."queryable": true."systemable": true."unsigned": false."updatable": true
}, {
    "autoIncrement": false."caption": "Full-text Index"."createdDate": 1613181300985."dataType": "TEXT"."description": "Full-text Index"."displayOrder": 2."id": 255."indexName": "ft_fulltext_body"."indexType": "FULLTEXT"."insertable": false."lastModifiedDate": 1613182114133."name": "fullTextBody"."nullable": true."queryable": false."systemable": true."unsigned": false."updatable": false
}, {
    "autoIncrement": false."caption": "Creation time"."createdDate": 1613181300985."dataType": "DATETIME"."description": "Creation time"."displayOrder": 3."id": 256."insertable": false."lastModifiedDate": 1613182114133."name": "createdDate"."nullable": false."queryable": false."systemable": true."unsigned": false."updatable": false
}]
Copy the code

Unique index

Index types include primary key, full text, ordinary, and unique. Full-text indexes have been described before. Ordinary indexes are mainly used to improve query efficiencyCreate a unique index for the mobile field in the customer table to indicate that the mobile number cannot be repeated

When adding customers, input and add the existing phone number, prompting repeated errors, and expected consistency, unique index can prevent data duplication.

Joint index

If the index has only one field, set it directly when setting the column properties. If multiple fields are indexed, you need to set them separately. You can create a common or unique type of federated index here by selecting multiple fields from the drop-down box.For example, if you set a joint index for Customer, you will end up with an index function similar to the previous single-field index.

The attachment

The attachment type field can save attachments, such as documents and pictures

Set the url link field attribute of the file table to ATTACHMENT

When data entry, attachment field can upload files, if it is a picture can preview.

Form Design API

The form design provides an API. If the default background management UI provided is not suitable, you can re-develop the UI and re-design the form through the API. The API document is as follows:

The demo. Crudapi. Cn/swagger – UI….

Postman queries the metadata of the Customer form.

summary

This article introduces the complete functionality of form design, both through UI configuration and secondary development through an API.

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…