😎修改代码生成流程

This commit is contained in:
zuohuaijun 2024-12-17 23:50:30 +08:00
parent 4c4dc956d5
commit 5e17c0f7d6
10 changed files with 51 additions and 52 deletions

View File

@ -9,7 +9,7 @@ namespace Admin.NET.Core.Service;
/// <summary> /// <summary>
/// 代码生成参数类 /// 代码生成参数类
/// </summary> /// </summary>
public class CodeGenInput : BasePageInput public class PageCodeGenInput : BasePageInput
{ {
/// <summary> /// <summary>
/// 作者姓名 /// 作者姓名
@ -112,7 +112,7 @@ public class CodeGenInput : BasePageInput
public virtual bool IsApiService { get; set; } public virtual bool IsApiService { get; set; }
} }
public class AddCodeGenInput : CodeGenInput public class AddCodeGenInput : PageCodeGenInput
{ {
/// <summary> /// <summary>
/// 数据库表名 /// 数据库表名

View File

@ -39,7 +39,7 @@ public class SysCodeGenService : IDynamicApiController, ITransient
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[DisplayName("获取代码生成分页列表")] [DisplayName("获取代码生成分页列表")]
public async Task<SqlSugarPagedList<SysCodeGen>> Page(CodeGenInput input) public async Task<SqlSugarPagedList<SysCodeGen>> Page(PageCodeGenInput input)
{ {
return await _db.Queryable<SysCodeGen>() return await _db.Queryable<SysCodeGen>()
.Includes(u => u.CodeGenTemplateRelations) .Includes(u => u.CodeGenTemplateRelations)

View File

@ -38,7 +38,7 @@
"echarts-wordcloud": "^2.1.0", "echarts-wordcloud": "^2.1.0",
"element-plus": "^2.9.1", "element-plus": "^2.9.1",
"exceljs": "^4.4.0", "exceljs": "^4.4.0",
"ezuikit-js": "^8.1.1", "ezuikit-js": "^8.1.2",
"gcoord": "^1.0.6", "gcoord": "^1.0.6",
"js-cookie": "^3.0.5", "js-cookie": "^3.0.5",
"js-table2excel": "^1.1.2", "js-table2excel": "^1.1.2",
@ -74,7 +74,7 @@
"vue-router": "^4.5.0", "vue-router": "^4.5.0",
"vue-signature-pad": "^3.0.2", "vue-signature-pad": "^3.0.2",
"vue3-tree-org": "^4.2.2", "vue3-tree-org": "^4.2.2",
"vxe-pc-ui": "^4.3.35", "vxe-pc-ui": "^4.3.36",
"vxe-table": "^4.8.10", "vxe-table": "^4.8.10",
"vxe-table-plugin-element": "^4.0.4", "vxe-table-plugin-element": "^4.0.4",
"vxe-table-plugin-export-xlsx": "^4.0.7", "vxe-table-plugin-export-xlsx": "^4.0.7",

View File

@ -26,8 +26,8 @@ import { AdminResultListTableOutput } from '../models';
import { AdminResultObject } from '../models'; import { AdminResultObject } from '../models';
import { AdminResultSqlSugarPagedListSysCodeGen } from '../models'; import { AdminResultSqlSugarPagedListSysCodeGen } from '../models';
import { AdminResultSysCodeGen } from '../models'; import { AdminResultSysCodeGen } from '../models';
import { CodeGenInput } from '../models';
import { DeleteCodeGenInput } from '../models'; import { DeleteCodeGenInput } from '../models';
import { PageCodeGenInput } from '../models';
import { SysCodeGen } from '../models'; import { SysCodeGen } from '../models';
import { UpdateCodeGenInput } from '../models'; import { UpdateCodeGenInput } from '../models';
/** /**
@ -328,11 +328,11 @@ export const SysCodeGenApiAxiosParamCreator = function (configuration?: Configur
/** /**
* *
* @summary 🔖 * @summary 🔖
* @param {CodeGenInput} [body] * @param {PageCodeGenInput} [body]
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
apiSysCodeGenPagePost: async (body?: CodeGenInput, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { apiSysCodeGenPagePost: async (body?: PageCodeGenInput, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/api/sysCodeGen/page`; const localVarPath = `/api/sysCodeGen/page`;
// use dummy base URL string because the URL constructor only accepts absolute URLs. // use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, 'https://example.com'); const localVarUrlObj = new URL(localVarPath, 'https://example.com');
@ -661,11 +661,11 @@ export const SysCodeGenApiFp = function(configuration?: Configuration) {
/** /**
* *
* @summary 🔖 * @summary 🔖
* @param {CodeGenInput} [body] * @param {PageCodeGenInput} [body]
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
async apiSysCodeGenPagePost(body?: CodeGenInput, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<AdminResultSqlSugarPagedListSysCodeGen>>> { async apiSysCodeGenPagePost(body?: PageCodeGenInput, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<AdminResultSqlSugarPagedListSysCodeGen>>> {
const localVarAxiosArgs = await SysCodeGenApiAxiosParamCreator(configuration).apiSysCodeGenPagePost(body, options); const localVarAxiosArgs = await SysCodeGenApiAxiosParamCreator(configuration).apiSysCodeGenPagePost(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
@ -799,11 +799,11 @@ export const SysCodeGenApiFactory = function (configuration?: Configuration, bas
/** /**
* *
* @summary 🔖 * @summary 🔖
* @param {CodeGenInput} [body] * @param {PageCodeGenInput} [body]
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
async apiSysCodeGenPagePost(body?: CodeGenInput, options?: AxiosRequestConfig): Promise<AxiosResponse<AdminResultSqlSugarPagedListSysCodeGen>> { async apiSysCodeGenPagePost(body?: PageCodeGenInput, options?: AxiosRequestConfig): Promise<AxiosResponse<AdminResultSqlSugarPagedListSysCodeGen>> {
return SysCodeGenApiFp(configuration).apiSysCodeGenPagePost(body, options).then((request) => request(axios, basePath)); return SysCodeGenApiFp(configuration).apiSysCodeGenPagePost(body, options).then((request) => request(axios, basePath));
}, },
/** /**
@ -924,12 +924,12 @@ export class SysCodeGenApi extends BaseAPI {
/** /**
* *
* @summary 🔖 * @summary 🔖
* @param {CodeGenInput} [body] * @param {PageCodeGenInput} [body]
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof SysCodeGenApi * @memberof SysCodeGenApi
*/ */
public async apiSysCodeGenPagePost(body?: CodeGenInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminResultSqlSugarPagedListSysCodeGen>> { public async apiSysCodeGenPagePost(body?: PageCodeGenInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminResultSqlSugarPagedListSysCodeGen>> {
return SysCodeGenApiFp(this.configuration).apiSysCodeGenPagePost(body, options).then((request) => request(this.axios, this.basePath)); return SysCodeGenApiFp(this.configuration).apiSysCodeGenPagePost(body, options).then((request) => request(this.axios, this.basePath));
} }
/** /**

View File

@ -139,7 +139,6 @@ export * from './change-app-input';
export * from './change-pwd-input'; export * from './change-pwd-input';
export * from './cluster-status'; export * from './cluster-status';
export * from './code-gen-config'; export * from './code-gen-config';
export * from './code-gen-input';
export * from './code-gen-type-enum'; export * from './code-gen-type-enum';
export * from './column-ouput'; export * from './column-ouput';
export * from './column-relation'; export * from './column-relation';
@ -268,6 +267,7 @@ export * from './number-format-info';
export * from './oauth-user-input'; export * from './oauth-user-input';
export * from './oauth-user-output'; export * from './oauth-user-output';
export * from './open-access-output'; export * from './open-access-output';
export * from './page-code-gen-input';
export * from './page-config-input'; export * from './page-config-input';
export * from './page-dict-data-input'; export * from './page-dict-data-input';
export * from './page-dict-type-input'; export * from './page-dict-type-input';

View File

@ -18,13 +18,13 @@ import { Search } from './search';
* *
* *
* @export * @export
* @interface CodeGenInput * @interface PageCodeGenInput
*/ */
export interface CodeGenInput { export interface PageCodeGenInput {
/** /**
* @type {Search} * @type {Search}
* @memberof CodeGenInput * @memberof PageCodeGenInput
*/ */
search?: Search; search?: Search;
@ -32,13 +32,13 @@ export interface CodeGenInput {
* *
* *
* @type {string} * @type {string}
* @memberof CodeGenInput * @memberof PageCodeGenInput
*/ */
keyword?: string | null; keyword?: string | null;
/** /**
* @type {Filter} * @type {Filter}
* @memberof CodeGenInput * @memberof PageCodeGenInput
*/ */
filter?: Filter; filter?: Filter;
@ -46,7 +46,7 @@ export interface CodeGenInput {
* *
* *
* @type {number} * @type {number}
* @memberof CodeGenInput * @memberof PageCodeGenInput
*/ */
page?: number; page?: number;
@ -54,7 +54,7 @@ export interface CodeGenInput {
* *
* *
* @type {number} * @type {number}
* @memberof CodeGenInput * @memberof PageCodeGenInput
*/ */
pageSize?: number; pageSize?: number;
@ -62,7 +62,7 @@ export interface CodeGenInput {
* *
* *
* @type {string} * @type {string}
* @memberof CodeGenInput * @memberof PageCodeGenInput
*/ */
field?: string | null; field?: string | null;
@ -70,7 +70,7 @@ export interface CodeGenInput {
* *
* *
* @type {string} * @type {string}
* @memberof CodeGenInput * @memberof PageCodeGenInput
*/ */
order?: string | null; order?: string | null;
@ -78,7 +78,7 @@ export interface CodeGenInput {
* *
* *
* @type {string} * @type {string}
* @memberof CodeGenInput * @memberof PageCodeGenInput
*/ */
descStr?: string | null; descStr?: string | null;
@ -86,7 +86,7 @@ export interface CodeGenInput {
* *
* *
* @type {string} * @type {string}
* @memberof CodeGenInput * @memberof PageCodeGenInput
*/ */
tableName?: string | null; tableName?: string | null;
@ -94,7 +94,7 @@ export interface CodeGenInput {
* *
* *
* @type {string} * @type {string}
* @memberof CodeGenInput * @memberof PageCodeGenInput
*/ */
busName?: string | null; busName?: string | null;
@ -102,7 +102,7 @@ export interface CodeGenInput {
* *
* *
* @type {string} * @type {string}
* @memberof CodeGenInput * @memberof PageCodeGenInput
*/ */
nameSpace?: string | null; nameSpace?: string | null;
@ -110,7 +110,7 @@ export interface CodeGenInput {
* *
* *
* @type {string} * @type {string}
* @memberof CodeGenInput * @memberof PageCodeGenInput
*/ */
authorName?: string | null; authorName?: string | null;
@ -118,7 +118,7 @@ export interface CodeGenInput {
* *
* *
* @type {string} * @type {string}
* @memberof CodeGenInput * @memberof PageCodeGenInput
*/ */
generateType?: string | null; generateType?: string | null;
@ -126,7 +126,7 @@ export interface CodeGenInput {
* *
* *
* @type {boolean} * @type {boolean}
* @memberof CodeGenInput * @memberof PageCodeGenInput
*/ */
generateMenu?: boolean; generateMenu?: boolean;
@ -134,7 +134,7 @@ export interface CodeGenInput {
* 使 Api Service * 使 Api Service
* *
* @type {boolean} * @type {boolean}
* @memberof CodeGenInput * @memberof PageCodeGenInput
*/ */
isApiService?: boolean; isApiService?: boolean;
@ -142,7 +142,7 @@ export interface CodeGenInput {
* *
* *
* @type {string} * @type {string}
* @memberof CodeGenInput * @memberof PageCodeGenInput
*/ */
className?: string | null; className?: string | null;
@ -150,7 +150,7 @@ export interface CodeGenInput {
* *
* *
* @type {string} * @type {string}
* @memberof CodeGenInput * @memberof PageCodeGenInput
*/ */
tablePrefix?: string | null; tablePrefix?: string | null;
@ -158,7 +158,7 @@ export interface CodeGenInput {
* *
* *
* @type {string} * @type {string}
* @memberof CodeGenInput * @memberof PageCodeGenInput
*/ */
configId?: string | null; configId?: string | null;
@ -166,7 +166,7 @@ export interface CodeGenInput {
* () * ()
* *
* @type {string} * @type {string}
* @memberof CodeGenInput * @memberof PageCodeGenInput
*/ */
dbName?: string | null; dbName?: string | null;
@ -174,7 +174,7 @@ export interface CodeGenInput {
* *
* *
* @type {string} * @type {string}
* @memberof CodeGenInput * @memberof PageCodeGenInput
*/ */
dbType?: string | null; dbType?: string | null;
@ -182,7 +182,7 @@ export interface CodeGenInput {
* *
* *
* @type {string} * @type {string}
* @memberof CodeGenInput * @memberof PageCodeGenInput
*/ */
connectionString?: string | null; connectionString?: string | null;
@ -190,7 +190,7 @@ export interface CodeGenInput {
* *
* *
* @type {string} * @type {string}
* @memberof CodeGenInput * @memberof PageCodeGenInput
*/ */
tableComment?: string | null; tableComment?: string | null;
@ -198,7 +198,7 @@ export interface CodeGenInput {
* *
* *
* @type {string} * @type {string}
* @memberof CodeGenInput * @memberof PageCodeGenInput
*/ */
menuApplication?: string | null; menuApplication?: string | null;
@ -206,7 +206,7 @@ export interface CodeGenInput {
* *
* *
* @type {number} * @type {number}
* @memberof CodeGenInput * @memberof PageCodeGenInput
*/ */
menuPid?: number | null; menuPid?: number | null;
@ -214,7 +214,7 @@ export interface CodeGenInput {
* *
* *
* @type {string} * @type {string}
* @memberof CodeGenInput * @memberof PageCodeGenInput
*/ */
menuIcon?: string | null; menuIcon?: string | null;
@ -222,7 +222,7 @@ export interface CodeGenInput {
* *
* *
* @type {string} * @type {string}
* @memberof CodeGenInput * @memberof PageCodeGenInput
*/ */
pagePath?: string | null; pagePath?: string | null;
@ -230,7 +230,7 @@ export interface CodeGenInput {
* *
* *
* @type {string} * @type {string}
* @memberof CodeGenInput * @memberof PageCodeGenInput
*/ */
printType?: string | null; printType?: string | null;
@ -238,7 +238,7 @@ export interface CodeGenInput {
* *
* *
* @type {string} * @type {string}
* @memberof CodeGenInput * @memberof PageCodeGenInput
*/ */
printName?: string | null; printName?: string | null;
} }

View File

@ -245,7 +245,7 @@ const emits = defineEmits(['handleQuery']);
const ruleFormRef = ref(); const ruleFormRef = ref();
const state = reactive({ const state = reactive({
isShowDialog: false, isShowDialog: false,
ruleForm: {} as UpdateCodeGenInput, ruleForm: {} as UpdateCodeGenInput | any,
tableData: [] as any, tableData: [] as any,
dbData: [] as any, dbData: [] as any,
columnData: [] as any, columnData: [] as any,

View File

@ -12,7 +12,7 @@
<vxe-select v-model="row.effectType" class="m-2" style="width: 70%" placeholder="Select" transfer :disabled="judgeColumns(row)" @change="effectTypeChange(row, $index)" filterable> <vxe-select v-model="row.effectType" class="m-2" style="width: 70%" placeholder="Select" transfer :disabled="judgeColumns(row)" @change="effectTypeChange(row, $index)" filterable>
<vxe-option v-for="item in state.effectTypeList" :key="item.code" :label="item.value" :value="item.code" /> <vxe-option v-for="item in state.effectTypeList" :key="item.code" :label="item.value" :value="item.code" />
</vxe-select> </vxe-select>
<vxe-button v-if="row.effectType === 'ApiTreeSelect' || row.effectType === 'fk'" style="width: 30%" icon="vxe-icon-edit" @click="effectTypeChange(row, $index)">修改</vxe-button> <vxe-button v-if="row.effectType === 'ApiTreeSelector' || row.effectType === 'ForeignKey'" style="width: 30%" icon="vxe-icon-edit" @click="effectTypeChange(row, $index)">修改</vxe-button>
</template> </template>
<template #columnComment="{ row }"> <template #columnComment="{ row }">
<vxe-input v-model="row.columnComment" autocomplete="off" /> <vxe-input v-model="row.columnComment" autocomplete="off" />
@ -288,14 +288,14 @@ onUnmounted(() => {
// //
const effectTypeChange = (data: any, index: number) => { const effectTypeChange = (data: any, index: number) => {
let value = data.effectType; let value = data.effectType;
if (value === 'fk') { if (value === 'ForeignKey') {
openFkDialog(data, index); openFkDialog(data, index);
} else if (value === 'ApiTreeSelect') { } else if (value === 'ApiTreeSelect') {
openTreeDialog(data, index); openTreeDialog(data, index);
} else if (value === 'Select') { } else if (value === 'DictSelector') {
data.dictTypeCode = ''; data.dictTypeCode = '';
state.dictTypeCodeList = state.dictDataAll; state.dictTypeCodeList = state.dictDataAll;
} else if (value === 'ConstSelector') { } else if (value === 'ApiTreeSelector') {
data.dictTypeCode = ''; data.dictTypeCode = '';
state.dictTypeCodeList = state.allConstSelector; state.dictTypeCodeList = state.allConstSelector;
} else if (value == 'EnumSelector') { } else if (value == 'EnumSelector') {

View File

@ -89,7 +89,7 @@ const openDialog = async (row: any) => {
state.isShowDialog = true; state.isShowDialog = true;
const { data } = await getAPI(SysCodeGenApi).apiSysCodeGenPreviewPost(row); const { data } = await getAPI(SysCodeGenApi).apiSysCodeGenPreviewPost(row);
state.codes = data.result ?? []; state.codes = data.result ?? [];
state.options = Object.keys(data.result).map((fileName: string) => ({ state.options = Object.keys(data.result as any).map((fileName: string) => ({
value: fileName, value: fileName,
icon: fileName?.endsWith('.cs') ? 'fa fa-hashtag' : fileName?.endsWith('.vue') ? 'fa fa-vimeo' : 'fa fa-file-code-o', icon: fileName?.endsWith('.cs') ? 'fa fa-hashtag' : fileName?.endsWith('.vue') ? 'fa fa-vimeo' : 'fa fa-file-code-o',
})); }));

View File

@ -47,7 +47,6 @@ const state = reactive({
title: '', title: '',
column: {} as any, column: {} as any,
}); });
const column = ref();
// //
const openDialog = (row: any) => { const openDialog = (row: any) => {