Skip to content

Template management ​

Template for generating code.

Directions ​

Template grouping ​

Group Name: Group name

Template list ​

Template Name: Template name

Template information ​

ParameterDirections
GroupCurrent group name
TemplateCurrent template name
PackagePackage names
PathCode generation storage path (excluding project path, see Project Management)
Codecode segment

Template properties ​

Basic attributes ​
grammarExplanation
authorAuthor (nickname of currently logged in user)
current_timecurrent time
project_packageProject absolute path
packageCurrent template path
table_nameTable Name
table_commentTable Comment
fieldsFor all field information, refer to field properties
Field properties ​
grammarExplanation
nameField name
commentField annotation
field_typeData type (database)
data_typeMapped data type, management data type
data_type2mapped data type
data_type3mapped data type
ordinal_positionposition in table
column_defaultdefault value
is_nullableWhether it can be empty (YES: NULL is allowed; NO: NULL is not allowed)
column_keyKey type (primary key: PRI; unique key: UNI; normal index: MUL)
extraextra information
Tool properties ​
grammarExplanation
camelcaseConvert underscore string to camelCase hello_world => HelloWorld
camelcase_lowerConvert underscore string to camel case (first letter lowercase) hello_world => helloWorld
package_to_pathConvert 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 %}

Jinja2