mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-09-18 03:16:40 +08:00
优化代码生成模块的前端枚举
This commit is contained in:
parent
51caeb1ad1
commit
3c3e3b4e32
@ -47,7 +47,8 @@ public class ListVariableService extends CodeGenerateBaseVariableService {
|
|||||||
CodeField codeField = getCodeFieldByColumnName(queryField.getColumnNameList().get(0), form);
|
CodeField codeField = getCodeFieldByColumnName(queryField.getColumnNameList().get(0), form);
|
||||||
|
|
||||||
if (CodeQueryFieldQueryTypeEnum.ENUM.equalsValue(queryField.getQueryTypeEnum())) {
|
if (CodeQueryFieldQueryTypeEnum.ENUM.equalsValue(queryField.getQueryTypeEnum())) {
|
||||||
objectMap.put("frontEnumName", codeField.getEnumName());
|
String upperUnderscoreEnum = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, codeField.getEnumName());
|
||||||
|
objectMap.put("frontEnumName", upperUnderscoreEnum);
|
||||||
frontImportSet.add("import SmartEnumSelect from '/@/components/framework/smart-enum-select/index.vue';");
|
frontImportSet.add("import SmartEnumSelect from '/@/components/framework/smart-enum-select/index.vue';");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,6 +77,12 @@ public class ListVariableService extends CodeGenerateBaseVariableService {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 是否存在枚举
|
||||||
|
if (SmartStringUtil.isNotBlank(codeField.getEnumName())) {
|
||||||
|
String upperUnderscoreEnum = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, codeField.getEnumName());
|
||||||
|
objectMap.put("frontEnumPlugin", "$smartEnumPlugin.getDescByValue('" + upperUnderscoreEnum + "', text)");
|
||||||
|
}
|
||||||
|
|
||||||
// 是否存在字典
|
// 是否存在字典
|
||||||
if (SmartStringUtil.isNotBlank(codeField.getDict())) {
|
if (SmartStringUtil.isNotBlank(codeField.getDict())) {
|
||||||
objectMap.put("dict", codeField.getDict());
|
objectMap.put("dict", codeField.getDict());
|
||||||
|
@ -18,7 +18,7 @@ public class ${name.upperCamel}Entity {
|
|||||||
#foreach ($field in $fields)
|
#foreach ($field in $fields)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $field.label
|
* $field.columnComment
|
||||||
*/
|
*/
|
||||||
#if($field.primaryKeyFlag && $field.autoIncreaseFlag)
|
#if($field.primaryKeyFlag && $field.autoIncreaseFlag)
|
||||||
@TableId(type = IdType.AUTO)
|
@TableId(type = IdType.AUTO)
|
||||||
|
@ -89,6 +89,7 @@
|
|||||||
<!---------- 表格 begin ----------->
|
<!---------- 表格 begin ----------->
|
||||||
<a-table
|
<a-table
|
||||||
size="small"
|
size="small"
|
||||||
|
:scroll="{ y: 800 }"
|
||||||
:dataSource="tableData"
|
:dataSource="tableData"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
rowKey="$!{primaryKeyFieldName}"
|
rowKey="$!{primaryKeyFieldName}"
|
||||||
@ -108,6 +109,13 @@
|
|||||||
</template>
|
</template>
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
#foreach ($field in $listFields)
|
||||||
|
#if($field.frontEnumPlugin)
|
||||||
|
<template v-if="column.dataIndex === '$!{field.fieldName}'">
|
||||||
|
<span>{{ $!{field.frontEnumPlugin} }}</span>
|
||||||
|
</template>
|
||||||
|
#end
|
||||||
|
#end
|
||||||
#foreach ($field in $listFields)
|
#foreach ($field in $listFields)
|
||||||
#if($field.dict)
|
#if($field.dict)
|
||||||
<template v-if="column.dataIndex === '$!{field.fieldName}'">
|
<template v-if="column.dataIndex === '$!{field.fieldName}'">
|
||||||
|
@ -48,7 +48,8 @@ public class ListVariableService extends CodeGenerateBaseVariableService {
|
|||||||
CodeField codeField = getCodeFieldByColumnName(queryField.getColumnNameList().get(0), form);
|
CodeField codeField = getCodeFieldByColumnName(queryField.getColumnNameList().get(0), form);
|
||||||
|
|
||||||
if (CodeQueryFieldQueryTypeEnum.ENUM.equalsValue(queryField.getQueryTypeEnum())) {
|
if (CodeQueryFieldQueryTypeEnum.ENUM.equalsValue(queryField.getQueryTypeEnum())) {
|
||||||
objectMap.put("frontEnumName", codeField.getEnumName());
|
String upperUnderscoreEnum = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, codeField.getEnumName());
|
||||||
|
objectMap.put("frontEnumName", upperUnderscoreEnum);
|
||||||
frontImportSet.add("import SmartEnumSelect from '/@/components/framework/smart-enum-select/index.vue';");
|
frontImportSet.add("import SmartEnumSelect from '/@/components/framework/smart-enum-select/index.vue';");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,6 +78,12 @@ public class ListVariableService extends CodeGenerateBaseVariableService {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 是否存在枚举
|
||||||
|
if (SmartStringUtil.isNotBlank(codeField.getEnumName())) {
|
||||||
|
String upperUnderscoreEnum = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, codeField.getEnumName());
|
||||||
|
objectMap.put("frontEnumPlugin", "$smartEnumPlugin.getDescByValue('" + upperUnderscoreEnum + "', text)");
|
||||||
|
}
|
||||||
|
|
||||||
// 是否存在字典
|
// 是否存在字典
|
||||||
if (SmartStringUtil.isNotBlank(codeField.getDict())) {
|
if (SmartStringUtil.isNotBlank(codeField.getDict())) {
|
||||||
objectMap.put("dict", codeField.getDict());
|
objectMap.put("dict", codeField.getDict());
|
||||||
|
@ -18,7 +18,7 @@ public class ${name.upperCamel}Entity {
|
|||||||
#foreach ($field in $fields)
|
#foreach ($field in $fields)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $field.label
|
* $field.columnComment
|
||||||
*/
|
*/
|
||||||
#if($field.primaryKeyFlag && $field.autoIncreaseFlag)
|
#if($field.primaryKeyFlag && $field.autoIncreaseFlag)
|
||||||
@TableId(type = IdType.AUTO)
|
@TableId(type = IdType.AUTO)
|
||||||
|
@ -89,6 +89,7 @@
|
|||||||
<!---------- 表格 begin ----------->
|
<!---------- 表格 begin ----------->
|
||||||
<a-table
|
<a-table
|
||||||
size="small"
|
size="small"
|
||||||
|
:scroll="{ y: 800 }"
|
||||||
:dataSource="tableData"
|
:dataSource="tableData"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
rowKey="$!{primaryKeyFieldName}"
|
rowKey="$!{primaryKeyFieldName}"
|
||||||
@ -108,6 +109,13 @@
|
|||||||
</template>
|
</template>
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
#foreach ($field in $listFields)
|
||||||
|
#if($field.frontEnumPlugin)
|
||||||
|
<template v-if="column.dataIndex === '$!{field.fieldName}'">
|
||||||
|
<span>{{ $!{field.frontEnumPlugin} }}</span>
|
||||||
|
</template>
|
||||||
|
#end
|
||||||
|
#end
|
||||||
#foreach ($field in $listFields)
|
#foreach ($field in $listFields)
|
||||||
#if($field.dict)
|
#if($field.dict)
|
||||||
<template v-if="column.dataIndex === '$!{field.fieldName}'">
|
<template v-if="column.dataIndex === '$!{field.fieldName}'">
|
||||||
|
Loading…
Reference in New Issue
Block a user