Pre Merge pull request !67 from 大熊/code-generator

This commit is contained in:
大熊 2025-04-27 07:29:13 +00:00 committed by Gitee
commit b41f689bff
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 36 additions and 6 deletions

View File

@ -47,7 +47,8 @@ public class ListVariableService extends CodeGenerateBaseVariableService {
CodeField codeField = getCodeFieldByColumnName(queryField.getColumnNameList().get(0), form);
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';");
}
@ -76,6 +77,12 @@ public class ListVariableService extends CodeGenerateBaseVariableService {
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())) {
objectMap.put("dict", codeField.getDict());

View File

@ -18,7 +18,7 @@ public class ${name.upperCamel}Entity {
#foreach ($field in $fields)
/**
* $field.label
* $field.columnComment
*/
#if($field.primaryKeyFlag && $field.autoIncreaseFlag)
@TableId(type = IdType.AUTO)

View File

@ -22,12 +22,12 @@
#end
#if($field.queryTypeEnum == "Dict")
<a-form-item label="${field.label}" class="smart-query-form-item">
<DictSelect dict-code="DICT_CODE_ENUM.$!{field.dict} || '$!{field.dict}'" placeholder="${field.label}" v-model:value="queryForm.${field.fieldName}" width="${field.width}" />
<DictSelect dict-code="DICT_CODE_ENUM.$!{field.dict} || '$!{field.dict}'" placeholder="${field.label}" v-model:value="queryForm.${field.fieldName}" width="${field.width}" />
</a-form-item>
#end
#if($field.queryTypeEnum == "Enum")
<a-form-item label="$codeGeneratorTool.removeEnumDesc(${field.label})" class="smart-query-form-item">
<SmartEnumSelect width="${field.width}" v-model:value="queryForm.${field.fieldName}" enum-name="$!{field.frontEnumName}" placeholder="$codeGeneratorTool.removeEnumDesc(${field.label})"/>
<SmartEnumSelect width="${field.width}" v-model:value="queryForm.${field.fieldName}" enum-name="$!{field.frontEnumName}" placeholder="$codeGeneratorTool.removeEnumDesc(${field.label})"/>
</a-form-item>
#end
#if($field.queryTypeEnum == "Date")
@ -89,6 +89,7 @@
<!---------- 表格 begin ----------->
<a-table
size="small"
:scroll="{ y: 800 }"
:dataSource="tableData"
:columns="columns"
rowKey="$!{primaryKeyFieldName}"
@ -108,6 +109,13 @@
</template>
#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)
#if($field.dict)
<template v-if="column.dataIndex === '$!{field.fieldName}'">

View File

@ -48,7 +48,8 @@ public class ListVariableService extends CodeGenerateBaseVariableService {
CodeField codeField = getCodeFieldByColumnName(queryField.getColumnNameList().get(0), form);
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';");
}
@ -77,6 +78,12 @@ public class ListVariableService extends CodeGenerateBaseVariableService {
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())) {
objectMap.put("dict", codeField.getDict());

View File

@ -18,7 +18,7 @@ public class ${name.upperCamel}Entity {
#foreach ($field in $fields)
/**
* $field.label
* $field.columnComment
*/
#if($field.primaryKeyFlag && $field.autoIncreaseFlag)
@TableId(type = IdType.AUTO)

View File

@ -89,6 +89,7 @@
<!---------- 表格 begin ----------->
<a-table
size="small"
:scroll="{ y: 800 }"
:dataSource="tableData"
:columns="columns"
rowKey="$!{primaryKeyFieldName}"
@ -108,6 +109,13 @@
</template>
#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)
#if($field.dict)
<template v-if="column.dataIndex === '$!{field.fieldName}'">