Init


Introduce

When model transforming, we can get the structure of the model we want with init scheme.

Catalog:


Why use init scheme?

Init scheme can help you automatically set properties, columns and fields when transform model.

For example, the database has a book table, we need to transform a model. Often we need to add some properties and columns to the model.

There is a table in the database

Transform by default model, Can't meet our needs.

How to use init scheme

For example, according to business requirements, we need to add and modify the model.

type and fullType

title、fieldName、controlType

isQuery

New init scheme

Model Page-->Init Scheme-->New Init-->Enter init name

Init scheme and transform model

Init Property

There are 2 ways to set property: default and convert.

1.Default: Enter a fixed content

Double click or press enter edit

transform model

2.Convert

We can use a convert, It convert the specified property value to a new value.

Select name, select headUpperCamel, It can convert the name to head character upper case and camel case.

For example: book_id --> BookId

We are in the database table named book, after transform model, it will create a new property title, it's value Book.

More about the mapping and converter: Mapping and Converter

Init Column

There are 2 kinds:

Existing column init

Including name, type, fullType:

There are also two ways: default and convert.

The default value is filled with a fixed value. Fill in here myName.

The same value is generated for each field in the same column.

But in most cases, name, type, fullType these three field are converted by other columns

Our conversion scheme:

Converter headLowerCamel, lower case and camel case.

Mapping type, from jdbcType to the development language type.

Mapping full type, from jdbcType to the development language fullType.

More about headLowerCamel、mapping type and fullType:Mapping and Convert

name, select the Convert from column is id, convert is headLowerCamel.

Type, select the default from the column jdbcType, using the mapping type.

FullType, select the default from the column jdbcType, using the mapping fullType.

Transform model, select the init.

Transform result

Init Column

Similar to existing column,

Our conversion scheme:

Result

Click any grid can edit, you can find,
controlType columns can choose three options and null;
IsQuery columns can choose true, false and null.

Init Field

Create a new field price

Create new field