解决linux环境下代码生成路径问题

This commit is contained in:
izory
2021-09-23 17:31:46 +08:00
parent f44393b4b9
commit cf9d8ac624
5 changed files with 125 additions and 85 deletions

View File

@@ -8,6 +8,7 @@ using Microsoft.Extensions.Hosting;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.IO;
using ZR.Admin.WebApi.Extensions;
using ZR.Admin.WebApi.Filters;
using ZR.CodeGenerator;
@@ -83,9 +84,9 @@ namespace ZR.Admin.WebApi.Controllers
{
throw new CustomException(ResultCode.CUSTOM_ERROR, "请求参数为空");
}
dto.ZipPath = WebHostEnvironment.WebRootPath + "\\Generatecode\\";
dto.GenCodePath = dto.ZipPath + DateTime.Now.ToString("yyyyMMdd") + "\\";
dto.ZipPath = Path.Combine(WebHostEnvironment.WebRootPath, "Generatecode");
dto.GenCodePath = Path.Combine(dto.ZipPath, DateTime.Now.ToString("yyyyMMdd"));
var genTableInfo = GenTableService.GetGenTableInfo(dto.TableId);
var getTableColumn = GenTableColumnService.GenTableColumns(dto.TableId);
genTableInfo.Columns = getTableColumn;
@@ -168,8 +169,8 @@ namespace ZR.Admin.WebApi.Controllers
{
GenTable genTable = new()
{
BaseNameSpace = "ZR.",
ModuleName = "bus",
BaseNameSpace = "ZR.",//导入默认命名空间前缀
ModuleName = "bus",//导入默认模块名
ClassName = CodeGeneratorTool.GetClassName(tableName),
BusinessName = CodeGeneratorTool.GetClassName(tableName),
FunctionAuthor = ConfigUtils.Instance.GetConfig(GenConstants.Gen_author),

View File

@@ -23,8 +23,8 @@
<!--archiveAboveSize每个日志文件大小的最大值单位字节主日志文件超过大小超过该值时会将文件内容写入滚动日志并清空主日志文件内容-->
<!--${basedir}表示当前应用程序域所在的根目录-->
<target name="allfile" xsi:type="File"
fileName="${basedir}/adminlogs/nlog-all-${shortdate}.log"
archiveFileName="${basedir}/adminlogs/all/all.{###}.txt"
fileName="${basedir}/adminlogs/all.log"
archiveFileName="${basedir}/adminlogs/all.{###}.txt"
archiveAboveSize="20000000"
maxArchiveFiles="30"
keepFileOpen="false"