mirror of
				https://gitee.com/lab1024/smart-admin.git
				synced 2025-11-04 10:23:43 +08:00 
			
		
		
		
	优化代码生成模块的前端枚举
This commit is contained in:
		@@ -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());
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
 
 | 
			
		||||
@@ -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}'">
 | 
			
		||||
 
 | 
			
		||||
@@ -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());
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
 
 | 
			
		||||
@@ -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}'">
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user