操控平台后端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
4.1 KiB

@if(@Model.BaseClassName!=""){
@:using Admin.NET.Core;
}
namespace @Model.NameSpace;
/// <summary>
/// @(@Model.Description)
/// </summary>
[SugarTable("@(@Model.TableName)","@(@Model.Description)")]
public class @(@Model.EntityName) @Model.BaseClassName
{
@foreach (var column in Model.TableField){
if(@Model.BaseClassName=="" && @column.IsPrimarykey){
@:/// <summary>
@:/// @column.ColumnDescription
@:/// </summary>
if(!@column.IsNullable){
@:[Required]
}
if(@column.DataType=="string"||@column.DataType=="string?"){
@:[SugarColumn(ColumnName = "@column.DbColumnName", IsIdentity = @column.IsIdentity.ToString().ToLower(), ColumnDescription = "@column.ColumnDescription", IsPrimaryKey = true, Length = @column.Length)]
}
else if(@column.DataType=="decimal"||@column.DataType=="decimal?"){
@:[SugarColumn(ColumnName = "@column.DbColumnName", IsIdentity = @column.IsIdentity.ToString().ToLower(), ColumnDescription = "@column.ColumnDescription", IsPrimaryKey = true, Length = @column.Length, DecimalDigits=@column.DecimalDigits )]
}
else{
@:[SugarColumn(ColumnName = "@column.DbColumnName", IsIdentity = @column.IsIdentity.ToString().ToLower(), ColumnDescription = "@column.ColumnDescription", IsPrimaryKey = true)]
}
@:public @column.DataType @column.PropertyName { get; set; }
@:
}
else if(@Model.BaseClassName=="" && !@column.IsPrimarykey){
@:/// <summary>
@:/// @column.ColumnDescription
@:/// </summary>
if(!@column.IsNullable){
@:[Required]
}
if(@column.DataType=="string"||@column.DataType=="string?"){
@:[SugarColumn(ColumnName = "@column.DbColumnName", ColumnDescription = "@column.ColumnDescription", Length = @column.Length)]
}
else if(@column.DataType=="decimal"||@column.DataType=="decimal?"){
@:[SugarColumn(ColumnName = "@column.DbColumnName", ColumnDescription = "@column.ColumnDescription", Length = @column.Length, DecimalDigits=@column.DecimalDigits )]
}
else{
@:[SugarColumn(ColumnName = "@column.DbColumnName", ColumnDescription = "@column.ColumnDescription")]
}
@:public @column.DataType @column.PropertyName { get; set; }
@:
}
else if(@Model.BaseClassName!="" && @column.IsPrimarykey && @column.DbColumnName.ToLower()!="id"){
@:/// <summary>
@:/// @column.ColumnDescription
@:/// </summary>
if(!@column.IsNullable){
@:[Required]
}
if(@column.DataType=="string"||@column.DataType=="string?"){
@:[SugarColumn(ColumnName = "@column.DbColumnName", IsIdentity = @column.IsIdentity.ToString().ToLower(), ColumnDescription = "@column.ColumnDescription", IsPrimaryKey = true, Length = @column.Length)]
}
else if(@column.DataType=="decimal"||@column.DataType=="decimal?"){
@:[SugarColumn(ColumnName = "@column.DbColumnName", IsIdentity = @column.IsIdentity.ToString().ToLower(), ColumnDescription = "@column.ColumnDescription", IsPrimaryKey = true, Length = @column.Length, DecimalDigits=@column.DecimalDigits )]
}
else{
@:[SugarColumn(ColumnName = "@column.DbColumnName", IsIdentity = @column.IsIdentity.ToString().ToLower(), ColumnDescription = "@column.ColumnDescription", IsPrimaryKey = true)]
}
@:public @column.DataType @column.PropertyName { get; set; }
@:
}
else if(@Model.BaseClassName!="" && !@column.IsPrimarykey && @column.DbColumnName.ToLower()!="id"){
@:/// <summary>
@:/// @column.ColumnDescription
@:/// </summary>
if(!@column.IsNullable){
@:[Required]
}
if(@column.DataType=="string"||@column.DataType=="string?"){
@:[SugarColumn(ColumnName = "@column.DbColumnName", ColumnDescription = "@column.ColumnDescription", Length = @column.Length)]
}
else if(@column.DataType=="decimal"||@column.DataType=="decimal?"){
@:[SugarColumn(ColumnName = "@column.DbColumnName", ColumnDescription = "@column.ColumnDescription", Length = @column.Length, DecimalDigits=@column.DecimalDigits )]
}
else{
@:[SugarColumn(ColumnName = "@column.DbColumnName", ColumnDescription = "@column.ColumnDescription")]
}
@:public @column.DataType @column.PropertyName { get; set; }
@:
}
}
}