代码生成增加打包压缩下载功能、其他功能优化
This commit is contained in:
@@ -8,11 +8,9 @@ using Microsoft.Extensions.Hosting;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using ZR.Admin.WebApi.Extensions;
|
||||
using ZR.Admin.WebApi.Filters;
|
||||
using ZR.CodeGenerator;
|
||||
using ZR.CodeGenerator.CodeGenerator;
|
||||
using ZR.CodeGenerator.Model;
|
||||
using ZR.CodeGenerator.Service;
|
||||
using ZR.Common;
|
||||
@@ -85,31 +83,31 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
{
|
||||
throw new CustomException(ResultCode.CUSTOM_ERROR, "请求参数为空");
|
||||
}
|
||||
dto.ZipPath = WebHostEnvironment.WebRootPath + "\\Generatecode\\";
|
||||
dto.GenCodePath = dto.ZipPath + DateTime.Now.ToString("yyyyMMdd") + "\\";
|
||||
|
||||
var genTableInfo = GenTableService.GetGenTableInfo(dto.TableId);
|
||||
var getTableColumn = GenTableColumnService.GenTableColumns(dto.TableId);
|
||||
genTableInfo.Columns = getTableColumn;
|
||||
|
||||
dto.ParentPath = WebHostEnvironment.WebRootPath + "\\Generatecode\\" + DateTime.Now.ToString("yyyyMMdd") + "\\";
|
||||
|
||||
//生成代码
|
||||
CodeGeneratorTool.Generate(genTableInfo, dto);
|
||||
string zipPath = CodeGeneratorTool.ZipGenCode(dto);
|
||||
//下载文件
|
||||
CodeGeneratorTool.ZipGenCode(dto);
|
||||
|
||||
return SUCCESS(new { zipPath });
|
||||
//HttpContext.Response.Headers.Add("Content-disposition", $"attachment; filename={zipFileName}");
|
||||
return SUCCESS(new { zipPath = "/Generatecode/" + dto.ZipFileName, fileName = dto.ZipFileName });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取表详细信息
|
||||
/// 获取代码生成表列表
|
||||
/// </summary>
|
||||
/// <param name="tableName"></param>
|
||||
/// <param name="tableName">表名</param>
|
||||
/// <param name="pagerInfo">分页信息</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getGenTable")]
|
||||
[HttpGet("listGenTable")]
|
||||
public IActionResult GetGenTable(string tableName, PagerInfo pagerInfo)
|
||||
{
|
||||
//if (string.IsNullOrEmpty(tableName))
|
||||
//{
|
||||
// throw new CustomException(ResultCode.CUSTOM_ERROR, "请求参数为空");
|
||||
//}
|
||||
//查询原表数据,部分字段映射到代码生成表字段
|
||||
var rows = GenTableService.GetGenTables(new GenTable() { TableName = tableName }, pagerInfo);
|
||||
|
||||
@@ -119,7 +117,7 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
/// <summary>
|
||||
/// 查询表字段列表
|
||||
/// </summary>
|
||||
/// <param name="tableId"></param>
|
||||
/// <param name="tableId">genTable表id</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("column/{tableId}")]
|
||||
public IActionResult GetColumnList(long tableId)
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
<!--${basedir}表示当前应用程序域所在的根目录-->
|
||||
<target name="allfile" xsi:type="File"
|
||||
fileName="${basedir}/adminlogs/nlog-all-${shortdate}.log"
|
||||
archiveFileName="${basedir}/adminlogs/all/all.{###}.txt"
|
||||
archiveAboveSize="20000000"
|
||||
maxArchiveFiles="30"
|
||||
keepFileOpen="false"
|
||||
|
||||
@@ -9,14 +9,15 @@
|
||||
"ConnectionStrings": {
|
||||
"conn_zrAdmin": "server=127.0.0.1;user=zr;pwd=abc;database=admin"
|
||||
},
|
||||
"conn_zrAdmin_Type": 0, //MySql = 0, SqlServer = 1
|
||||
"urls": "http://localhost:8888", //<2F><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>url
|
||||
"sysConfig": {
|
||||
"DBCommandTimeout": 10,
|
||||
"tokenExpire": 1440,//Jwt token<65><6E>ʱʱ<CAB1>䣨<EFBFBD>֣<EFBFBD>
|
||||
"cors": "http://localhost:8887" //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>","<22><><EFBFBD><EFBFBD>
|
||||
},
|
||||
"DemoMode": false, //<2F>Ƿ<EFBFBD><C7B7><EFBFBD>ʾģʽ
|
||||
"DbKey": "", //<2F><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD>key
|
||||
"DbType": 0, //MySql = 0, SqlServer = 1
|
||||
"Upload": {
|
||||
"UploadDirectory": "/",
|
||||
"UploadUrl": "http://localhost:8888"
|
||||
|
||||
@@ -30,14 +30,14 @@
|
||||
{VueViewListContent}
|
||||
<el-table-column label="操作" align="center" width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" v-hasPermi="['{Permission}:update']" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">编辑</el-button>
|
||||
<el-button v-hasPermi="['{Permission}:update']" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">编辑</el-button>
|
||||
<el-popconfirm title="确定删除吗?" @confirm="handleDelete(scope.row)" style="margin-left:10px">
|
||||
<el-button slot="reference" v-hasPermi="['{Permission}:delete']" size="mini" type="text" icon="el-icon-delete">删除</el-button>
|
||||
<el-button slot="reference" v-hasPermi="['{Permission}:delete']" type="text" icon="el-icon-delete">删除</el-button>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination class="mt10" background :total="total" :current-page.sync="queryParams.pageNum" :page-size="queryParams.pageSize" :page-sizes="[20, 30, 50, 100]" layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange" @current-change="getList" />
|
||||
<pagination class="mt10" background :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
||||
|
||||
<!-- 添加或修改菜单对话框 -->
|
||||
<el-dialog :title="title" :lock-scroll="false" :visible.sync="open" >
|
||||
@@ -67,7 +67,7 @@ export default {
|
||||
return {
|
||||
labelWidth: "100px",
|
||||
formLabelWidth:"100px",
|
||||
// 选中数组
|
||||
// 选中{primaryKey}数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
@@ -129,7 +129,7 @@ export default {
|
||||
reset() {
|
||||
this.form = {
|
||||
{VueViewEditFormContent}
|
||||
//需个性化处理内容
|
||||
//TODO 根据实际内容调整
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
@@ -142,8 +142,9 @@ export default {
|
||||
pageSize: 20,
|
||||
//TODO 重置字段
|
||||
};
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map((item) => item.{primaryKey});
|
||||
this.single = selection.length!=1
|
||||
|
||||
Reference in New Issue
Block a user