文件种子数据

This commit is contained in:
陈淳
2022-10-13 14:45:09 +08:00
parent ea4ddb68f3
commit 55ad046e96
14 changed files with 79 additions and 13 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 KiB

View File

@@ -0,0 +1,27 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Model.Models;
namespace Yi.Framework.Model.SeedData
{
public class FileSeed : AbstractSeed<FileEntity>
{
public override List<FileEntity> GetSeed()
{
FileEntity file1 = new FileEntity()
{
Id = 0,
FilePath = "Image",
FileType = "",
IsDeleted = false,
FileName = "0.jpg"
};
Entitys.Add(file1);
return Entitys;
}
}
}

View File

@@ -40,6 +40,11 @@ namespace Yi.Framework.Model.SeedData
{
return new DeptSeed().GetSeed();
}
public static List<FileEntity> GetFileSeed()
{
return new FileSeed().GetSeed();
}
public static List<UserRoleEntity> GetUserRoleSeed(List<UserEntity> users, List<RoleEntity> roles)
{
List<UserRoleEntity> userRoleEntities = new();

View File

@@ -23,6 +23,7 @@ namespace Yi.Framework.WebCore.DbExtend
var posts = SeedFactory.GetPostSeed();
var dictinfos = SeedFactory.GetDictionaryInfoSeed();
var depts = SeedFactory.GetDeptSeed();
var files = SeedFactory.GetFileSeed();
try
{
_Db.AsTenant().BeginTran();
@@ -68,6 +69,12 @@ namespace Yi.Framework.WebCore.DbExtend
{
_Db.Insertable(SeedFactory.GetRoleMenuSeed(roles, menus)).ExecuteCommand();
}
if (!_Db.Queryable<FileEntity>().Any())
{
_Db.Insertable(files).ExecuteCommand();
}
_Db.AsTenant().CommitTran();
res = true;
}