Template management
Template for generating code.
Directions
Template grouping
Group Name: Group name
Template list
Template Name: Template name
Template information
| Parameter | Directions |
|---|---|
| Group | Current group name |
| Template | Current template name |
| Package | Package names |
| Path | Code generation storage path (excluding project path, see Project Management) |
| Code | code segment |
Template properties
Basic attributes
| grammar | Explanation |
|---|---|
| author | Author (nickname of currently logged in user) |
| current_time | current time |
| project_package | Project absolute path |
| package | Current template path |
| table_name | Table Name |
| table_comment | Table Comment |
| fields | For all field information, refer to field properties |
Field properties
| grammar | Explanation |
|---|---|
| name | Field name |
| comment | Field annotation |
| field_type | Data type (database) |
| data_type | Mapped data type, management data type |
| data_type2 | mapped data type |
| data_type3 | mapped data type |
| ordinal_position | position in table |
| column_default | default value |
| is_nullable | Whether it can be empty (YES: NULL is allowed; NO: NULL is not allowed) |
| column_key | Key type (primary key: PRI; unique key: UNI; normal index: MUL) |
| extra | extra information |
Tool properties
| grammar | Explanation |
|---|---|
| camelcase | Convert underscore string to camelCase hello_world => HelloWorld |
| camelcase_lower | Convert underscore string to camel case (first letter lowercase) hello_world => helloWorld |
| package_to_path | Convert package name to path |
Usage examples:table_name|camelcase
Basic grammar
Commonly used markers
python
comment:{# This is a comment #}
variable:{{ table_name }}、{{ field.name }}
list:{{ fields[0] }}
multi-line code block:{% start %} HTML {% end %}
tool properties:{{ table_name|camelcase }}Conditional judgment
Basic usage
python
{% if condition %}
# Conditional code block
{% else %}
# Unqualified code block
{% endif %}Traverse
python
{% for field in fields %}
{% endfor %}