mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-03-17 23:16:43 +08:00
spu、skus数据测试
This commit is contained in:
@@ -5,6 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Common.Enum;
|
||||
using Yi.Framework.Common.Models;
|
||||
using Yi.Framework.Interface;
|
||||
using Yi.Framework.Model.Models;
|
||||
@@ -34,5 +35,54 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
{
|
||||
return Result.Success().SetData(await _iSpuService.SelctPageList(eneity, page));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//数据测试
|
||||
[HttpGet]
|
||||
public async Task<Result> Test(OperEnum operEnum)
|
||||
{
|
||||
switch (operEnum)
|
||||
{
|
||||
case OperEnum.Insert:
|
||||
List<SpuEntity> spus = new();
|
||||
var spu1 = new SpuEntity()
|
||||
{
|
||||
Id = 1,
|
||||
SpuName = "华为mate40 5G手机",
|
||||
IsDeleted = false,
|
||||
Details = "华为手机就是牛",
|
||||
Price = "1000-2000",
|
||||
SpecsSpuAllInfo = new List<SpecsSpuAllInfoModel> {
|
||||
new SpecsSpuAllInfoModel { SpecsGroupName="内存",SpecsNames=new List<string> { "1GB","2GB","3GB"} } ,
|
||||
new SpecsSpuAllInfoModel { SpecsGroupName="颜色",SpecsNames=new List<string> { "红","蓝","绿"} } },
|
||||
};
|
||||
var spu2 = new SpuEntity()
|
||||
{
|
||||
Id = 2,
|
||||
SpuName = "小米888 8G手机",
|
||||
IsDeleted = false,
|
||||
Details = "小米手机就是牛",
|
||||
Price = "2000-3000",
|
||||
SpecsSpuAllInfo = new List<SpecsSpuAllInfoModel> {
|
||||
new SpecsSpuAllInfoModel { SpecsGroupName="内存",SpecsNames=new List<string> { "1GB","2GB","3GB"} } ,
|
||||
new SpecsSpuAllInfoModel { SpecsGroupName="颜色",SpecsNames=new List<string> { "红","蓝","绿"} } },
|
||||
};
|
||||
spus.Add(spu1);
|
||||
spus.Add(spu2);
|
||||
await _iSpuService._repository.InsertRangeAsync(spus);
|
||||
break;
|
||||
|
||||
case OperEnum.Delete:
|
||||
await _iSpuService._repository.DeleteAsync((u) => true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return Result.Success();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user