fix(other): 修复代码生成字典相关问题
This commit is contained in:
parent
ffa47c37fa
commit
94d1863ef3
@ -73,8 +73,9 @@ public class VelocityUtils {
|
|||||||
velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName));
|
velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName));
|
||||||
velocityContext.put("dicts", getDicts(genTable));
|
velocityContext.put("dicts", getDicts(genTable));
|
||||||
velocityContext.put("dictList", getDictList(genTable));
|
velocityContext.put("dictList", getDictList(genTable));
|
||||||
velocityContext.put("columns", getColumns(genTable));
|
velocityContext.put("columns", genTable.getColumns());
|
||||||
velocityContext.put("table", genTable);
|
velocityContext.put("table", genTable);
|
||||||
|
velocityContext.put("StrUtil", new StrUtil());
|
||||||
setMenuVelocityContext(velocityContext, genTable);
|
setMenuVelocityContext(velocityContext, genTable);
|
||||||
if (GenConstants.TPL_TREE.equals(tplCategory)) {
|
if (GenConstants.TPL_TREE.equals(tplCategory)) {
|
||||||
setTreeVelocityContext(velocityContext, genTable);
|
setTreeVelocityContext(velocityContext, genTable);
|
||||||
@ -296,23 +297,6 @@ public class VelocityUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据列类型获取字典组
|
|
||||||
*
|
|
||||||
* @param genTable 业务表对象
|
|
||||||
* @return 返回字典组
|
|
||||||
*/
|
|
||||||
public static List<GenTableColumn> getColumns(GenTable genTable) {
|
|
||||||
List<GenTableColumn> columns = genTable.getColumns();
|
|
||||||
for (GenTableColumn column : columns) {
|
|
||||||
if (StringUtils.isNotBlank(column.getDictType())) {
|
|
||||||
column.setDictType(StringUtils.toCamelCase(column.getDictType()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return columns;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取权限前缀
|
* 获取权限前缀
|
||||||
*
|
*
|
||||||
|
8
docs/template/modules/operate-drawer.vue.vm
vendored
8
docs/template/modules/operate-drawer.vue.vm
vendored
@ -136,7 +136,7 @@ watch(visible, () => {
|
|||||||
#else
|
#else
|
||||||
#set($comment=$column.columnComment)
|
#set($comment=$column.columnComment)
|
||||||
#end
|
#end
|
||||||
#set($dictType=$column.dictType)
|
#set($dictType=$!StrUtil.toCamelCase($column.dictType))
|
||||||
<NFormItem label="$column.columnComment" path="$column.javaField">
|
<NFormItem label="$column.columnComment" path="$column.javaField">
|
||||||
#if($column.htmlType == "textarea" || $column.htmlType == "editor")
|
#if($column.htmlType == "textarea" || $column.htmlType == "editor")
|
||||||
<NInput
|
<NInput
|
||||||
@ -149,7 +149,7 @@ watch(visible, () => {
|
|||||||
<NSelect
|
<NSelect
|
||||||
v-model:value="model.$column.javaField"
|
v-model:value="model.$column.javaField"
|
||||||
placeholder="请选择$column.columnComment"
|
placeholder="请选择$column.columnComment"
|
||||||
:options="${column.dictType}Options"
|
:options="${dictType}Options"
|
||||||
clearable
|
clearable
|
||||||
/>
|
/>
|
||||||
#elseif($column.htmlType == "select" && $dictType)
|
#elseif($column.htmlType == "select" && $dictType)
|
||||||
@ -163,7 +163,7 @@ watch(visible, () => {
|
|||||||
<NRadioGroup v-model:value="model.$column.javaField">
|
<NRadioGroup v-model:value="model.$column.javaField">
|
||||||
<NSpace>
|
<NSpace>
|
||||||
<NRadio
|
<NRadio
|
||||||
v-for="option in ${column.dictType}Options"
|
v-for="option in ${dictType}Options"
|
||||||
:key="option.value"
|
:key="option.value"
|
||||||
:value="option.value"
|
:value="option.value"
|
||||||
:label="option.label"
|
:label="option.label"
|
||||||
@ -180,7 +180,7 @@ watch(visible, () => {
|
|||||||
<NCheckboxGroup v-model:value="model.$column.javaField">
|
<NCheckboxGroup v-model:value="model.$column.javaField">
|
||||||
<NSpace>
|
<NSpace>
|
||||||
<NCheckbox
|
<NCheckbox
|
||||||
v-for="option in ${column.dictType}Options"
|
v-for="option in ${dictType}Options"
|
||||||
:key="option.value"
|
:key="option.value"
|
||||||
:value="option.value"
|
:value="option.value"
|
||||||
:label="option.label"
|
:label="option.label"
|
||||||
|
8
docs/template/modules/search.vue.vm
vendored
8
docs/template/modules/search.vue.vm
vendored
@ -66,7 +66,7 @@ async function search() {
|
|||||||
<NGrid responsive="screen" item-responsive>
|
<NGrid responsive="screen" item-responsive>
|
||||||
#foreach($column in $columns)
|
#foreach($column in $columns)
|
||||||
#if($column.query)
|
#if($column.query)
|
||||||
#set($dictType=$column.dictType)
|
#set($dictType=$!StrUtil.toCamelCase($column.dictType))
|
||||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||||
#if($parentheseIndex != -1)
|
#if($parentheseIndex != -1)
|
||||||
@ -75,14 +75,14 @@ async function search() {
|
|||||||
#set($comment=$column.columnComment)
|
#set($comment=$column.columnComment)
|
||||||
#end
|
#end
|
||||||
<NFormItemGi span="24 s:12 m:6" label="$column.columnComment" path="$column.javaField" class="pr-24px">
|
<NFormItemGi span="24 s:12 m:6" label="$column.columnComment" path="$column.javaField" class="pr-24px">
|
||||||
#if(($tool.in($column.htmlType, "select", "radio", "checkbox")) && $dictType && "" != $dictType)
|
#if($!StrUtil.contains("select, radio, checkbox", $column.htmlType) && $dictType && "" != $dictType)
|
||||||
<NSelect
|
<NSelect
|
||||||
v-model:value="model.$column.javaField"
|
v-model:value="model.$column.javaField"
|
||||||
placeholder="请选择$column.columnComment"
|
placeholder="请选择$column.columnComment"
|
||||||
:options="${column.dictType}Options"
|
:options="${dictType}Options"
|
||||||
clearable
|
clearable
|
||||||
/>
|
/>
|
||||||
#elseif($tool.in($column.htmlType, "select", "radio", "checkbox"))
|
#elseif($!StrUtil.contains("select, radio, checkbox", $column.htmlType))
|
||||||
<NSelect
|
<NSelect
|
||||||
v-model:value="model.$column.javaField"
|
v-model:value="model.$column.javaField"
|
||||||
placeholder="请选择$column.columnComment"
|
placeholder="请选择$column.columnComment"
|
||||||
|
Loading…
Reference in New Issue
Block a user