文件种子数据
This commit is contained in:
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 |
Binary file not shown.
27
Yi.Framework.Net6/Yi.Framework.Model/SeedData/FileSeed.cs
Normal file
27
Yi.Framework.Net6/Yi.Framework.Model/SeedData/FileSeed.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user