Merge pull request #2 from ccnetcore/ec

ok
This commit is contained in:
橙子
2021-11-09 19:29:40 +08:00
committed by GitHub
39 changed files with 5724 additions and 148 deletions

1
.gitignore vendored
View File

@@ -338,5 +338,4 @@ ASALocalRun/
# BeatPulse healthcheck temp database
healthchecksdb
Yi.Framework/Yi.Framework.ApiMicroservice/YIDB.db-shm
*.json

View File

@@ -1,9 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}

View File

@@ -1,87 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
"Consul_Enabled": false,
"DbSeed_Enabled": true,
"Apollo_Enabled": false,
"HealthCheck_Enabled": false,
"Cors_Enabled": true,
"RabbitMQ_Enabled": true,
"Redis_Enabled": true,
"RedisSeed_Enabled": true,
"Kafka_Enabled": false,
"ElasticSeach_Enabled": false,
"MutiDB_Enabled": false,
"SMS_Enabled": true,
"DbList": [ "Sqlite", "Mysql", "Sqlserver", "Oracle" ],
"DbSelect": "Mysql",
"DbConn": {
"WriteUrl": "server=118.195.191.41;port=3306;database=YIDB;user id=root;password=Qz52013142020.",
"ReadUrl": [
"server=118.195.191.41;port=3306;database=YIDB;user id=root;password=Qz52013142020.",
"server=118.195.191.41;port=3306;database=YIDB;user id=root;password=Qz52013142020.",
"server=118.195.191.41;port=3306;database=YIDB;user id=root;password=Qz52013142020."
]
},
"Apollo": {
"AppId": "Yi.Framework.ApiMicroservice",
"Env": "DEV",
"MetaServer": "http://192.168.2.168:8080",
"ConfigServer": [ "http://192.168.2.168:8080" ]
},
"JWTTokenOptions": {
"Audience": "http://localhost:7000",
"Issuer": "http://localhost:7000",
"SecurityKey": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDI2a2EJ7m872v0afyoSDJT2o1+SitIeJSWtLJU8/Wz2m7gStexajkeD+Lka6DSTy8gt9UwfgVQo6uKjVLG5Ex7PiGOODVqAEghBuS7JzIYU5RvI543nNDAPfnJsas96mSA7L/mD7RTE2drj6hf3oZjJpMPZUQI/B1Qjb5H3K3PNwIDAQAB"
},
"RedisConnOptions": {
"Host": "118.195.191.41",
"Prot": 6379,
"DB": 1,
"Password": "Qz52013142020."
},
"RabbitConn": {
"HostName": "118.195.191.41",
"UserName": "cc",
"Password": "cc",
"Port": 5672
},
"ElasticSeachConn": {
"Url": "",
"IndexName": ""
},
"KafkaOptions": {
"BrokerList": "192.168.3.230:9092",
"TopicName": "kafkalog"
},
"ConsulClientOption": {
"IP": "118.195.191.41",
"Port": "8500",
"Datacenter": "dc1"
},
"ConsulRegisterOption": {
"IP": "183.216.18.15",
"Port": "44329",
"GroupName": "ApiMicroservice",
"HealthCheckUrl": "/Health",
"Interval": 10,
"Timeout": 5,
"DeregisterCriticalServiceAfter": 60,
"Tag": "13"
},
"SMS": {
"ID": "LTAI5tJvjPaXCyyPMfXLNbVA",
"Secret": "fLQv7jjj57fUKLFK8REeAQPFVDjUYn",
"Sign": "JiftCC",
"Template": "SMS_221640732"
},
"IPLibraryServiceUrl": "http://gRPCIPLibraryService"
}

View File

@@ -22,18 +22,5 @@ namespace Yi.Framework.AuthenticationCenter.Controllers
{
_logger = logger;
}
[HttpGet]
public IEnumerable<WeatherForecast> Get()
{
var rng = new Random();
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateTime.Now.AddDays(index),
TemperatureC = rng.Next(-20, 55),
Summary = Summaries[rng.Next(Summaries.Length)]
})
.ToArray();
}
}
}

View File

