⚡优化代码生成导出模板
This commit is contained in:
parent
bfe8b68a94
commit
01daf4f591
@ -1,7 +1,3 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
$if(replaceDto.ShowBtnExport)
|
|
||||||
using MiniExcelLibs.Attributes;
|
|
||||||
$end
|
|
||||||
$if(null != genTable.SubTableName && "" != genTable.SubTableName)
|
$if(null != genTable.SubTableName && "" != genTable.SubTableName)
|
||||||
using ${subTableOptions.ModelsNamespace}.${subTableOptions.SubNamespace};
|
using ${subTableOptions.ModelsNamespace}.${subTableOptions.SubNamespace};
|
||||||
$end
|
$end
|
||||||
@ -33,13 +29,19 @@ $end
|
|||||||
public class ${replaceDto.ModelTypeName}Dto
|
public class ${replaceDto.ModelTypeName}Dto
|
||||||
{
|
{
|
||||||
$foreach(item in genTable.Columns)
|
$foreach(item in genTable.Columns)
|
||||||
|
$set(labelName = "")
|
||||||
|
$if(item.ColumnComment != "")
|
||||||
|
$set(labelName = item.ColumnComment)
|
||||||
|
$else
|
||||||
|
$set(labelName = item.CsharpField)
|
||||||
|
$end
|
||||||
$if(item.IsRequired)
|
$if(item.IsRequired)
|
||||||
[Required(ErrorMessage = "${item.ColumnComment}不能为空")]
|
[Required(ErrorMessage = "${item.ColumnComment}不能为空")]
|
||||||
$end
|
$end
|
||||||
$if(replaceDto.ShowBtnExport)
|
$if(replaceDto.ShowBtnExport)
|
||||||
$if(item.IsExport)
|
$if(item.IsExport)
|
||||||
[ExcelColumn(Name = "$if(item.ColumnComment == "")${item.CsharpField}${else}${item.ColumnComment}${end}"$if(item.CsharpType == "DateTime"), Format = "yyyy-MM-dd HH:mm:ss", Width = 20$end)]
|
[ExcelColumn(Name = "$labelName"$if(item.CsharpType == "DateTime"), Format = "yyyy-MM-dd HH:mm:ss", Width = 20$end)]
|
||||||
[ExcelColumnName("$if(item.ColumnComment == "")${item.CsharpField}${else}${item.ColumnComment}${end}")]
|
[ExcelColumnName("$labelName")]
|
||||||
$else
|
$else
|
||||||
[ExcelIgnore]
|
[ExcelIgnore]
|
||||||
$end
|
$end
|
||||||
@ -68,7 +70,6 @@ $foreach(column in dicts)
|
|||||||
$if(column.IsExport)
|
$if(column.IsExport)
|
||||||
[ExcelColumn(Name = "$if(column.ColumnComment == "")${column.CsharpField}${else}${column.ColumnComment}${end}")]
|
[ExcelColumn(Name = "$if(column.ColumnComment == "")${column.CsharpField}${else}${column.ColumnComment}${end}")]
|
||||||
public string ${column.CsharpField}Label { get; set; }
|
public string ${column.CsharpField}Label { get; set; }
|
||||||
|
|
||||||
$end
|
$end
|
||||||
$end
|
$end
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user