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.
39 lines
1.1 KiB
39 lines
1.1 KiB
5 months ago
|
using Admin.NET.Core;
|
||
|
using @Model.EntityNameSpace;
|
||
|
|
||
|
namespace @Model.NameSpace;
|
||
|
|
||
|
/// <summary>
|
||
|
/// @(Model.Description) 表种子数据
|
||
|
/// </summary>
|
||
|
public class @(Model.SeedDataName): ISqlSugarEntitySeedData<@(Model.EntityName)>
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 种子数据
|
||
|
/// </summary>
|
||
|
/// <returns></returns>
|
||
|
public IEnumerable<@(Model.EntityName)> HasData()
|
||
|
{
|
||
|
string recordsJSON = @@"
|
||
|
@(Model.RecordsJSON.Replace("\"","\"\"").Replace("\n", "\n\t\t\t"))
|
||
|
";
|
||
|
List<@(Model.EntityName)> records = Newtonsoft.Json.JsonConvert.DeserializeObject<List<@(Model.EntityName)>>(recordsJSON);
|
||
|
@if (Model.JsonIgnoreInfo.Count>0) {
|
||
|
@:
|
||
|
@:#region 处理 JsonIgnore 的Property
|
||
|
@:
|
||
|
@foreach (var jii in Model.JsonIgnoreInfo){
|
||
|
@foreach (var j in jii){
|
||
|
@:records[@j.RecordIndex].@(j.Name) = @(j.Value);
|
||
|
}
|
||
|
@:
|
||
|
}
|
||
|
@:#endregion
|
||
|
}
|
||
|
|
||
|
// 后处理数据的特殊字段
|
||
|
//for (int i = 0; i < records.Count; i++) { }
|
||
|
|
||
|
return records;
|
||
|
}
|
||
|
}
|