初始化数据xml代码生成

This commit is contained in:
2026-01-20 14:40:32 +08:00
parent f6a76efe1d
commit bd2b0e7f3d
9 changed files with 269 additions and 8 deletions

View File

@@ -259,3 +259,106 @@ $operationList:{op |
## 模块数据
```xml
group dbXml;
moduleTemplate(module) ::= <<
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.24.xsd">
<changeSet id="insert-ms-fun-module-data" author="xinghe">
<comment>初始化模块数据</comment>
$module:{op |
<insert tableName="ms_fun_module">
<column name="id" value="$op.id$"/>
<column name="module_name" value="$op.moduleCode$"/>
</insert>
}$
</changeSet>
</databaseChangeLog>
>>
itemTemplate(item) ::= <<
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.24.xsd">
<changeSet id="insert-ms-fun-item-data" author="xinghe">
<comment>初始化功能数据</comment>
$item:{op |
<insert tableName="ms_fun_item">
<column name="id" value="$op.id$"/>
<column name="module_id" value="$op.moduleId$"/>
<column name="item_name" value="$op.itemName$"/>
<column name="is_tenant" value="$op.isTenant$"/>
<column name="describe" value="$op.describe$"/>
</insert>
}$
</changeSet>
</databaseChangeLog>
>>
funTypeAnnotations ::= [
"ADD": "0",
"DELETE": "1",
"EDIT": "2",
"QUERY": "3",
"UPLOAD": "4",
"DOWNLOAD": "5",
"IMPORT": "6",
"EXPORT": "7",
"PRINT": "8",
"REGISTER": "9",
"LOGIN": "10",
"LOGOUT": "11",
"SMS": "12",
"EMAIL": "13",
"WECHAT": "14",
"OTHER": "99"
default: "-1"
]
operationTemplate(operation) ::= <<
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.24.xsd">
<changeSet id="insert-ms-fun-operation-data" author="xinghe">
<comment>初始化操作数据</comment>
$operation:{op |
<insert tableName="ms_fun_item">
<column name="id" value="$op.id$"/>
<column name="module_id" value="$op.moduleId$"/>
<column name="item_id" value="$op.itemId$"/>
<column name="is_green_light" value="$op.isGreenLight$"/>
<column name="fun_code" value="$op.operationCode$"/>
<column name="fun_name" value="$op.funName$"/>
<column name="fun_type" value="$funTypeAnnotations.(op.funType)$"/>
<column name="usable_config" value="$op.usableConfigJson$"/>
<column name="field_cofnig" value="$op.fieldConfigJson$"/>
<column name="sort_order" value="$op.sortOrder$"/>
<column name="describe" value="$op.describe$"/>
</insert>
}$
</changeSet>
</databaseChangeLog>
>>
```