@@ -1,15 +0,0 @@
using System;
namespace Yi.Framework.AuthenticationCenter
{
public class WeatherForecast
{
public DateTime Date { get; set; }
public int TemperatureC { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
public string Summary { get; set; }
}
}

View File

@@ -49,16 +49,16 @@ namespace Yi.Framework.ElasticSearchProcessor
//<2F><><EFBFBD>ж<EFBFBD><D0B6><EFBFBD>ɾ<EFBFBD>ģ<EFBFBD>es<65><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD>
//switch (spuCQRSQueueModel.CQRSType)
//{
//case (int)SPUCQRSQueueModelType.Insert:
//case (int)SPUCQRSQueueModelType.Update:
// {
// Goods goods = this._ISearchService.GetGoodsBySpuId(spuCQRSQueueModel.SpuId);
// this._IElasticSearchService.InsertOrUpdata<Goods>(goods);
// break;
// }
//case (int)SPUCQRSQueueModelType.Delete:
// this._IElasticSearchService.Delete<Goods>(spuCQRSQueueModel.SpuId.ToString());
// break;
// case (int)SPUCQRSQueueModelType.Insert:
// case (int)SPUCQRSQueueModelType.Update:
// {
// Goods goods = this._ISearchService.GetGoodsBySpuId(spuCQRSQueueModel.SpuId);
// this._IElasticSearchService.InsertOrUpdata<Goods>(goods);
// break;
// }
// case (int)SPUCQRSQueueModelType.Delete:
// this._IElasticSearchService.Delete<Goods>(spuCQRSQueueModel.SpuId.ToString());
// break;
// default:
// throw new Exception("wrong spuCQRSQueueModel.CQRSType");
//}

View File

@@ -13,7 +13,9 @@ using System.Threading;
using System.Threading.Tasks;
using Yi.Framework.Common.IOCOptions;
using Yi.Framework.Common.Models;
using Yi.Framework.Common.QueueModel;
using Yi.Framework.Core;
using Yi.Framework.Interface;
namespace Yi.Framework.ElasticSearchProcessor
{
@@ -25,13 +27,15 @@ namespace Yi.Framework.ElasticSearchProcessor
private readonly ElasticSearchInvoker _elasticSearchInvoker;
private readonly IOptionsMonitor<ElasticSearchOptions> _ElasticSearchOptions = null;
public WarmupESIndexWorker(ILogger<WarmupESIndexWorker> logger, RabbitMQInvoker rabbitMQInvoker, IConfiguration configuration, ElasticSearchInvoker elasticSearchInvoker, IOptionsMonitor<ElasticSearchOptions> optionsMonitor)
private readonly ISearchService _searchService;
public WarmupESIndexWorker(ILogger<WarmupESIndexWorker> logger, RabbitMQInvoker rabbitMQInvoker, IConfiguration configuration, ElasticSearchInvoker elasticSearchInvoker, IOptionsMonitor<ElasticSearchOptions> optionsMonitor, ISearchService searchService)
{
this._logger = logger;
this._RabbitMQInvoker = rabbitMQInvoker;
this._configuration = configuration;
this._elasticSearchInvoker = elasticSearchInvoker;
this._ElasticSearchOptions = optionsMonitor;
this._searchService=searchService;
}
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
@@ -44,14 +48,14 @@ namespace Yi.Framework.ElasticSearchProcessor
HttpClient _HttpClient = new HttpClient();
this._RabbitMQInvoker.RegistReciveAction(rabbitMQConsumerModel, message =>
{
//SKUWarmupQueueModel skuWarmupQueueModel = JsonConvert.DeserializeObject<SKUWarmupQueueModel>(message);
SKUWarmupQueueModel skuWarmupQueueModel = JsonConvert.DeserializeObject<SKUWarmupQueueModel>(message);
//<2F><><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>ģ<EFBFBD>͡<EFBFBD>
#region <EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD>Index---<EFBFBD>½<EFBFBD>Index---<EFBFBD>ٽ<EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
try
{
this._elasticSearchInvoker.DropIndex(this._ElasticSearchOptions.CurrentValue.IndexName);
//this._ISearchService.ImpDataBySpu();
this._searchService.ImpDataBySpu();
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>es<65><73><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
this._logger.LogInformation($"{nameof(WarmupESIndexWorker)}.InitAll succeed");
return true;

View File

@@ -4,4 +4,33 @@
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<None Remove="configuration.json" />
<None Remove="Log4net.config" />
</ItemGroup>
<ItemGroup>
<Content Include="configuration.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Include="Log4net.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="5.0.4" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Yi.Framework.Common\Yi.Framework.Common.csproj" />
<ProjectReference Include="..\Yi.Framework.Interface\Yi.Framework.Interface.csproj" />
<ProjectReference Include="..\Yi.Framework.WebCore\Yi.Framework.WebCore.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Model.Models;
using Yi.Framework.Model.Search;
namespace Yi.Framework.Interface
{
public interface IGoodsService
{
PageResult<spu> QuerySpuByPage(int page, int rows, string key, bool? saleable);
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Interface
{
public interface ISearchService
{
void ImpDataBySpu();
}
}

View File

@@ -8,6 +8,18 @@ using Yi.Framework.Model.Models;
namespace Yi.Framework.Interface
{
public partial interface IBrandService:IBaseService<brand>
{
Task<bool> DelListByUpdateAsync(List<int> _ids);
Task<IEnumerable<brand>> GetAllEntitiesTrueAsync();
}
public partial interface ICategoryService:IBaseService<category>
{
Task<bool> DelListByUpdateAsync(List<int> _ids);
Task<IEnumerable<category>> GetAllEntitiesTrueAsync();
}
public partial interface IMenuService:IBaseService<menu>
{
Task<bool> DelListByUpdateAsync(List<int> _ids);
@@ -20,12 +32,54 @@ namespace Yi.Framework.Interface
Task<IEnumerable<mould>> GetAllEntitiesTrueAsync();
}
public partial interface IOrderService:IBaseService<order>
{
Task<bool> DelListByUpdateAsync(List<int> _ids);
Task<IEnumerable<order>> GetAllEntitiesTrueAsync();
}
public partial interface IRoleService:IBaseService<role>
{
Task<bool> DelListByUpdateAsync(List<int> _ids);
Task<IEnumerable<role>> GetAllEntitiesTrueAsync();
}
public partial interface ISkuService:IBaseService<sku>
{
Task<bool> DelListByUpdateAsync(List<int> _ids);
Task<IEnumerable<sku>> GetAllEntitiesTrueAsync();
}
public partial interface ISpec_groupService:IBaseService<spec_group>
{
Task<bool> DelListByUpdateAsync(List<int> _ids);
Task<IEnumerable<spec_group>> GetAllEntitiesTrueAsync();
}
public partial interface ISpec_paramService:IBaseService<spec_param>
{
Task<bool> DelListByUpdateAsync(List<int> _ids);
Task<IEnumerable<spec_param>> GetAllEntitiesTrueAsync();
}
public partial interface ISpuService:IBaseService<spu>
{
Task<bool> DelListByUpdateAsync(List<int> _ids);
Task<IEnumerable<spu>> GetAllEntitiesTrueAsync();
}
public partial interface ISpu_detailService:IBaseService<spu_detail>
{
Task<bool> DelListByUpdateAsync(List<int> _ids);
Task<IEnumerable<spu_detail>> GetAllEntitiesTrueAsync();
}
public partial interface IStockService:IBaseService<stock>
{
Task<bool> DelListByUpdateAsync(List<int> _ids);
Task<IEnumerable<stock>> GetAllEntitiesTrueAsync();
}
public partial interface IUserService:IBaseService<user>
{
Task<bool> DelListByUpdateAsync(List<int> _ids);

View File

@@ -0,0 +1,219 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Yi.Framework.Model;
namespace Yi.Framework.Model.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20211106080544_ec1")]
partial class ec1
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:MaxIdentifierLength", 64)
.HasAnnotation("ProductVersion", "5.0.11");
modelBuilder.Entity("Yi.Framework.Model.Models.menu", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("icon")
.HasColumnType("longtext");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<int>("is_show")
.HasColumnType("int");
b.Property<int>("is_top")
.HasColumnType("int");
b.Property<string>("menu_name")
.HasColumnType("longtext");
b.Property<int?>("menuid")
.HasColumnType("int");
b.Property<int?>("mouldid")
.HasColumnType("int");
b.Property<int?>("roleid")
.HasColumnType("int");
b.Property<string>("router")
.HasColumnType("longtext");
b.Property<int>("sort")
.HasColumnType("int");
b.HasKey("id");
b.HasIndex("menuid");
b.HasIndex("mouldid");
b.HasIndex("roleid");
b.ToTable("menu");
});
modelBuilder.Entity("Yi.Framework.Model.Models.mould", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<string>("mould_name")
.HasColumnType("longtext");
b.Property<string>("url")
.HasColumnType("longtext");
b.HasKey("id");
b.ToTable("mould");
});
modelBuilder.Entity("Yi.Framework.Model.Models.role", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("introduce")
.HasColumnType("longtext");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<string>("role_name")
.HasColumnType("longtext");
b.Property<int?>("userid")
.HasColumnType("int");
b.HasKey("id");
b.HasIndex("userid");
b.ToTable("role");
});
modelBuilder.Entity("Yi.Framework.Model.Models.user", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("address")
.HasColumnType("longtext");
b.Property<int?>("age")
.HasColumnType("int");
b.Property<string>("email")
.HasColumnType("longtext");
b.Property<string>("icon")
.HasColumnType("longtext");
b.Property<string>("introduction")
.HasColumnType("longtext");
b.Property<string>("ip")
.HasColumnType("longtext");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<string>("nick")
.HasColumnType("longtext");
b.Property<string>("password")
.HasColumnType("longtext");
b.Property<int?>("phone")
.HasColumnType("int");
b.Property<string>("username")
.HasColumnType("longtext");
b.HasKey("id");
b.ToTable("user");
});
modelBuilder.Entity("Yi.Framework.Model.Models.visit", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<int>("num")
.HasColumnType("int");
b.Property<DateTime>("time")
.HasColumnType("datetime(6)");
b.HasKey("id");
b.ToTable("visit");
});
modelBuilder.Entity("Yi.Framework.Model.Models.menu", b =>
{
b.HasOne("Yi.Framework.Model.Models.menu", null)
.WithMany("children")
.HasForeignKey("menuid");
b.HasOne("Yi.Framework.Model.Models.mould", "mould")
.WithMany()
.HasForeignKey("mouldid");
b.HasOne("Yi.Framework.Model.Models.role", null)
.WithMany("menus")
.HasForeignKey("roleid");
b.Navigation("mould");
});
modelBuilder.Entity("Yi.Framework.Model.Models.role", b =>
{
b.HasOne("Yi.Framework.Model.Models.user", null)
.WithMany("roles")
.HasForeignKey("userid");
});
modelBuilder.Entity("Yi.Framework.Model.Models.menu", b =>
{
b.Navigation("children");
});
modelBuilder.Entity("Yi.Framework.Model.Models.role", b =>
{
b.Navigation("menus");
});
modelBuilder.Entity("Yi.Framework.Model.Models.user", b =>
{
b.Navigation("roles");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,17 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Yi.Framework.Model.Migrations
{
public partial class ec1 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

View File

@@ -0,0 +1,732 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Yi.Framework.Model;
namespace Yi.Framework.Model.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20211106080646_ec2")]
partial class ec2
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:MaxIdentifierLength", 64)
.HasAnnotation("ProductVersion", "5.0.11");
modelBuilder.Entity("Yi.Framework.Model.Models.brand", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("image")
.HasColumnType("longtext");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<string>("letter")
.HasColumnType("longtext");
b.Property<string>("name")
.HasColumnType("longtext");
b.HasKey("id");
b.ToTable("brand");
});
modelBuilder.Entity("Yi.Framework.Model.Models.brand_category", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("brandId")
.HasColumnType("int");
b.Property<int>("categoryId")
.HasColumnType("int");
b.Property<int>("is_delete")
.HasColumnType("int");
b.HasKey("id");
b.HasIndex("brandId");
b.HasIndex("categoryId");
b.ToTable("brand_category");
});
modelBuilder.Entity("Yi.Framework.Model.Models.category", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int?>("categoryid")
.HasColumnType("int");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<int>("is_parent")
.HasColumnType("int");
b.Property<string>("name")
.HasColumnType("longtext");
b.Property<int>("sort")
.HasColumnType("int");
b.HasKey("id");
b.HasIndex("categoryid");
b.ToTable("category");
});
modelBuilder.Entity("Yi.Framework.Model.Models.menu", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("icon")
.HasColumnType("longtext");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<int>("is_show")
.HasColumnType("int");
b.Property<int>("is_top")
.HasColumnType("int");
b.Property<string>("menu_name")
.HasColumnType("longtext");
b.Property<int?>("menuid")
.HasColumnType("int");
b.Property<int?>("mouldid")
.HasColumnType("int");
b.Property<int?>("roleid")
.HasColumnType("int");
b.Property<string>("router")
.HasColumnType("longtext");
b.Property<int>("sort")
.HasColumnType("int");
b.HasKey("id");
b.HasIndex("menuid");
b.HasIndex("mouldid");
b.HasIndex("roleid");
b.ToTable("menu");
});
modelBuilder.Entity("Yi.Framework.Model.Models.mould", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<string>("mould_name")
.HasColumnType("longtext");
b.Property<string>("url")
.HasColumnType("longtext");
b.HasKey("id");
b.ToTable("mould");
});
modelBuilder.Entity("Yi.Framework.Model.Models.order", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("actual_pay")
.HasColumnType("int");
b.Property<string>("buyer_message")
.HasColumnType("longtext");
b.Property<string>("buyer_nick")
.HasColumnType("longtext");
b.Property<int>("buyer_rate")
.HasColumnType("int");
b.Property<DateTime>("creat_time")
.HasColumnType("datetime(6)");
b.Property<int>("invoice_type")
.HasColumnType("int");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<int>("payment_type")
.HasColumnType("int");
b.Property<int>("post_fee")
.HasColumnType("int");
b.Property<string>("promotion_ids")
.HasColumnType("longtext");
b.Property<string>("receiver")
.HasColumnType("longtext");
b.Property<string>("receiver_address")
.HasColumnType("longtext");
b.Property<string>("receiver_city")
.HasColumnType("longtext");
b.Property<string>("receiver_district")
.HasColumnType("longtext");
b.Property<string>("receiver_mobile")
.HasColumnType("longtext");
b.Property<string>("receiver_state")
.HasColumnType("longtext");
b.Property<string>("receiver_zip")
.HasColumnType("longtext");
b.Property<string>("shipping_code")
.HasColumnType("longtext");
b.Property<string>("shipping_name")
.HasColumnType("longtext");
b.Property<int?>("skuid")
.HasColumnType("int");
b.Property<int>("source_type")
.HasColumnType("int");
b.Property<int>("total_pay")
.HasColumnType("int");
b.HasKey("id");
b.HasIndex("skuid");
b.ToTable("order");
});
modelBuilder.Entity("Yi.Framework.Model.Models.role", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("introduce")
.HasColumnType("longtext");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<string>("role_name")
.HasColumnType("longtext");
b.Property<int?>("userid")
.HasColumnType("int");
b.HasKey("id");
b.HasIndex("userid");
b.ToTable("role");
});
modelBuilder.Entity("Yi.Framework.Model.Models.sku", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<DateTime>("crate_time")
.HasColumnType("datetime(6)");
b.Property<int>("enable")
.HasColumnType("int");
b.Property<string>("images")
.HasColumnType("longtext");
b.Property<string>("indexes")
.HasColumnType("longtext");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<DateTime>("last_update_time")
.HasColumnType("datetime(6)");
b.Property<string>("own_spec")
.HasColumnType("longtext");
b.Property<int>("price")
.HasColumnType("int");
b.Property<int?>("spuid")
.HasColumnType("int");
b.Property<string>("title")
.HasColumnType("longtext");
b.HasKey("id");
b.HasIndex("spuid");
b.ToTable("sku");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spec_group", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int?>("categoryid")
.HasColumnType("int");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<string>("name")
.HasColumnType("longtext");
b.HasKey("id");
b.HasIndex("categoryid");
b.ToTable("spec_group");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spec_param", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int?>("categoryid")
.HasColumnType("int");
b.Property<int>("generic")
.HasColumnType("int");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<string>("name")
.HasColumnType("longtext");
b.Property<int>("numeric")
.HasColumnType("int");
b.Property<int>("searching")
.HasColumnType("int");
b.Property<string>("segments")
.HasColumnType("longtext");
b.Property<int?>("spec_Groupid")
.HasColumnType("int");
b.Property<string>("unit")
.HasColumnType("longtext");
b.HasKey("id");
b.HasIndex("categoryid");
b.HasIndex("spec_Groupid");
b.ToTable("spec_param");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spu", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int?>("brandid")
.HasColumnType("int");
b.Property<DateTime>("crate_time")
.HasColumnType("datetime(6)");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<DateTime>("last_update_time")
.HasColumnType("datetime(6)");
b.Property<int>("saleable")
.HasColumnType("int");
b.Property<int?>("spu_Detailid")
.HasColumnType("int");
b.Property<string>("sub_title")
.HasColumnType("longtext");
b.Property<string>("title")
.HasColumnType("longtext");
b.Property<int>("valid")
.HasColumnType("int");
b.HasKey("id");
b.HasIndex("brandid");
b.HasIndex("spu_Detailid");
b.ToTable("spu");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spu_detail", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("after_service")
.HasColumnType("longtext");
b.Property<string>("description")
.HasColumnType("longtext");
b.Property<string>("generic_spec")
.HasColumnType("longtext");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<string>("packing_list")
.HasColumnType("longtext");
b.Property<string>("special_spec")
.HasColumnType("longtext");
b.HasKey("id");
b.ToTable("spu_detail");
});
modelBuilder.Entity("Yi.Framework.Model.Models.stock", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<int>("seckill_stock")
.HasColumnType("int");
b.Property<int>("seckill_total")
.HasColumnType("int");
b.Property<int?>("skuid")
.HasColumnType("int");
b.Property<int>("stock_count")
.HasColumnType("int");
b.HasKey("id");
b.HasIndex("skuid");
b.ToTable("stock");
});
modelBuilder.Entity("Yi.Framework.Model.Models.user", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("address")
.HasColumnType("longtext");
b.Property<int?>("age")
.HasColumnType("int");
b.Property<string>("email")
.HasColumnType("longtext");
b.Property<string>("icon")
.HasColumnType("longtext");
b.Property<string>("introduction")
.HasColumnType("longtext");
b.Property<string>("ip")
.HasColumnType("longtext");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<string>("nick")
.HasColumnType("longtext");
b.Property<string>("password")
.HasColumnType("longtext");
b.Property<int?>("phone")
.HasColumnType("int");
b.Property<string>("username")
.HasColumnType("longtext");
b.HasKey("id");
b.ToTable("user");
});
modelBuilder.Entity("Yi.Framework.Model.Models.visit", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<int>("num")
.HasColumnType("int");
b.Property<DateTime>("time")
.HasColumnType("datetime(6)");
b.HasKey("id");
b.ToTable("visit");
});
modelBuilder.Entity("categoryspu", b =>
{
b.Property<int>("categoriesid")
.HasColumnType("int");
b.Property<int>("spusid")
.HasColumnType("int");
b.HasKey("categoriesid", "spusid");
b.HasIndex("spusid");
b.ToTable("categoryspu");
});
modelBuilder.Entity("Yi.Framework.Model.Models.brand_category", b =>
{
b.HasOne("Yi.Framework.Model.Models.brand", "brand")
.WithMany("categories")
.HasForeignKey("brandId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Yi.Framework.Model.Models.category", "category")
.WithMany("brands")
.HasForeignKey("categoryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("brand");
b.Navigation("category");
});
modelBuilder.Entity("Yi.Framework.Model.Models.category", b =>
{
b.HasOne("Yi.Framework.Model.Models.category", null)
.WithMany("chidrens")
.HasForeignKey("categoryid");
});
modelBuilder.Entity("Yi.Framework.Model.Models.menu", b =>
{
b.HasOne("Yi.Framework.Model.Models.menu", null)
.WithMany("children")
.HasForeignKey("menuid");
b.HasOne("Yi.Framework.Model.Models.mould", "mould")
.WithMany()
.HasForeignKey("mouldid");
b.HasOne("Yi.Framework.Model.Models.role", null)
.WithMany("menus")
.HasForeignKey("roleid");
b.Navigation("mould");
});
modelBuilder.Entity("Yi.Framework.Model.Models.order", b =>
{
b.HasOne("Yi.Framework.Model.Models.sku", null)
.WithMany("orders")
.HasForeignKey("skuid");
});
modelBuilder.Entity("Yi.Framework.Model.Models.role", b =>
{
b.HasOne("Yi.Framework.Model.Models.user", null)
.WithMany("roles")
.HasForeignKey("userid");
});
modelBuilder.Entity("Yi.Framework.Model.Models.sku", b =>
{
b.HasOne("Yi.Framework.Model.Models.spu", "spu")
.WithMany("skus")
.HasForeignKey("spuid");
b.Navigation("spu");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spec_group", b =>
{
b.HasOne("Yi.Framework.Model.Models.category", "category")
.WithMany("spec_Groups")
.HasForeignKey("categoryid");
b.Navigation("category");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spec_param", b =>
{
b.HasOne("Yi.Framework.Model.Models.category", "category")
.WithMany("spec_Params")
.HasForeignKey("categoryid");
b.HasOne("Yi.Framework.Model.Models.spec_group", "spec_Group")
.WithMany("spec_Params")
.HasForeignKey("spec_Groupid");
b.Navigation("category");
b.Navigation("spec_Group");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spu", b =>
{
b.HasOne("Yi.Framework.Model.Models.brand", "brand")
.WithMany("spus")
.HasForeignKey("brandid");
b.HasOne("Yi.Framework.Model.Models.spu_detail", "spu_Detail")
.WithMany()
.HasForeignKey("spu_Detailid");
b.Navigation("brand");
b.Navigation("spu_Detail");
});
modelBuilder.Entity("Yi.Framework.Model.Models.stock", b =>
{
b.HasOne("Yi.Framework.Model.Models.sku", "sku")
.WithMany()
.HasForeignKey("skuid");
b.Navigation("sku");
});
modelBuilder.Entity("categoryspu", b =>
{
b.HasOne("Yi.Framework.Model.Models.category", null)
.WithMany()
.HasForeignKey("categoriesid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Yi.Framework.Model.Models.spu", null)
.WithMany()
.HasForeignKey("spusid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Yi.Framework.Model.Models.brand", b =>
{
b.Navigation("categories");
b.Navigation("spus");
});
modelBuilder.Entity("Yi.Framework.Model.Models.category", b =>
{
b.Navigation("brands");
b.Navigation("chidrens");
b.Navigation("spec_Groups");
b.Navigation("spec_Params");
});
modelBuilder.Entity("Yi.Framework.Model.Models.menu", b =>
{
b.Navigation("children");
});
modelBuilder.Entity("Yi.Framework.Model.Models.role", b =>
{
b.Navigation("menus");
});
modelBuilder.Entity("Yi.Framework.Model.Models.sku", b =>
{
b.Navigation("orders");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spec_group", b =>
{
b.Navigation("spec_Params");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spu", b =>
{
b.Navigation("skus");
});
modelBuilder.Entity("Yi.Framework.Model.Models.user", b =>
{
b.Navigation("roles");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,436 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Yi.Framework.Model.Migrations
{
public partial class ec2 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "brand",
columns: table => new
{
id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
name = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
image = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
letter = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
is_delete = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_brand", x => x.id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "category",
columns: table => new
{
id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
name = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
sort = table.Column<int>(type: "int", nullable: false),
is_parent = table.Column<int>(type: "int", nullable: false),
categoryid = table.Column<int>(type: "int", nullable: true),
is_delete = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_category", x => x.id);
table.ForeignKey(
name: "FK_category_category_categoryid",
column: x => x.categoryid,
principalTable: "category",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "spu_detail",
columns: table => new
{
id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
description = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
generic_spec = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
special_spec = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
packing_list = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
after_service = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
is_delete = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_spu_detail", x => x.id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "brand_category",
columns: table => new
{
id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
brandId = table.Column<int>(type: "int", nullable: false),
categoryId = table.Column<int>(type: "int", nullable: false),
is_delete = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_brand_category", x => x.id);
table.ForeignKey(
name: "FK_brand_category_brand_brandId",
column: x => x.brandId,
principalTable: "brand",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_brand_category_category_categoryId",
column: x => x.categoryId,
principalTable: "category",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "spec_group",
columns: table => new
{
id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
name = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
categoryid = table.Column<int>(type: "int", nullable: true),
is_delete = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_spec_group", x => x.id);
table.ForeignKey(
name: "FK_spec_group_category_categoryid",
column: x => x.categoryid,
principalTable: "category",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "spu",
columns: table => new
{
id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
title = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
sub_title = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
saleable = table.Column<int>(type: "int", nullable: false),
valid = table.Column<int>(type: "int", nullable: false),
crate_time = table.Column<DateTime>(type: "datetime(6)", nullable: false),
last_update_time = table.Column<DateTime>(type: "datetime(6)", nullable: false),
brandid = table.Column<int>(type: "int", nullable: true),
spu_Detailid = table.Column<int>(type: "int", nullable: true),
is_delete = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_spu", x => x.id);
table.ForeignKey(
name: "FK_spu_brand_brandid",
column: x => x.brandid,
principalTable: "brand",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_spu_spu_detail_spu_Detailid",
column: x => x.spu_Detailid,
principalTable: "spu_detail",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "spec_param",
columns: table => new
{
id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
name = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
numeric = table.Column<int>(type: "int", nullable: false),
unit = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
generic = table.Column<int>(type: "int", nullable: false),
searching = table.Column<int>(type: "int", nullable: false),
segments = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
spec_Groupid = table.Column<int>(type: "int", nullable: true),
categoryid = table.Column<int>(type: "int", nullable: true),
is_delete = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_spec_param", x => x.id);
table.ForeignKey(
name: "FK_spec_param_category_categoryid",
column: x => x.categoryid,
principalTable: "category",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_spec_param_spec_group_spec_Groupid",
column: x => x.spec_Groupid,
principalTable: "spec_group",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "categoryspu",
columns: table => new
{
categoriesid = table.Column<int>(type: "int", nullable: false),
spusid = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_categoryspu", x => new { x.categoriesid, x.spusid });
table.ForeignKey(
name: "FK_categoryspu_category_categoriesid",
column: x => x.categoriesid,
principalTable: "category",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_categoryspu_spu_spusid",
column: x => x.spusid,
principalTable: "spu",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "sku",
columns: table => new
{
id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
title = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
images = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
price = table.Column<int>(type: "int", nullable: false),
indexes = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
enable = table.Column<int>(type: "int", nullable: false),
own_spec = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
crate_time = table.Column<DateTime>(type: "datetime(6)", nullable: false),
last_update_time = table.Column<DateTime>(type: "datetime(6)", nullable: false),
spuid = table.Column<int>(type: "int", nullable: true),
is_delete = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_sku", x => x.id);
table.ForeignKey(
name: "FK_sku_spu_spuid",
column: x => x.spuid,
principalTable: "spu",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "order",
columns: table => new
{
id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
total_pay = table.Column<int>(type: "int", nullable: false),
actual_pay = table.Column<int>(type: "int", nullable: false),
payment_type = table.Column<int>(type: "int", nullable: false),
post_fee = table.Column<int>(type: "int", nullable: false),
promotion_ids = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
creat_time = table.Column<DateTime>(type: "datetime(6)", nullable: false),
shipping_name = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
shipping_code = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
buyer_message = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
buyer_nick = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
buyer_rate = table.Column<int>(type: "int", nullable: false),
receiver_state = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
receiver_city = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
receiver_district = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
receiver_address = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
receiver_mobile = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
receiver_zip = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
receiver = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
invoice_type = table.Column<int>(type: "int", nullable: false),
source_type = table.Column<int>(type: "int", nullable: false),
skuid = table.Column<int>(type: "int", nullable: true),
is_delete = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_order", x => x.id);
table.ForeignKey(
name: "FK_order_sku_skuid",
column: x => x.skuid,
principalTable: "sku",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "stock",
columns: table => new
{
id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
seckill_stock = table.Column<int>(type: "int", nullable: false),
seckill_total = table.Column<int>(type: "int", nullable: false),
stock_count = table.Column<int>(type: "int", nullable: false),
skuid = table.Column<int>(type: "int", nullable: true),
is_delete = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_stock", x => x.id);
table.ForeignKey(
name: "FK_stock_sku_skuid",
column: x => x.skuid,
principalTable: "sku",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_brand_category_brandId",
table: "brand_category",
column: "brandId");
migrationBuilder.CreateIndex(
name: "IX_brand_category_categoryId",
table: "brand_category",
column: "categoryId");
migrationBuilder.CreateIndex(
name: "IX_category_categoryid",
table: "category",
column: "categoryid");
migrationBuilder.CreateIndex(
name: "IX_categoryspu_spusid",
table: "categoryspu",
column: "spusid");
migrationBuilder.CreateIndex(
name: "IX_order_skuid",
table: "order",
column: "skuid");
migrationBuilder.CreateIndex(
name: "IX_sku_spuid",
table: "sku",
column: "spuid");
migrationBuilder.CreateIndex(
name: "IX_spec_group_categoryid",
table: "spec_group",
column: "categoryid");
migrationBuilder.CreateIndex(
name: "IX_spec_param_categoryid",
table: "spec_param",
column: "categoryid");
migrationBuilder.CreateIndex(
name: "IX_spec_param_spec_Groupid",
table: "spec_param",
column: "spec_Groupid");
migrationBuilder.CreateIndex(
name: "IX_spu_brandid",
table: "spu",
column: "brandid");
migrationBuilder.CreateIndex(
name: "IX_spu_spu_Detailid",
table: "spu",
column: "spu_Detailid");
migrationBuilder.CreateIndex(
name: "IX_stock_skuid",
table: "stock",
column: "skuid");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "brand_category");
migrationBuilder.DropTable(
name: "categoryspu");
migrationBuilder.DropTable(
name: "order");
migrationBuilder.DropTable(
name: "spec_param");
migrationBuilder.DropTable(
name: "stock");
migrationBuilder.DropTable(
name: "spec_group");
migrationBuilder.DropTable(
name: "sku");
migrationBuilder.DropTable(
name: "category");
migrationBuilder.DropTable(
name: "spu");
migrationBuilder.DropTable(
name: "brand");
migrationBuilder.DropTable(
name: "spu_detail");
}
}
}

View File

@@ -0,0 +1,770 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Yi.Framework.Model;
namespace Yi.Framework.Model.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20211106084427_ec3")]
partial class ec3
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:MaxIdentifierLength", 64)
.HasAnnotation("ProductVersion", "5.0.11");
modelBuilder.Entity("Yi.Framework.Model.Models.brand", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("image")
.HasColumnType("longtext")
.HasComment("品牌图片");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<string>("letter")
.HasColumnType("longtext")
.HasComment("品牌首字母");
b.Property<string>("name")
.HasColumnType("longtext")
.HasComment("品牌名称");
b.HasKey("id");
b.ToTable("brand");
});
modelBuilder.Entity("Yi.Framework.Model.Models.category", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int?>("categoryid")
.HasColumnType("int");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<int>("is_parent")
.HasColumnType("int")
.HasComment("是否父类别");
b.Property<string>("name")
.HasColumnType("longtext")
.HasComment("类别名称");
b.Property<int>("sort")
.HasColumnType("int")
.HasComment("排序");
b.HasKey("id");
b.HasIndex("categoryid");
b.ToTable("category");
});
modelBuilder.Entity("Yi.Framework.Model.Models.menu", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("icon")
.HasColumnType("longtext");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<int>("is_show")
.HasColumnType("int");
b.Property<int>("is_top")
.HasColumnType("int");
b.Property<string>("menu_name")
.HasColumnType("longtext");
b.Property<int?>("menuid")
.HasColumnType("int");
b.Property<int?>("mouldid")
.HasColumnType("int");
b.Property<int?>("roleid")
.HasColumnType("int");
b.Property<string>("router")
.HasColumnType("longtext");
b.Property<int>("sort")
.HasColumnType("int");
b.HasKey("id");
b.HasIndex("menuid");
b.HasIndex("mouldid");
b.HasIndex("roleid");
b.ToTable("menu");
});
modelBuilder.Entity("Yi.Framework.Model.Models.mould", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<string>("mould_name")
.HasColumnType("longtext");
b.Property<string>("url")
.HasColumnType("longtext");
b.HasKey("id");
b.ToTable("mould");
});
modelBuilder.Entity("Yi.Framework.Model.Models.order", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("actual_pay")
.HasColumnType("int")
.HasComment("实付金额。单位:分。如:20007表示:200元7分");
b.Property<string>("buyer_message")
.HasColumnType("longtext")
.HasComment("买家留言");
b.Property<string>("buyer_nick")
.HasColumnType("longtext")
.HasComment("买家昵称");
b.Property<int>("buyer_rate")
.HasColumnType("int")
.HasComment("买家是否已经评价,0未评价1已评价");
b.Property<DateTime>("creat_time")
.HasColumnType("datetime(6)")
.HasComment("订单创建时间");
b.Property<int>("invoice_type")
.HasColumnType("int")
.HasComment("发票类型:0无发票1普通发票2电子发票3增值税发票");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<int>("payment_type")
.HasColumnType("int")
.HasComment("支付类型1、在线支付2、货到付款");
b.Property<int>("post_fee")
.HasColumnType("int")
.HasComment("邮费。单位:分。如:20007表示:200元7分");
b.Property<string>("promotion_ids")
.HasColumnType("longtext")
.HasComment("promotion_ids");
b.Property<string>("receiver")
.HasColumnType("longtext")
.HasComment("收货人");
b.Property<string>("receiver_address")
.HasColumnType("longtext")
.HasComment("收获地址(街道、住址等详细地址)");
b.Property<string>("receiver_city")
.HasColumnType("longtext")
.HasComment("收获地址(市)");
b.Property<string>("receiver_district")
.HasColumnType("longtext")
.HasComment("收获地址(区/县)");
b.Property<string>("receiver_mobile")
.HasColumnType("longtext")
.HasComment("收货人手机");
b.Property<string>("receiver_state")
.HasColumnType("longtext")
.HasComment("收获地址(省)");
b.Property<string>("receiver_zip")
.HasColumnType("longtext")
.HasComment("收货人邮编");
b.Property<string>("shipping_code")
.HasColumnType("longtext")
.HasComment("物流单号");
b.Property<string>("shipping_name")
.HasColumnType("longtext")
.HasComment("物流名称");
b.Property<int?>("skuid")
.HasColumnType("int");
b.Property<int>("source_type")
.HasColumnType("int")
.HasComment("订单来源1:app端2pc端3M端4微信端5手机qq端");
b.Property<int>("total_pay")
.HasColumnType("int")
.HasComment("总金额,单位为分");
b.HasKey("id");
b.HasIndex("skuid");
b.ToTable("order");
});
modelBuilder.Entity("Yi.Framework.Model.Models.role", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("introduce")
.HasColumnType("longtext");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<string>("role_name")
.HasColumnType("longtext");
b.Property<int?>("userid")
.HasColumnType("int");
b.HasKey("id");
b.HasIndex("userid");
b.ToTable("role");
});
modelBuilder.Entity("Yi.Framework.Model.Models.sku", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<DateTime>("crate_time")
.HasColumnType("datetime(6)")
.HasComment("创建时间");
b.Property<int>("enable")
.HasColumnType("int")
.HasComment("是否有效0无效1有效");
b.Property<string>("images")
.HasColumnType("longtext")
.HasComment("商品的图片,多个图片以‘,’分割");
b.Property<string>("indexes")
.HasColumnType("longtext")
.HasComment("特有规格属性在spu属性模板中的对应下标组合");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<DateTime>("last_update_time")
.HasColumnType("datetime(6)")
.HasComment("最后更新时间");
b.Property<string>("own_spec")
.HasColumnType("longtext")
.HasComment("sku的特有规格参数键值对json格式反序列化时请使用linkedHashMap保证有序");
b.Property<int>("price")
.HasColumnType("int")
.HasComment("销售价格,单位为分");
b.Property<int?>("spuid")
.HasColumnType("int");
b.Property<string>("title")
.HasColumnType("longtext")
.HasComment("商品标题");
b.HasKey("id");
b.HasIndex("spuid");
b.ToTable("sku");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spec_group", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int?>("categoryid")
.HasColumnType("int");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<string>("name")
.HasColumnType("longtext")
.HasComment("规格组名称");
b.HasKey("id");
b.HasIndex("categoryid");
b.ToTable("spec_group");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spec_param", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int?>("categoryid")
.HasColumnType("int");
b.Property<int>("generic")
.HasColumnType("int")
.HasComment("是否是sku通用属性true或false");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<string>("name")
.HasColumnType("longtext")
.HasComment("参数名");
b.Property<int>("numeric")
.HasColumnType("int")
.HasComment("是否是数字类型参数true或false");
b.Property<int>("searching")
.HasColumnType("int")
.HasComment("是否用于搜索过滤true或false");
b.Property<string>("segments")
.HasColumnType("longtext")
.HasComment("数值类型参数如果需要搜索则添加分段间隔值如CPU频率间隔0.5-1.0");
b.Property<int?>("spec_Groupid")
.HasColumnType("int");
b.Property<string>("unit")
.HasColumnType("longtext")
.HasComment("数字类型参数的单位,非数字类型可以为空");
b.HasKey("id");
b.HasIndex("categoryid");
b.HasIndex("spec_Groupid");
b.ToTable("spec_param");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spu", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int?>("brandid")
.HasColumnType("int");
b.Property<DateTime>("crate_time")
.HasColumnType("datetime(6)")
.HasComment("创建时间");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<DateTime>("last_update_time")
.HasColumnType("datetime(6)")
.HasComment("最后更新时间");
b.Property<int>("saleable")
.HasColumnType("int")
.HasComment("是否上架");
b.Property<int?>("spu_Detailid")
.HasColumnType("int");
b.Property<string>("sub_title")
.HasColumnType("longtext")
.HasComment("子标题");
b.Property<string>("title")
.HasColumnType("longtext")
.HasComment("标题");
b.Property<int>("valid")
.HasColumnType("int")
.HasComment("是否有效");
b.HasKey("id");
b.HasIndex("brandid");
b.HasIndex("spu_Detailid");
b.ToTable("spu");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spu_detail", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("after_service")
.HasColumnType("longtext")
.HasComment("售后服务");
b.Property<string>("description")
.HasColumnType("longtext")
.HasComment("描述");
b.Property<string>("generic_spec")
.HasColumnType("longtext")
.HasComment("通用规格参数数据");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<string>("packing_list")
.HasColumnType("longtext")
.HasComment("包装清单");
b.Property<string>("special_spec")
.HasColumnType("longtext")
.HasComment("特有规格参数及可选值信息json格式");
b.HasKey("id");
b.ToTable("spu_detail");
});
modelBuilder.Entity("Yi.Framework.Model.Models.stock", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<int>("seckill_stock")
.HasColumnType("int")
.HasComment("可秒杀库存");
b.Property<int>("seckill_total")
.HasColumnType("int")
.HasComment("秒杀总数量");
b.Property<int?>("skuid")
.HasColumnType("int");
b.Property<int>("stock_count")
.HasColumnType("int")
.HasComment("库存数量");
b.HasKey("id");
b.HasIndex("skuid");
b.ToTable("stock");
});
modelBuilder.Entity("Yi.Framework.Model.Models.user", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("address")
.HasColumnType("longtext");
b.Property<int?>("age")
.HasColumnType("int");
b.Property<string>("email")
.HasColumnType("longtext");
b.Property<string>("icon")
.HasColumnType("longtext");
b.Property<string>("introduction")
.HasColumnType("longtext");
b.Property<string>("ip")
.HasColumnType("longtext");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<string>("nick")
.HasColumnType("longtext");
b.Property<string>("password")
.HasColumnType("longtext");
b.Property<int?>("phone")
.HasColumnType("int");
b.Property<string>("username")
.HasColumnType("longtext");
b.HasKey("id");
b.ToTable("user");
});
modelBuilder.Entity("Yi.Framework.Model.Models.visit", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<int>("num")
.HasColumnType("int");
b.Property<DateTime>("time")
.HasColumnType("datetime(6)");
b.HasKey("id");
b.ToTable("visit");
});
modelBuilder.Entity("brandcategory", b =>
{
b.Property<int>("brandsid")
.HasColumnType("int");
b.Property<int>("categoriesid")
.HasColumnType("int");
b.HasKey("brandsid", "categoriesid");
b.HasIndex("categoriesid");
b.ToTable("brandcategory");
});
modelBuilder.Entity("categoryspu", b =>
{
b.Property<int>("categoriesid")
.HasColumnType("int");
b.Property<int>("spusid")
.HasColumnType("int");
b.HasKey("categoriesid", "spusid");
b.HasIndex("spusid");
b.ToTable("categoryspu");
});
modelBuilder.Entity("Yi.Framework.Model.Models.category", b =>
{
b.HasOne("Yi.Framework.Model.Models.category", null)
.WithMany("chidrens")
.HasForeignKey("categoryid");
});
modelBuilder.Entity("Yi.Framework.Model.Models.menu", b =>
{
b.HasOne("Yi.Framework.Model.Models.menu", null)
.WithMany("children")
.HasForeignKey("menuid");
b.HasOne("Yi.Framework.Model.Models.mould", "mould")
.WithMany()
.HasForeignKey("mouldid");
b.HasOne("Yi.Framework.Model.Models.role", null)
.WithMany("menus")
.HasForeignKey("roleid");
b.Navigation("mould");
});
modelBuilder.Entity("Yi.Framework.Model.Models.order", b =>
{
b.HasOne("Yi.Framework.Model.Models.sku", null)
.WithMany("orders")
.HasForeignKey("skuid");
});
modelBuilder.Entity("Yi.Framework.Model.Models.role", b =>
{
b.HasOne("Yi.Framework.Model.Models.user", null)
.WithMany("roles")
.HasForeignKey("userid");
});
modelBuilder.Entity("Yi.Framework.Model.Models.sku", b =>
{
b.HasOne("Yi.Framework.Model.Models.spu", "spu")
.WithMany("skus")
.HasForeignKey("spuid");
b.Navigation("spu");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spec_group", b =>
{
b.HasOne("Yi.Framework.Model.Models.category", "category")
.WithMany("spec_Groups")
.HasForeignKey("categoryid");
b.Navigation("category");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spec_param", b =>
{
b.HasOne("Yi.Framework.Model.Models.category", "category")
.WithMany("spec_Params")
.HasForeignKey("categoryid");
b.HasOne("Yi.Framework.Model.Models.spec_group", "spec_Group")
.WithMany("spec_Params")
.HasForeignKey("spec_Groupid");
b.Navigation("category");
b.Navigation("spec_Group");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spu", b =>
{
b.HasOne("Yi.Framework.Model.Models.brand", "brand")
.WithMany("spus")
.HasForeignKey("brandid");
b.HasOne("Yi.Framework.Model.Models.spu_detail", "spu_Detail")
.WithMany()
.HasForeignKey("spu_Detailid");
b.Navigation("brand");
b.Navigation("spu_Detail");
});
modelBuilder.Entity("Yi.Framework.Model.Models.stock", b =>
{
b.HasOne("Yi.Framework.Model.Models.sku", "sku")
.WithMany()
.HasForeignKey("skuid");
b.Navigation("sku");
});
modelBuilder.Entity("brandcategory", b =>
{
b.HasOne("Yi.Framework.Model.Models.brand", null)
.WithMany()
.HasForeignKey("brandsid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Yi.Framework.Model.Models.category", null)
.WithMany()
.HasForeignKey("categoriesid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("categoryspu", b =>
{
b.HasOne("Yi.Framework.Model.Models.category", null)
.WithMany()
.HasForeignKey("categoriesid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Yi.Framework.Model.Models.spu", null)
.WithMany()
.HasForeignKey("spusid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Yi.Framework.Model.Models.brand", b =>
{
b.Navigation("spus");
});
modelBuilder.Entity("Yi.Framework.Model.Models.category", b =>
{
b.Navigation("chidrens");
b.Navigation("spec_Groups");
b.Navigation("spec_Params");
});
modelBuilder.Entity("Yi.Framework.Model.Models.menu", b =>
{
b.Navigation("children");
});
modelBuilder.Entity("Yi.Framework.Model.Models.role", b =>
{
b.Navigation("menus");
});
modelBuilder.Entity("Yi.Framework.Model.Models.sku", b =>
{
b.Navigation("orders");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spec_group", b =>
{
b.Navigation("spec_Params");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spu", b =>
{
b.Navigation("skus");
});
modelBuilder.Entity("Yi.Framework.Model.Models.user", b =>
{
b.Navigation("roles");
});
#pragma warning restore 612, 618
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,799 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Yi.Framework.Model;
namespace Yi.Framework.Model.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20211106110713_ec4")]
partial class ec4
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:MaxIdentifierLength", 64)
.HasAnnotation("ProductVersion", "5.0.11");
modelBuilder.Entity("Yi.Framework.Model.Models.brand", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("image")
.HasColumnType("longtext")
.HasComment("品牌图片");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<string>("letter")
.HasColumnType("longtext")
.HasComment("品牌首字母");
b.Property<string>("name")
.HasColumnType("longtext")
.HasComment("品牌名称");
b.HasKey("id");
b.ToTable("brand");
});
modelBuilder.Entity("Yi.Framework.Model.Models.category", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int?>("categoryid")
.HasColumnType("int");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<int>("is_parent")
.HasColumnType("int")
.HasComment("是否父类别");
b.Property<string>("name")
.HasColumnType("longtext")
.HasComment("类别名称");
b.Property<int>("sort")
.HasColumnType("int")
.HasComment("排序");
b.HasKey("id");
b.HasIndex("categoryid");
b.ToTable("category");
});
modelBuilder.Entity("Yi.Framework.Model.Models.menu", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("icon")
.HasColumnType("longtext");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<int>("is_show")
.HasColumnType("int");
b.Property<int>("is_top")
.HasColumnType("int");
b.Property<string>("menu_name")
.HasColumnType("longtext");
b.Property<int?>("menuid")
.HasColumnType("int");
b.Property<int?>("mouldid")
.HasColumnType("int");
b.Property<string>("router")
.HasColumnType("longtext");
b.Property<int>("sort")
.HasColumnType("int");
b.HasKey("id");
b.HasIndex("menuid");
b.HasIndex("mouldid");
b.ToTable("menu");
});
modelBuilder.Entity("Yi.Framework.Model.Models.mould", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<string>("mould_name")
.HasColumnType("longtext");
b.Property<string>("url")
.HasColumnType("longtext");
b.HasKey("id");
b.ToTable("mould");
});
modelBuilder.Entity("Yi.Framework.Model.Models.order", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("actual_pay")
.HasColumnType("int")
.HasComment("实付金额。单位:分。如:20007表示:200元7分");
b.Property<string>("buyer_message")
.HasColumnType("longtext")
.HasComment("买家留言");
b.Property<string>("buyer_nick")
.HasColumnType("longtext")
.HasComment("买家昵称");
b.Property<int>("buyer_rate")
.HasColumnType("int")
.HasComment("买家是否已经评价,0未评价1已评价");
b.Property<DateTime>("creat_time")
.HasColumnType("datetime(6)")
.HasComment("订单创建时间");
b.Property<int>("invoice_type")
.HasColumnType("int")
.HasComment("发票类型:0无发票1普通发票2电子发票3增值税发票");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<int>("payment_type")
.HasColumnType("int")
.HasComment("支付类型1、在线支付2、货到付款");
b.Property<int>("post_fee")
.HasColumnType("int")
.HasComment("邮费。单位:分。如:20007表示:200元7分");
b.Property<string>("promotion_ids")
.HasColumnType("longtext")
.HasComment("promotion_ids");
b.Property<string>("receiver")
.HasColumnType("longtext")
.HasComment("收货人");
b.Property<string>("receiver_address")
.HasColumnType("longtext")
.HasComment("收获地址(街道、住址等详细地址)");
b.Property<string>("receiver_city")
.HasColumnType("longtext")
.HasComment("收获地址(市)");
b.Property<string>("receiver_district")
.HasColumnType("longtext")
.HasComment("收获地址(区/县)");
b.Property<string>("receiver_mobile")
.HasColumnType("longtext")
.HasComment("收货人手机");
b.Property<string>("receiver_state")
.HasColumnType("longtext")
.HasComment("收获地址(省)");
b.Property<string>("receiver_zip")
.HasColumnType("longtext")
.HasComment("收货人邮编");
b.Property<string>("shipping_code")
.HasColumnType("longtext")
.HasComment("物流单号");
b.Property<string>("shipping_name")
.HasColumnType("longtext")
.HasComment("物流名称");
b.Property<int?>("skuid")
.HasColumnType("int");
b.Property<int>("source_type")
.HasColumnType("int")
.HasComment("订单来源1:app端2pc端3M端4微信端5手机qq端");
b.Property<int>("total_pay")
.HasColumnType("int")
.HasComment("总金额,单位为分");
b.HasKey("id");
b.HasIndex("skuid");
b.ToTable("order");
});
modelBuilder.Entity("Yi.Framework.Model.Models.role", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("introduce")
.HasColumnType("longtext");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<string>("role_name")
.HasColumnType("longtext");
b.HasKey("id");
b.ToTable("role");
});
modelBuilder.Entity("Yi.Framework.Model.Models.sku", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<DateTime>("crate_time")
.HasColumnType("datetime(6)")
.HasComment("创建时间");
b.Property<int>("enable")
.HasColumnType("int")
.HasComment("是否有效0无效1有效");
b.Property<string>("images")
.HasColumnType("longtext")
.HasComment("商品的图片,多个图片以‘,’分割");
b.Property<string>("indexes")
.HasColumnType("longtext")
.HasComment("特有规格属性在spu属性模板中的对应下标组合");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<DateTime>("last_update_time")
.HasColumnType("datetime(6)")
.HasComment("最后更新时间");
b.Property<string>("own_spec")
.HasColumnType("longtext")
.HasComment("sku的特有规格参数键值对json格式反序列化时请使用linkedHashMap保证有序");
b.Property<int>("price")
.HasColumnType("int")
.HasComment("销售价格,单位为分");
b.Property<int?>("spuid")
.HasColumnType("int");
b.Property<string>("title")
.HasColumnType("longtext")
.HasComment("商品标题");
b.HasKey("id");
b.HasIndex("spuid");
b.ToTable("sku");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spec_group", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int?>("categoryid")
.HasColumnType("int");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<string>("name")
.HasColumnType("longtext")
.HasComment("规格组名称");
b.HasKey("id");
b.HasIndex("categoryid");
b.ToTable("spec_group");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spec_param", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int?>("categoryid")
.HasColumnType("int");
b.Property<int>("generic")
.HasColumnType("int")
.HasComment("是否是sku通用属性true或false");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<string>("name")
.HasColumnType("longtext")
.HasComment("参数名");
b.Property<int>("numeric")
.HasColumnType("int")
.HasComment("是否是数字类型参数true或false");
b.Property<int>("searching")
.HasColumnType("int")
.HasComment("是否用于搜索过滤true或false");
b.Property<string>("segments")
.HasColumnType("longtext")
.HasComment("数值类型参数如果需要搜索则添加分段间隔值如CPU频率间隔0.5-1.0");
b.Property<int?>("spec_Groupid")
.HasColumnType("int");
b.Property<string>("unit")
.HasColumnType("longtext")
.HasComment("数字类型参数的单位,非数字类型可以为空");
b.HasKey("id");
b.HasIndex("categoryid");
b.HasIndex("spec_Groupid");
b.ToTable("spec_param");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spu", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int?>("brandid")
.HasColumnType("int");
b.Property<DateTime>("crate_time")
.HasColumnType("datetime(6)")
.HasComment("创建时间");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<DateTime>("last_update_time")
.HasColumnType("datetime(6)")
.HasComment("最后更新时间");
b.Property<int>("saleable")
.HasColumnType("int")
.HasComment("是否上架");
b.Property<int?>("spu_Detailid")
.HasColumnType("int");
b.Property<string>("sub_title")
.HasColumnType("longtext")
.HasComment("子标题");
b.Property<string>("title")
.HasColumnType("longtext")
.HasComment("标题");
b.Property<int>("valid")
.HasColumnType("int")
.HasComment("是否有效");
b.HasKey("id");
b.HasIndex("brandid");
b.HasIndex("spu_Detailid");
b.ToTable("spu");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spu_detail", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("after_service")
.HasColumnType("longtext")
.HasComment("售后服务");
b.Property<string>("description")
.HasColumnType("longtext")
.HasComment("描述");
b.Property<string>("generic_spec")
.HasColumnType("longtext")
.HasComment("通用规格参数数据");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<string>("packing_list")
.HasColumnType("longtext")
.HasComment("包装清单");
b.Property<string>("special_spec")
.HasColumnType("longtext")
.HasComment("特有规格参数及可选值信息json格式");
b.HasKey("id");
b.ToTable("spu_detail");
});
modelBuilder.Entity("Yi.Framework.Model.Models.stock", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<int>("seckill_stock")
.HasColumnType("int")
.HasComment("可秒杀库存");
b.Property<int>("seckill_total")
.HasColumnType("int")
.HasComment("秒杀总数量");
b.Property<int?>("skuid")
.HasColumnType("int");
b.Property<int>("stock_count")
.HasColumnType("int")
.HasComment("库存数量");
b.HasKey("id");
b.HasIndex("skuid");
b.ToTable("stock");
});
modelBuilder.Entity("Yi.Framework.Model.Models.user", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("address")
.HasColumnType("longtext");
b.Property<int?>("age")
.HasColumnType("int");
b.Property<string>("email")
.HasColumnType("longtext");
b.Property<string>("icon")
.HasColumnType("longtext");
b.Property<string>("introduction")
.HasColumnType("longtext");
b.Property<string>("ip")
.HasColumnType("longtext");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<string>("nick")
.HasColumnType("longtext");
b.Property<string>("password")
.HasColumnType("longtext");
b.Property<string>("phone")
.HasColumnType("longtext");
b.Property<string>("username")
.HasColumnType("longtext");
b.HasKey("id");
b.ToTable("user");
});
modelBuilder.Entity("Yi.Framework.Model.Models.visit", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<int>("num")
.HasColumnType("int");
b.Property<DateTime>("time")
.HasColumnType("datetime(6)");
b.HasKey("id");
b.ToTable("visit");
});
modelBuilder.Entity("brandcategory", b =>
{
b.Property<int>("brandsid")
.HasColumnType("int");
b.Property<int>("categoriesid")
.HasColumnType("int");
b.HasKey("brandsid", "categoriesid");
b.HasIndex("categoriesid");
b.ToTable("brandcategory");
});
modelBuilder.Entity("categoryspu", b =>
{
b.Property<int>("categoriesid")
.HasColumnType("int");
b.Property<int>("spusid")
.HasColumnType("int");
b.HasKey("categoriesid", "spusid");
b.HasIndex("spusid");
b.ToTable("categoryspu");
});
modelBuilder.Entity("menurole", b =>
{
b.Property<int>("menusid")
.HasColumnType("int");
b.Property<int>("rolesid")
.HasColumnType("int");
b.HasKey("menusid", "rolesid");
b.HasIndex("rolesid");
b.ToTable("menurole");
});
modelBuilder.Entity("roleuser", b =>
{
b.Property<int>("rolesid")
.HasColumnType("int");
b.Property<int>("usersid")
.HasColumnType("int");
b.HasKey("rolesid", "usersid");
b.HasIndex("usersid");
b.ToTable("roleuser");
});
modelBuilder.Entity("Yi.Framework.Model.Models.category", b =>
{
b.HasOne("Yi.Framework.Model.Models.category", null)
.WithMany("chidrens")
.HasForeignKey("categoryid");
});
modelBuilder.Entity("Yi.Framework.Model.Models.menu", b =>
{
b.HasOne("Yi.Framework.Model.Models.menu", null)
.WithMany("children")
.HasForeignKey("menuid");
b.HasOne("Yi.Framework.Model.Models.mould", "mould")
.WithMany()
.HasForeignKey("mouldid");
b.Navigation("mould");
});
modelBuilder.Entity("Yi.Framework.Model.Models.order", b =>
{
b.HasOne("Yi.Framework.Model.Models.sku", null)
.WithMany("orders")
.HasForeignKey("skuid");
});
modelBuilder.Entity("Yi.Framework.Model.Models.sku", b =>
{
b.HasOne("Yi.Framework.Model.Models.spu", "spu")
.WithMany("skus")
.HasForeignKey("spuid");
b.Navigation("spu");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spec_group", b =>
{
b.HasOne("Yi.Framework.Model.Models.category", "category")
.WithMany("spec_Groups")
.HasForeignKey("categoryid");
b.Navigation("category");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spec_param", b =>
{
b.HasOne("Yi.Framework.Model.Models.category", "category")
.WithMany("spec_Params")
.HasForeignKey("categoryid");
b.HasOne("Yi.Framework.Model.Models.spec_group", "spec_Group")
.WithMany("spec_Params")
.HasForeignKey("spec_Groupid");
b.Navigation("category");
b.Navigation("spec_Group");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spu", b =>
{
b.HasOne("Yi.Framework.Model.Models.brand", "brand")
.WithMany("spus")
.HasForeignKey("brandid");
b.HasOne("Yi.Framework.Model.Models.spu_detail", "spu_Detail")
.WithMany()
.HasForeignKey("spu_Detailid");
b.Navigation("brand");
b.Navigation("spu_Detail");
});
modelBuilder.Entity("Yi.Framework.Model.Models.stock", b =>
{
b.HasOne("Yi.Framework.Model.Models.sku", "sku")
.WithMany()
.HasForeignKey("skuid");
b.Navigation("sku");
});
modelBuilder.Entity("brandcategory", b =>
{
b.HasOne("Yi.Framework.Model.Models.brand", null)
.WithMany()
.HasForeignKey("brandsid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Yi.Framework.Model.Models.category", null)
.WithMany()
.HasForeignKey("categoriesid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("categoryspu", b =>
{
b.HasOne("Yi.Framework.Model.Models.category", null)
.WithMany()
.HasForeignKey("categoriesid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Yi.Framework.Model.Models.spu", null)
.WithMany()
.HasForeignKey("spusid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("menurole", b =>
{
b.HasOne("Yi.Framework.Model.Models.menu", null)
.WithMany()
.HasForeignKey("menusid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Yi.Framework.Model.Models.role", null)
.WithMany()
.HasForeignKey("rolesid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("roleuser", b =>
{
b.HasOne("Yi.Framework.Model.Models.role", null)
.WithMany()
.HasForeignKey("rolesid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Yi.Framework.Model.Models.user", null)
.WithMany()
.HasForeignKey("usersid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Yi.Framework.Model.Models.brand", b =>
{
b.Navigation("spus");
});
modelBuilder.Entity("Yi.Framework.Model.Models.category", b =>
{
b.Navigation("chidrens");
b.Navigation("spec_Groups");
b.Navigation("spec_Params");
});
modelBuilder.Entity("Yi.Framework.Model.Models.menu", b =>
{
b.Navigation("children");
});
modelBuilder.Entity("Yi.Framework.Model.Models.sku", b =>
{
b.Navigation("orders");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spec_group", b =>
{
b.Navigation("spec_Params");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spu", b =>
{
b.Navigation("skus");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,161 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Yi.Framework.Model.Migrations
{
public partial class ec4 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_menu_role_roleid",
table: "menu");
migrationBuilder.DropForeignKey(
name: "FK_role_user_userid",
table: "role");
migrationBuilder.DropIndex(
name: "IX_role_userid",
table: "role");
migrationBuilder.DropIndex(
name: "IX_menu_roleid",
table: "menu");
migrationBuilder.DropColumn(
name: "userid",
table: "role");
migrationBuilder.DropColumn(
name: "roleid",
table: "menu");
migrationBuilder.AlterColumn<string>(
name: "phone",
table: "user",
type: "longtext",
nullable: true,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "menurole",
columns: table => new
{
menusid = table.Column<int>(type: "int", nullable: false),
rolesid = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_menurole", x => new { x.menusid, x.rolesid });
table.ForeignKey(
name: "FK_menurole_menu_menusid",
column: x => x.menusid,
principalTable: "menu",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_menurole_role_rolesid",
column: x => x.rolesid,
principalTable: "role",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "roleuser",
columns: table => new
{
rolesid = table.Column<int>(type: "int", nullable: false),
usersid = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_roleuser", x => new { x.rolesid, x.usersid });
table.ForeignKey(
name: "FK_roleuser_role_rolesid",
column: x => x.rolesid,
principalTable: "role",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_roleuser_user_usersid",
column: x => x.usersid,
principalTable: "user",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_menurole_rolesid",
table: "menurole",
column: "rolesid");
migrationBuilder.CreateIndex(
name: "IX_roleuser_usersid",
table: "roleuser",
column: "usersid");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "menurole");
migrationBuilder.DropTable(
name: "roleuser");
migrationBuilder.AlterColumn<int>(
name: "phone",
table: "user",
type: "int",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<int>(
name: "userid",
table: "role",
type: "int",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "roleid",
table: "menu",
type: "int",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_role_userid",
table: "role",
column: "userid");
migrationBuilder.CreateIndex(
name: "IX_menu_roleid",
table: "menu",
column: "roleid");
migrationBuilder.AddForeignKey(
name: "FK_menu_role_roleid",
table: "menu",
column: "roleid",
principalTable: "role",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_role_user_userid",
table: "role",
column: "userid",
principalTable: "user",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
}
}
}

View File

@@ -17,6 +17,63 @@ namespace Yi.Framework.Model.Migrations
.HasAnnotation("Relational:MaxIdentifierLength", 64)
.HasAnnotation("ProductVersion", "5.0.11");
modelBuilder.Entity("Yi.Framework.Model.Models.brand", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("image")
.HasColumnType("longtext")
.HasComment("品牌图片");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<string>("letter")
.HasColumnType("longtext")
.HasComment("品牌首字母");
b.Property<string>("name")
.HasColumnType("longtext")
.HasComment("品牌名称");
b.HasKey("id");
b.ToTable("brand");
});
modelBuilder.Entity("Yi.Framework.Model.Models.category", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int?>("categoryid")
.HasColumnType("int");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<int>("is_parent")
.HasColumnType("int")
.HasComment("是否父类别");
b.Property<string>("name")
.HasColumnType("longtext")
.HasComment("类别名称");
b.Property<int>("sort")
.HasColumnType("int")
.HasComment("排序");
b.HasKey("id");
b.HasIndex("categoryid");
b.ToTable("category");
});
modelBuilder.Entity("Yi.Framework.Model.Models.menu", b =>
{
b.Property<int>("id")
@@ -79,6 +136,105 @@ namespace Yi.Framework.Model.Migrations
b.ToTable("mould");
});
modelBuilder.Entity("Yi.Framework.Model.Models.order", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("actual_pay")
.HasColumnType("int")
.HasComment("实付金额。单位:分。如:20007表示:200元7分");
b.Property<string>("buyer_message")
.HasColumnType("longtext")
.HasComment("买家留言");
b.Property<string>("buyer_nick")
.HasColumnType("longtext")
.HasComment("买家昵称");
b.Property<int>("buyer_rate")
.HasColumnType("int")
.HasComment("买家是否已经评价,0未评价1已评价");
b.Property<DateTime>("creat_time")
.HasColumnType("datetime(6)")
.HasComment("订单创建时间");
b.Property<int>("invoice_type")
.HasColumnType("int")
.HasComment("发票类型:0无发票1普通发票2电子发票3增值税发票");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<int>("payment_type")
.HasColumnType("int")
.HasComment("支付类型1、在线支付2、货到付款");
b.Property<int>("post_fee")
.HasColumnType("int")
.HasComment("邮费。单位:分。如:20007表示:200元7分");
b.Property<string>("promotion_ids")
.HasColumnType("longtext")
.HasComment("promotion_ids");
b.Property<string>("receiver")
.HasColumnType("longtext")
.HasComment("收货人");
b.Property<string>("receiver_address")
.HasColumnType("longtext")
.HasComment("收获地址(街道、住址等详细地址)");
b.Property<string>("receiver_city")
.HasColumnType("longtext")
.HasComment("收获地址(市)");
b.Property<string>("receiver_district")
.HasColumnType("longtext")
.HasComment("收获地址(区/县)");
b.Property<string>("receiver_mobile")
.HasColumnType("longtext")
.HasComment("收货人手机");
b.Property<string>("receiver_state")
.HasColumnType("longtext")
.HasComment("收获地址(省)");
b.Property<string>("receiver_zip")
.HasColumnType("longtext")
.HasComment("收货人邮编");
b.Property<string>("shipping_code")
.HasColumnType("longtext")
.HasComment("物流单号");
b.Property<string>("shipping_name")
.HasColumnType("longtext")
.HasComment("物流名称");
b.Property<int?>("skuid")
.HasColumnType("int");
b.Property<int>("source_type")
.HasColumnType("int")
.HasComment("订单来源1:app端2pc端3M端4微信端5手机qq端");
b.Property<int>("total_pay")
.HasColumnType("int")
.HasComment("总金额,单位为分");
b.HasKey("id");
b.HasIndex("skuid");
b.ToTable("order");
});
modelBuilder.Entity("Yi.Framework.Model.Models.role", b =>
{
b.Property<int>("id")
@@ -99,6 +255,241 @@ namespace Yi.Framework.Model.Migrations
b.ToTable("role");
});
modelBuilder.Entity("Yi.Framework.Model.Models.sku", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<DateTime>("crate_time")
.HasColumnType("datetime(6)")
.HasComment("创建时间");
b.Property<int>("enable")
.HasColumnType("int")
.HasComment("是否有效0无效1有效");
b.Property<string>("images")
.HasColumnType("longtext")
.HasComment("商品的图片,多个图片以‘,’分割");
b.Property<string>("indexes")
.HasColumnType("longtext")
.HasComment("特有规格属性在spu属性模板中的对应下标组合");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<DateTime>("last_update_time")
.HasColumnType("datetime(6)")
.HasComment("最后更新时间");
b.Property<string>("own_spec")
.HasColumnType("longtext")
.HasComment("sku的特有规格参数键值对json格式反序列化时请使用linkedHashMap保证有序");
b.Property<int>("price")
.HasColumnType("int")
.HasComment("销售价格,单位为分");
b.Property<int?>("spuid")
.HasColumnType("int");
b.Property<string>("title")
.HasColumnType("longtext")
.HasComment("商品标题");
b.HasKey("id");
b.HasIndex("spuid");
b.ToTable("sku");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spec_group", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int?>("categoryid")
.HasColumnType("int");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<string>("name")
.HasColumnType("longtext")
.HasComment("规格组名称");
b.HasKey("id");
b.HasIndex("categoryid");
b.ToTable("spec_group");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spec_param", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int?>("categoryid")
.HasColumnType("int");
b.Property<int>("generic")
.HasColumnType("int")
.HasComment("是否是sku通用属性true或false");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<string>("name")
.HasColumnType("longtext")
.HasComment("参数名");
b.Property<int>("numeric")
.HasColumnType("int")
.HasComment("是否是数字类型参数true或false");
b.Property<int>("searching")
.HasColumnType("int")
.HasComment("是否用于搜索过滤true或false");
b.Property<string>("segments")
.HasColumnType("longtext")
.HasComment("数值类型参数如果需要搜索则添加分段间隔值如CPU频率间隔0.5-1.0");
b.Property<int?>("spec_Groupid")
.HasColumnType("int");
b.Property<string>("unit")
.HasColumnType("longtext")
.HasComment("数字类型参数的单位,非数字类型可以为空");
b.HasKey("id");
b.HasIndex("categoryid");
b.HasIndex("spec_Groupid");
b.ToTable("spec_param");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spu", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int?>("brandid")
.HasColumnType("int");
b.Property<DateTime>("crate_time")
.HasColumnType("datetime(6)")
.HasComment("创建时间");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<DateTime>("last_update_time")
.HasColumnType("datetime(6)")
.HasComment("最后更新时间");
b.Property<int>("saleable")
.HasColumnType("int")
.HasComment("是否上架");
b.Property<int?>("spu_Detailid")
.HasColumnType("int");
b.Property<string>("sub_title")
.HasColumnType("longtext")
.HasComment("子标题");
b.Property<string>("title")
.HasColumnType("longtext")
.HasComment("标题");
b.Property<int>("valid")
.HasColumnType("int")
.HasComment("是否有效");
b.HasKey("id");
b.HasIndex("brandid");
b.HasIndex("spu_Detailid");
b.ToTable("spu");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spu_detail", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("after_service")
.HasColumnType("longtext")
.HasComment("售后服务");
b.Property<string>("description")
.HasColumnType("longtext")
.HasComment("描述");
b.Property<string>("generic_spec")
.HasColumnType("longtext")
.HasComment("通用规格参数数据");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<string>("packing_list")
.HasColumnType("longtext")
.HasComment("包装清单");
b.Property<string>("special_spec")
.HasColumnType("longtext")
.HasComment("特有规格参数及可选值信息json格式");
b.HasKey("id");
b.ToTable("spu_detail");
});
modelBuilder.Entity("Yi.Framework.Model.Models.stock", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("is_delete")
.HasColumnType("int");
b.Property<int>("seckill_stock")
.HasColumnType("int")
.HasComment("可秒杀库存");
b.Property<int>("seckill_total")
.HasColumnType("int")
.HasComment("秒杀总数量");
b.Property<int?>("skuid")
.HasColumnType("int");
b.Property<int>("stock_count")
.HasColumnType("int")
.HasComment("库存数量");
b.HasKey("id");
b.HasIndex("skuid");
b.ToTable("stock");
});
modelBuilder.Entity("Yi.Framework.Model.Models.user", b =>
{
b.Property<int>("id")
@@ -163,6 +554,36 @@ namespace Yi.Framework.Model.Migrations
b.ToTable("visit");
});
modelBuilder.Entity("brandcategory", b =>
{
b.Property<int>("brandsid")
.HasColumnType("int");
b.Property<int>("categoriesid")
.HasColumnType("int");
b.HasKey("brandsid", "categoriesid");
b.HasIndex("categoriesid");
b.ToTable("brandcategory");
});
modelBuilder.Entity("categoryspu", b =>
{
b.Property<int>("categoriesid")
.HasColumnType("int");
b.Property<int>("spusid")
.HasColumnType("int");
b.HasKey("categoriesid", "spusid");
b.HasIndex("spusid");
b.ToTable("categoryspu");
});
modelBuilder.Entity("menurole", b =>
{
b.Property<int>("menusid")
@@ -193,6 +614,13 @@ namespace Yi.Framework.Model.Migrations
b.ToTable("roleuser");
});
modelBuilder.Entity("Yi.Framework.Model.Models.category", b =>
{
b.HasOne("Yi.Framework.Model.Models.category", null)
.WithMany("chidrens")
.HasForeignKey("categoryid");
});
modelBuilder.Entity("Yi.Framework.Model.Models.menu", b =>
{
b.HasOne("Yi.Framework.Model.Models.menu", null)
@@ -206,6 +634,100 @@ namespace Yi.Framework.Model.Migrations
b.Navigation("mould");
});
modelBuilder.Entity("Yi.Framework.Model.Models.order", b =>
{
b.HasOne("Yi.Framework.Model.Models.sku", null)
.WithMany("orders")
.HasForeignKey("skuid");
});
modelBuilder.Entity("Yi.Framework.Model.Models.sku", b =>
{
b.HasOne("Yi.Framework.Model.Models.spu", "spu")
.WithMany("skus")
.HasForeignKey("spuid");
b.Navigation("spu");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spec_group", b =>
{
b.HasOne("Yi.Framework.Model.Models.category", "category")
.WithMany("spec_Groups")
.HasForeignKey("categoryid");
b.Navigation("category");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spec_param", b =>
{
b.HasOne("Yi.Framework.Model.Models.category", "category")
.WithMany("spec_Params")
.HasForeignKey("categoryid");
b.HasOne("Yi.Framework.Model.Models.spec_group", "spec_Group")
.WithMany("spec_Params")
.HasForeignKey("spec_Groupid");
b.Navigation("category");
b.Navigation("spec_Group");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spu", b =>
{
b.HasOne("Yi.Framework.Model.Models.brand", "brand")
.WithMany("spus")
.HasForeignKey("brandid");
b.HasOne("Yi.Framework.Model.Models.spu_detail", "spu_Detail")
.WithMany()
.HasForeignKey("spu_Detailid");
b.Navigation("brand");
b.Navigation("spu_Detail");
});
modelBuilder.Entity("Yi.Framework.Model.Models.stock", b =>
{
b.HasOne("Yi.Framework.Model.Models.sku", "sku")
.WithMany()
.HasForeignKey("skuid");
b.Navigation("sku");
});
modelBuilder.Entity("brandcategory", b =>
{
b.HasOne("Yi.Framework.Model.Models.brand", null)
.WithMany()
.HasForeignKey("brandsid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Yi.Framework.Model.Models.category", null)
.WithMany()
.HasForeignKey("categoriesid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("categoryspu", b =>
{
b.HasOne("Yi.Framework.Model.Models.category", null)
.WithMany()
.HasForeignKey("categoriesid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Yi.Framework.Model.Models.spu", null)
.WithMany()
.HasForeignKey("spusid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("menurole", b =>
{
b.HasOne("Yi.Framework.Model.Models.menu", null)
@@ -236,10 +758,39 @@ namespace Yi.Framework.Model.Migrations
.IsRequired();
});
modelBuilder.Entity("Yi.Framework.Model.Models.brand", b =>
{
b.Navigation("spus");
});
modelBuilder.Entity("Yi.Framework.Model.Models.category", b =>
{
b.Navigation("chidrens");
b.Navigation("spec_Groups");
b.Navigation("spec_Params");
});
modelBuilder.Entity("Yi.Framework.Model.Models.menu", b =>
{
b.Navigation("children");
});
modelBuilder.Entity("Yi.Framework.Model.Models.sku", b =>
{
b.Navigation("orders");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spec_group", b =>
{
b.Navigation("spec_Params");
});
modelBuilder.Entity("Yi.Framework.Model.Models.spu", b =>
{
b.Navigation("skus");
});
#pragma warning restore 612, 618
}
}

View File

@@ -0,0 +1,25 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Model.Models
{
public class brand:baseModel<int>
{
[Comment("品牌名称")]
public string name { get; set; }
[Comment("品牌图片")]
public string image { get; set; }
[Comment("品牌首字母")]
public string letter { get; set; }
[Comment("类别")]
public List<category > categories { get; set; }
[Comment("spu")]
public List<spu> spus { get; set; }
}
}

View File

@@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Model.Models
{
public class category:baseModel<int>
{
[Comment("类别名称")]
public string name { get; set; }
[Comment("排序")]
public int sort { get; set; }
[Comment("是否父类别")]
public int is_parent { get; set; }
[Comment("子类别")]
public List<category> chidrens { get; set; }
[Comment("品牌")]
public List<brand> brands { get; set; }
[Comment("spu")]
public List<spu> spus { get; set; }
[Comment("规格组")]
public List<spec_group> spec_Groups { get; set; }
[Comment("规格")]
public List<spec_param> spec_Params { get; set; }
}
}

View File

@@ -0,0 +1,53 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Model.Models
{
public class order : baseModel<int>
{
[Comment("总金额,单位为分")]
public int total_pay { get; set; }
[Comment("实付金额。单位:分。如:20007表示:200元7分")]
public int actual_pay { get; set; }
[Comment("支付类型1、在线支付2、货到付款")]
public int payment_type { get; set; }
[Comment("邮费。单位:分。如:20007表示:200元7分")]
public int post_fee { get; set; }
[Comment("promotion_ids")]
public string promotion_ids { get; set; }
[Comment("订单创建时间")]
public DateTime creat_time { get; set; }
[Comment("物流名称")]
public string shipping_name { get; set; }
[Comment("物流单号")]
public string shipping_code { get; set; }
[Comment("买家留言")]
public string buyer_message { get; set; }
[Comment("买家昵称")]
public string buyer_nick { get; set; }
[Comment("买家是否已经评价,0未评价1已评价")]
public int buyer_rate { get; set; }
[Comment("收获地址(省)")]
public string receiver_state { get; set; }
[Comment("收获地址(市)")]
public string receiver_city { get; set; }
[Comment("收获地址(区/县)")]
public string receiver_district { get; set; }
[Comment("收获地址(街道、住址等详细地址)")]
public string receiver_address { get; set; }
[Comment("收货人手机")]
public string receiver_mobile { get; set; }
[Comment("收货人邮编")]
public string receiver_zip { get; set; }
[Comment("收货人")]
public string receiver { get; set; }
[Comment("发票类型:0无发票1普通发票2电子发票3增值税发票")]
public int invoice_type { get; set; }
[Comment("订单来源1:app端2pc端3M端4微信端5手机qq端")]
public int source_type { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Model.Models
{
public class sku : baseModel<int>
{
[Comment("商品标题")]
public string title { get; set; }
[Comment("商品的图片,多个图片以‘,’分割")]
public string images { get; set; }
[Comment("销售价格,单位为分")]
public int price { get; set; }
[Comment("特有规格属性在spu属性模板中的对应下标组合")]
public string indexes { get; set; }
[Comment("是否有效0无效1有效")]
public int enable { get; set; }
[Comment("sku的特有规格参数键值对json格式反序列化时请使用linkedHashMap保证有序")]
public string own_spec { get; set; }
[Comment("创建时间")]
public DateTime crate_time { get; set; }
[Comment("最后更新时间")]
public DateTime last_update_time { get; set; }
[Comment("spu")]
public spu spu { get; set; }
[Comment("订单")]
public List<order> orders { get; set; }
}
}

View File

@@ -0,0 +1,19 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Model.Models
{
public class spec_group : baseModel<int>
{
[Comment("规格组名称")]
public string name { get; set; }
[Comment("类别")]
public category category { get; set; }
[Comment("规格")]
public List<spec_param> spec_Params { get; set; }
}
}

View File

@@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Model.Models
{
public class spec_param:baseModel<int>
{
[Comment("参数名")]
public string name { get; set; }
[Comment("是否是数字类型参数true或false")]
public int numeric { get; set; }
[Comment("数字类型参数的单位,非数字类型可以为空")]
public string unit { get; set; }
[Comment("是否是sku通用属性true或false")]
public int generic { get; set; }
[Comment("是否用于搜索过滤true或false")]
public int searching { get; set; }
[Comment("数值类型参数如果需要搜索则添加分段间隔值如CPU频率间隔0.5-1.0")]
public string segments { get; set; }
[Comment("规格组")]
public spec_group spec_Group { get; set; }
[Comment("类别")]
public category category { get; set; }
}
}

View File

@@ -0,0 +1,35 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Model.Models
{
public class spu : baseModel<int>
{
[Comment("标题")]
public string title { get; set; }
[Comment("子标题")]
public string sub_title { get; set; }
[Comment("是否上架")]
public int saleable { get; set; }
[Comment("是否有效")]
public int valid { get; set; }
[Comment("创建时间")]
public DateTime crate_time { get; set; }
[Comment("最后更新时间")]
public DateTime last_update_time { get; set; }
[Comment("类别")]
public List<category> categories { get; set; }
[Comment("品牌")]
public brand brand { get; set; }
[Comment("spu详情")]
public spu_detail spu_Detail { get; set; }
[Comment("skus")]
public List<sku> skus { get; set; }
}
}

View File

@@ -0,0 +1,23 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Model.Models
{
public class spu_detail : baseModel<int>
{
[Comment("描述")]
public string description { get; set; }
[Comment("通用规格参数数据")]
public string generic_spec { get; set; }
[Comment("特有规格参数及可选值信息json格式")]
public string special_spec { get; set; }
[Comment("包装清单")]
public string packing_list { get; set; }
[Comment("售后服务")]
public string after_service { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Model.Models
{
public class stock:baseModel<int>
{
[Comment("可秒杀库存")]
public int seckill_stock { get; set; }
[Comment("秒杀总数量")]
public int seckill_total { get; set; }
[Comment("库存数量")]
public int stock_count { get; set; }
[Comment("sku")]
public sku sku { get; set; }
}
}

View File

@@ -0,0 +1,31 @@
using Nest;
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.Search
{
[ElasticsearchType(IdProperty = "id")]//主键声明,且主键必须是属性
public class Goods
{
public long id { get; set; }
public spu spu { get; set; }
public string all; //所有需要被搜索的信息,包括品牌,分类,标题
public string subtitle; //子标题
public brand brand;
public category cid1;
public category cid2;
public category cid3;
public DateTime? createTime;
public HashSet<double> price = new HashSet<double>(); //是所有sku的价格集合。方便根据价格进行筛选过滤
public List<sku> skus; //sku信息的json结构数据
public Dictionary<string, object> specs = new Dictionary<string, object>(); //可搜索的规格参数key是参数名值是参数值
}
}

View File

@@ -0,0 +1,31 @@
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.Search
{
public class SearchResult<Goods> : PageResult<Goods>
{
public List<brand> brands = new List<brand>();
public List<category> categories = new List<category>();
//规格参数过滤条件
public List<Dictionary<string, object>> specs = new List<Dictionary<string, object>>();
public SearchResult(long total,
int totalPage,
List<Goods> items,
List<category> categories,
List<brand> brands,
List<Dictionary<string, object>> specs) : base
(total, items)
{
this.categories = categories;
this.brands = brands;
this.specs = specs;
}
}
}

View File

@@ -8,9 +8,18 @@ namespace Yi.Framework.Model
{
public partial class DataContext :DbContext
{
public DbSet<brand> brand { get; set; }
public DbSet<category> category { get; set; }
public DbSet<menu> menu { get; set; }
public DbSet<mould> mould { get; set; }
public DbSet<order> order { get; set; }
public DbSet<role> role { get; set; }
public DbSet<sku> sku { get; set; }
public DbSet<spec_group> spec_group { get; set; }
public DbSet<spec_param> spec_param { get; set; }
public DbSet<spu> spu { get; set; }
public DbSet<spu_detail> spu_detail { get; set; }
public DbSet<stock> stock { get; set; }
public DbSet<user> user { get; set; }
public DbSet<visit> visit { get; set; }
}

View File

@@ -0,0 +1,59 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<None Include="T4DataContext.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>T4DataContext.tt</DependentUpon>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.11">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NEST" Version="7.15.2" />
<PackageReference Include="Oracle.EntityFrameworkCore" Version="5.21.3" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="5.0.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Yi.Framework.Common\Yi.Framework.Common.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="T4DaraContext.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>T4DaraContext.cs</LastGenOutput>
</None>
<None Update="T4DataContext.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>T4DataContext.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
</ItemGroup>
<ItemGroup>
<Compile Update="T4DaraContext.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>T4DaraContext.tt</DependentUpon>
</Compile>
<Compile Update="T4DataContext.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>T4DataContext.tt</DependentUpon>
</Compile>
</ItemGroup>
</Project>

View File

@@ -19,6 +19,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NEST" Version="7.15.2" />
<PackageReference Include="Oracle.EntityFrameworkCore" Version="5.21.3" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="5.0.2" />
</ItemGroup>

View File

@@ -10,16 +10,6 @@
<NoWarn>1701;1702;CS1591</NoWarn>
</PropertyGroup>
<ItemGroup>
<Content Remove="appsettings.Development.json" />
<Content Remove="appsettings.json" />
</ItemGroup>
<ItemGroup>
<None Include="appsettings.Development.json" />
<None Include="appsettings.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.2" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />

View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Model.Search;
namespace Yi.Framework.Service
{
public class GoodsService : IGoodsService
{
public PageResult<spu> QuerySpuByPage(int page, int rows, string key, bool? saleable)
{
throw new NotImplementedException();
}
}
}

View File

@@ -41,6 +41,7 @@ namespace Yi.Framework.Service
return TreeMenuBuild.Sort(TreeMenuBuild.Normal(menu_data));
}
public async Task<List<menu>> GetTopMenusByTopMenuIds(List<int> menuIds)
{
return await _DbRead.Set<menu>().AsNoTracking().Where(u => menuIds.Contains(u.id)).OrderBy(u=>u.sort).ToListAsync();

View File

@@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Core;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Model.Search;
namespace Yi.Framework.Service
{
public class SearchService : ISearchService
{
private IGoodsService _goodsService;
private ElasticSearchInvoker _elasticSearchInvoker ;
public SearchService(IGoodsService goodsService, ElasticSearchInvoker elasticSearchInvoker)
{
_goodsService = goodsService;
_elasticSearchInvoker = elasticSearchInvoker;
}
public void ImpDataBySpu()
{
ImportToEs();
}
private void ImportToEs()
{
int page = 1;
int size;
int rows = 100;
do
{
List<Goods> goodsList = new List<Goods>();
// 上架商品
PageResult<spu> result = _goodsService.QuerySpuByPage(page, rows, null, true);
List<spu> spus = result.rows;
size = spus.Count;
foreach (var spu in spus)
{
try
{
Goods g = BuildGoods(spu);
// 处理好的数据添加到集合中
goodsList.Add(g);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
continue;//部分数据不严格
}
}
// 存入es,先留着,不写
_elasticSearchInvoker.Send(goodsList);
page++;
} while (size == 100);
}
private Goods BuildGoods(spu spu)
{
Goods goods = new Goods();
return goods;
}
}
}

View File

@@ -11,6 +11,42 @@ using Yi.Framework.Model.ModelFactory;
namespace Yi.Framework.Service
{
public partial class BrandService:BaseService<brand>,IBrandService
{
public BrandService(IDbContextFactory DbFactory):base(DbFactory){ }
public async Task<bool> DelListByUpdateAsync(List<int> _ids)
{
var brandList = await GetEntitiesAsync(u=>_ids.Contains(u.id));
brandList.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Deleted);
return await UpdateListAsync(brandList);
}
public async Task<IEnumerable<brand>> GetAllEntitiesTrueAsync()
{
return await GetEntitiesAsync(u=> u.is_delete == (short)Common.Enum.DelFlagEnum.Normal);
}
}
public partial class CategoryService:BaseService<category>,ICategoryService
{
public CategoryService(IDbContextFactory DbFactory):base(DbFactory){ }
public async Task<bool> DelListByUpdateAsync(List<int> _ids)
{
var categoryList = await GetEntitiesAsync(u=>_ids.Contains(u.id));
categoryList.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Deleted);
return await UpdateListAsync(categoryList);
}
public async Task<IEnumerable<category>> GetAllEntitiesTrueAsync()
{
return await GetEntitiesAsync(u=> u.is_delete == (short)Common.Enum.DelFlagEnum.Normal);
}
}
public partial class MenuService:BaseService<menu>,IMenuService
{
public MenuService(IDbContextFactory DbFactory):base(DbFactory){ }
@@ -47,6 +83,24 @@ namespace Yi.Framework.Service
}
public partial class OrderService:BaseService<order>,IOrderService
{
public OrderService(IDbContextFactory DbFactory):base(DbFactory){ }
public async Task<bool> DelListByUpdateAsync(List<int> _ids)
{
var orderList = await GetEntitiesAsync(u=>_ids.Contains(u.id));
orderList.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Deleted);
return await UpdateListAsync(orderList);
}
public async Task<IEnumerable<order>> GetAllEntitiesTrueAsync()
{
return await GetEntitiesAsync(u=> u.is_delete == (short)Common.Enum.DelFlagEnum.Normal);
}
}
public partial class RoleService:BaseService<role>,IRoleService
{
public RoleService(IDbContextFactory DbFactory):base(DbFactory){ }
@@ -65,6 +119,114 @@ namespace Yi.Framework.Service
}
public partial class SkuService:BaseService<sku>,ISkuService
{
public SkuService(IDbContextFactory DbFactory):base(DbFactory){ }
public async Task<bool> DelListByUpdateAsync(List<int> _ids)
{
var skuList = await GetEntitiesAsync(u=>_ids.Contains(u.id));
skuList.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Deleted);
return await UpdateListAsync(skuList);
}
public async Task<IEnumerable<sku>> GetAllEntitiesTrueAsync()
{
return await GetEntitiesAsync(u=> u.is_delete == (short)Common.Enum.DelFlagEnum.Normal);
}
}
public partial class Spec_groupService:BaseService<spec_group>,ISpec_groupService
{
public Spec_groupService(IDbContextFactory DbFactory):base(DbFactory){ }
public async Task<bool> DelListByUpdateAsync(List<int> _ids)
{
var spec_groupList = await GetEntitiesAsync(u=>_ids.Contains(u.id));
spec_groupList.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Deleted);
return await UpdateListAsync(spec_groupList);
}
public async Task<IEnumerable<spec_group>> GetAllEntitiesTrueAsync()
{
return await GetEntitiesAsync(u=> u.is_delete == (short)Common.Enum.DelFlagEnum.Normal);
}
}
public partial class Spec_paramService:BaseService<spec_param>,ISpec_paramService
{
public Spec_paramService(IDbContextFactory DbFactory):base(DbFactory){ }
public async Task<bool> DelListByUpdateAsync(List<int> _ids)
{
var spec_paramList = await GetEntitiesAsync(u=>_ids.Contains(u.id));
spec_paramList.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Deleted);
return await UpdateListAsync(spec_paramList);
}
public async Task<IEnumerable<spec_param>> GetAllEntitiesTrueAsync()
{
return await GetEntitiesAsync(u=> u.is_delete == (short)Common.Enum.DelFlagEnum.Normal);
}
}
public partial class SpuService:BaseService<spu>,ISpuService
{
public SpuService(IDbContextFactory DbFactory):base(DbFactory){ }
public async Task<bool> DelListByUpdateAsync(List<int> _ids)
{
var spuList = await GetEntitiesAsync(u=>_ids.Contains(u.id));
spuList.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Deleted);
return await UpdateListAsync(spuList);
}
public async Task<IEnumerable<spu>> GetAllEntitiesTrueAsync()
{
return await GetEntitiesAsync(u=> u.is_delete == (short)Common.Enum.DelFlagEnum.Normal);
}
}
public partial class Spu_detailService:BaseService<spu_detail>,ISpu_detailService
{
public Spu_detailService(IDbContextFactory DbFactory):base(DbFactory){ }
public async Task<bool> DelListByUpdateAsync(List<int> _ids)
{
var spu_detailList = await GetEntitiesAsync(u=>_ids.Contains(u.id));
spu_detailList.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Deleted);
return await UpdateListAsync(spu_detailList);
}
public async Task<IEnumerable<spu_detail>> GetAllEntitiesTrueAsync()
{
return await GetEntitiesAsync(u=> u.is_delete == (short)Common.Enum.DelFlagEnum.Normal);
}
}
public partial class StockService:BaseService<stock>,IStockService
{
public StockService(IDbContextFactory DbFactory):base(DbFactory){ }
public async Task<bool> DelListByUpdateAsync(List<int> _ids)
{
var stockList = await GetEntitiesAsync(u=>_ids.Contains(u.id));
stockList.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Deleted);
return await UpdateListAsync(stockList);
}
public async Task<IEnumerable<stock>> GetAllEntitiesTrueAsync()
{
return await GetEntitiesAsync(u=> u.is_delete == (short)Common.Enum.DelFlagEnum.Normal);
}
}
public partial class UserService:BaseService<user>,IUserService
{
public UserService(IDbContextFactory DbFactory):base(DbFactory){ }