diff --git a/WebFirst/database/sqlite.db b/WebFirst/database/sqlite.db index 07b8ee12..df70988a 100644 Binary files a/WebFirst/database/sqlite.db and b/WebFirst/database/sqlite.db differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml index 92d0af2b..34d4d413 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml @@ -4,62 +4,6 @@ Yi.Framework.ApiMicroservice - - - 账户管理 - - - - - 重置管理员CC的密码 - - - - - - 没啥说,登录 - - - - - - - 没啥说,注册 - - - - - - - 没啥说,登出 - - - - - - 通过已登录的用户获取用户信息 - - - - - - 获取当前登录用户的前端路由 - - - - - - 自己更新密码 - - - - - - - 验证码 - - - 动态条件分页查询 @@ -206,6 +150,74 @@ + + + 动态条件分页查询 + + + + + + 动态条件分页查询 + + + + + + 账户管理 + + + + + 重置管理员CC的密码 + + + + + + 没啥说,登录 + + + + + + + 没啥说,注册 + + + + + + + 没啥说,登出 + + + + + + 通过已登录的用户获取用户信息 + + + + + + 获取当前登录用户的前端路由 + + + + + + 自己更新密码 + + + + + + + 验证码 + + + 动态条件分页查询 @@ -441,6 +453,70 @@ + + + 用户管理 + + + + + 动态条件分页查询 + + + + + + + + + 更改用户状态 + + + + + + + + 给多用户设置多角色 + + + + + + + 通过用户id得到用户信息关联部门、岗位、角色 + + + + + + + 更新用户信息 + + + + + + + 更新个人中心信息 + + + + + + + 添加用户 + + + + + + + 重置密码 + + + + 测试控制器 @@ -562,69 +638,5 @@ - - - 用户管理 - - - - - 动态条件分页查询 - - - - - - - - - 更改用户状态 - - - - - - - - 给多用户设置多角色 - - - - - - - 通过用户id得到用户信息关联部门、岗位、角色 - - - - - - - 更新用户信息 - - - - - - - 更新个人中心信息 - - - - - - - 添加用户 - - - - - - - 重置密码 - - - - diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ArticleController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Article/ArticleController.cs similarity index 95% rename from Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ArticleController.cs rename to Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Article/ArticleController.cs index 50f7ff67..36ee1e7a 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ArticleController.cs +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Article/ArticleController.cs @@ -51,7 +51,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers { //如果标题为空,默认为内容的前20个字符 entity.Title = string.IsNullOrEmpty(entity.Title) ? - (entity.Content.Length > 20 ? entity.Content.Substring(0, 20) : entity.Content) : + (entity.Content?.Length > 20 ? entity.Content.Substring(0, 20) : entity.Content) : entity.Title; entity.UserId = HttpContext.GetUserIdInfo(); return base.Add(entity); diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/CategoryController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/CategoryController.cs new file mode 100644 index 00000000..cc47f38f --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/CategoryController.cs @@ -0,0 +1,28 @@ +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Yi.Framework.Common.Models; +using Yi.Framework.Interface; +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; +using Yi.Framework.WebCore; +using Yi.Framework.WebCore.AttributeExtend; +using Yi.Framework.WebCore.AuthorizationPolicy; + +namespace Yi.Framework.ApiMicroservice.Controllers +{ + [ApiController] + [Route("api/[controller]/[action]")] + public class CategoryController : BaseCrudController + { + private ICategoryService _iCategoryService; + public CategoryController(ILogger logger, ICategoryService iCategoryService) : base(logger, iCategoryService) + { + _iCategoryService = iCategoryService; + } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/SkuController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/SkuController.cs new file mode 100644 index 00000000..600874f6 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/SkuController.cs @@ -0,0 +1,114 @@ +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Yi.Framework.Common.Enum; +using Yi.Framework.Common.Models; +using Yi.Framework.Interface; +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; +using Yi.Framework.WebCore; +using Yi.Framework.WebCore.AttributeExtend; +using Yi.Framework.WebCore.AuthorizationPolicy; + +namespace Yi.Framework.ApiMicroservice.Controllers +{ + [ApiController] + [Route("api/[controller]/[action]")] + public class SkuController : BaseSimpleCrudController + { + private ISkuService _iSkuService; + public SkuController(ILogger logger, ISkuService iSkuService) : base(logger, iSkuService) + { + _iSkuService = iSkuService; + } + + /// + /// 动态条件分页查询 + /// + /// + [HttpGet] + public async Task PageList([FromQuery] SkuEntity eneity, [FromQuery] PageParModel page) + { + return Result.Success().SetData(await _iSkuService.SelctPageList(eneity, page)); + } + + + + + //数据测试 + [HttpGet] + public async Task Test(OperEnum operEnum) + { + switch (operEnum) + { + case OperEnum.Insert: + List spus = new(); + var sku1 = new SkuEntity() + { + Id = 1, + Stock = 100, + IsDeleted = false, + SpuId = 1, + Price = 1000, + SpecsSkuAllInfo = new List { + new SpecsSkuAllInfoModel { SpecsGroupName="内存",SpecsName="1GB" } , + new SpecsSkuAllInfoModel { SpecsGroupName="颜色",SpecsName= "红" } }, + }; + var sku2 = new SkuEntity() + { + Id = 2, + Stock = 100, + IsDeleted = false, + SpuId = 1, + Price = 4000, + SpecsSkuAllInfo = new List { + new SpecsSkuAllInfoModel { SpecsGroupName="内存",SpecsName="2GB" } , + new SpecsSkuAllInfoModel { SpecsGroupName="颜色",SpecsName= "绿" } }, + }; + + + var sku3 = new SkuEntity() + { + Id = 3, + Stock = 100, + IsDeleted = false, + SpuId = 2, + Price = 2000, + SpecsSkuAllInfo = new List { + new SpecsSkuAllInfoModel { SpecsGroupName="内存",SpecsName="3GB" } , + new SpecsSkuAllInfoModel { SpecsGroupName="颜色",SpecsName= "红" } }, + }; + var sku4 = new SkuEntity() + { + Id = 4, + Stock = 100, + IsDeleted = false, + SpuId = 2, + Price = 1000, + SpecsSkuAllInfo = new List { + new SpecsSkuAllInfoModel { SpecsGroupName="内存",SpecsName="2GB" } , + new SpecsSkuAllInfoModel { SpecsGroupName="颜色",SpecsName= "蓝" } }, + }; + spus.Add(sku1); + spus.Add(sku2); + spus.Add(sku3); + spus.Add(sku4); + await _iSkuService._repository.InsertRangeAsync(spus); + break; + + case OperEnum.Delete: + await _iSkuService._repository.DeleteAsync((u)=>true); + break; + default: + break; + } + + + return Result.Success(); + } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/SpecsController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/SpecsController.cs new file mode 100644 index 00000000..c31c4c91 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/SpecsController.cs @@ -0,0 +1,28 @@ +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Yi.Framework.Common.Models; +using Yi.Framework.Interface; +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; +using Yi.Framework.WebCore; +using Yi.Framework.WebCore.AttributeExtend; +using Yi.Framework.WebCore.AuthorizationPolicy; + +namespace Yi.Framework.ApiMicroservice.Controllers +{ + [ApiController] + [Route("api/[controller]/[action]")] + public class SpecsController : BaseCrudController + { + private ISpecsService _iSpecsService; + public SpecsController(ILogger logger, ISpecsService iSpecsService) : base(logger, iSpecsService) + { + _iSpecsService = iSpecsService; + } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/SpecsGroupController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/SpecsGroupController.cs new file mode 100644 index 00000000..8e65d62e --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/SpecsGroupController.cs @@ -0,0 +1,28 @@ +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Yi.Framework.Common.Models; +using Yi.Framework.Interface; +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; +using Yi.Framework.WebCore; +using Yi.Framework.WebCore.AttributeExtend; +using Yi.Framework.WebCore.AuthorizationPolicy; + +namespace Yi.Framework.ApiMicroservice.Controllers +{ + [ApiController] + [Route("api/[controller]/[action]")] + public class SpecsGroupController : BaseCrudController + { + private ISpecsGroupService _iSpecsGroupService; + public SpecsGroupController(ILogger logger, ISpecsGroupService iSpecsGroupService) : base(logger, iSpecsGroupService) + { + _iSpecsGroupService = iSpecsGroupService; + } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/SpuController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/SpuController.cs new file mode 100644 index 00000000..bd4e9dc7 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/Shop/SpuController.cs @@ -0,0 +1,88 @@ +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Yi.Framework.Common.Enum; +using Yi.Framework.Common.Models; +using Yi.Framework.Interface; +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; +using Yi.Framework.WebCore; +using Yi.Framework.WebCore.AttributeExtend; +using Yi.Framework.WebCore.AuthorizationPolicy; + +namespace Yi.Framework.ApiMicroservice.Controllers +{ + [ApiController] + [Route("api/[controller]/[action]")] + public class SpuController : BaseSimpleCrudController + { + private ISpuService _iSpuService; + public SpuController(ILogger logger, ISpuService iSpuService) : base(logger, iSpuService) + { + _iSpuService = iSpuService; + } + + /// + /// 动态条件分页查询 + /// + /// + [HttpGet] + public async Task PageList([FromQuery] SpuEntity eneity, [FromQuery] PageParModel page) + { + return Result.Success().SetData(await _iSpuService.SelctPageList(eneity, page)); + } + + + + + //数据测试 + [HttpGet] + public async Task Test(OperEnum operEnum) + { + switch (operEnum) + { + case OperEnum.Insert: + List spus = new(); + var spu1 = new SpuEntity() + { + Id = 1, + SpuName = "华为mate40 5G手机", + IsDeleted = false, + Details = "华为手机就是牛", + Price = "1000-2000", + SpecsSpuAllInfo = new List { + new SpecsSpuAllInfoModel { SpecsGroupName="内存",SpecsNames=new List { "1GB","2GB","3GB"} } , + new SpecsSpuAllInfoModel { SpecsGroupName="颜色",SpecsNames=new List { "红","蓝","绿"} } }, + }; + var spu2 = new SpuEntity() + { + Id = 2, + SpuName = "小米888 8G手机", + IsDeleted = false, + Details = "小米手机就是牛", + Price = "2000-3000", + SpecsSpuAllInfo = new List { + new SpecsSpuAllInfoModel { SpecsGroupName="内存",SpecsNames=new List { "1GB","2GB","3GB"} } , + new SpecsSpuAllInfoModel { SpecsGroupName="颜色",SpecsNames=new List { "红","蓝","绿"} } }, + }; + spus.Add(spu1); + spus.Add(spu2); + await _iSpuService._repository.InsertRangeAsync(spus); + break; + + case OperEnum.Delete: + await _iSpuService._repository.DeleteAsync((u) => true); + break; + default: + break; + } + + + return Result.Success(); + } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/System/AccountController.cs similarity index 100% rename from Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs rename to Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/System/AccountController.cs diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ConfigController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/System/ConfigController.cs similarity index 100% rename from Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ConfigController.cs rename to Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/System/ConfigController.cs diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/DeptController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/System/DeptController.cs similarity index 100% rename from Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/DeptController.cs rename to Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/System/DeptController.cs diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/DictionaryController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/System/DictionaryController.cs similarity index 100% rename from Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/DictionaryController.cs rename to Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/System/DictionaryController.cs diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/DictionaryInfoController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/System/DictionaryInfoController.cs similarity index 100% rename from Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/DictionaryInfoController.cs rename to Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/System/DictionaryInfoController.cs diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/FileController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/System/FileController.cs similarity index 100% rename from Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/FileController.cs rename to Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/System/FileController.cs diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/LogController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/System/LogController.cs similarity index 100% rename from Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/LogController.cs rename to Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/System/LogController.cs diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/LoginLogController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/System/LoginLogController.cs similarity index 100% rename from Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/LoginLogController.cs rename to Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/System/LoginLogController.cs diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/System/MenuController.cs similarity index 100% rename from Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs rename to Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/System/MenuController.cs diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/OnlineController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/System/OnlineController.cs similarity index 100% rename from Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/OnlineController.cs rename to Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/System/OnlineController.cs diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/OperationLogController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/System/OperationLogController.cs similarity index 100% rename from Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/OperationLogController.cs rename to Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/System/OperationLogController.cs diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/PostController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/System/PostController.cs similarity index 100% rename from Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/PostController.cs rename to Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/System/PostController.cs diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/System/RoleController.cs similarity index 100% rename from Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs rename to Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/System/RoleController.cs diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/UserController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/System/UserController.cs similarity index 100% rename from Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/UserController.cs rename to Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/System/UserController.cs diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs index 8e0c2f73..a2e327d7 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs @@ -272,7 +272,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers public Result SeedDb() { var rep = _iUserService._repository; - return Result.Success().SetStatus(DbSeedExtend.Invoer(rep._Db)); + return Result.Success().SetStatus(DbSeedExtend.DataInvoer(rep._Db)); } /// diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Program.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Program.cs index 392211b4..45a105fc 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Program.cs +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Program.cs @@ -139,9 +139,14 @@ builder.Services.AddHeiCaptcha(); #endregion builder.Services.AddHttpContextAccessor(); #region -//ͼ +//ͼSystem.DrawinglinuҪ֧ #endregion builder.Services.AddSingleton(); + +#region +//ȫóʼֵ +#endregion +GobalModel.SqlLogEnable = Appsettings.appBool("SqlLog_Enable"); //----------------------------------------------------------------------------------------------------------- var app = builder.Build(); #region @@ -154,9 +159,6 @@ ServiceLocator.Instance = app.Services; //ҳע #endregion app.UseDeveloperExceptionPage(); - #region - //Swaggerע - #endregion app.UseSwaggerService(); } #region diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Properties/launchSettings.json b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Properties/launchSettings.json index d49e5e26..29745205 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Properties/launchSettings.json +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Properties/launchSettings.json @@ -2,8 +2,8 @@ "profiles": { "Yi.Framework.ApiMicroservice": { "commandName": "Project", - //ǷԶ˸оعرȽ鷳 - "launchBrowser": false, + //ǷԶ + "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Yi.Framework.ApiMicroservice.csproj b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Yi.Framework.ApiMicroservice.csproj index 677bea43..922abba3 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Yi.Framework.ApiMicroservice.csproj +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Yi.Framework.ApiMicroservice.csproj @@ -43,9 +43,6 @@ Always - - Always - diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/appsettings.Production.json b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/appsettings.Production.json index 37d54a8b..07cf237d 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/appsettings.Production.json +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/appsettings.Production.json @@ -1,5 +1,5 @@ { - "StartUrl": "http://localohost:19001", + "StartUrl": "http://*:19001", "Logging": { "LogLevel": { "Default": "Information", @@ -9,11 +9,16 @@ }, "AllowedHosts": "*", + "SqlLog_Enable": false, + "Consul_Enabled": false, + "DbCodeFirst_Enabled": false, + "DbSeed_Enabled": false, "Apollo_Enabled": false, "HealthCheck_Enabled": false, "RabbitMQ_Enabled": false, "Redis_Enabled": false, + "RedisSeed_Enabled": false, "Kafka_Enabled": false, "ElasticSeach_Enabled": false, "MutiDB_Enabled": false, @@ -21,19 +26,16 @@ "CAP_Enabled": false, "CAPDashboard_Enabled": false, - "DbSeed_Enabled": true, - "RedisSeed_Enabled": false, - "Cors_Enabled": true, "DbList": [ "Sqlite", "Mysql", "Sqlserver", "Oracle" ], "DbSelect": "Sqlite", "DbConn": { "WriteUrl": "DataSource=yi-sqlsugar-dev.db", - //"WriteUrl": "server=119.91.207.67;port=3306;database=yi-sqlsugar-dev;user id=root;password=Qz52013142020.", + //"WriteUrl": "[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]", "ReadUrl": [ - "server=119.91.207.67;port=3306;database=yi-sqlsugar-dev;user id=root;password=Qz52013142020.", - "server=119.91.207.67;port=3306;database=yi-sqlsugar-dev;user id=root;password=Qz52013142020.", - "server=119.91.207.67;port=3306;database=yi-sqlsugar-dev;user id=root;password=Qz52013142020." + "server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]", + "server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]", + "server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]" ] }, "JwtAuthorize": { @@ -42,39 +44,39 @@ "PolicyName": "permission", "DefaultScheme": "Bearer", "IsHttps": false, - "Expiration": 30, + "Expiration": 300, "ReExpiration": 3000 }, "RedisConnOptions": { - "Host": "118.195.191.41", + "Host": "[xxxx]", "Prot": 6379, "DB": 1, - "Password": "Qz52013142020." + "Password": "[xxxx]" }, "RabbitConn": { - "HostName": "118.195.191.41", - "UserName": "cc", - "Password": "cc", + "HostName": "[xxxx]", + "UserName": "[xxxx]", + "Password": "[xxxx]", "Port": 5672 }, "ElasticSeachConn": { - "Url": "https://es-4zakkyyn.public.tencentelasticsearch.com:9200", - "IndexName": "yies", - "UserName": "elastic", - "PassWord": "Qz52013142020." + "Url": "[xxxx]", + "IndexName": "[xxxx]", + "UserName": "[xxxx]", + "PassWord": "[xxxx]" }, "KafkaOptions": { - "BrokerList": "192.168.3.230:9092", - "TopicName": "kafkalog" + "BrokerList": "[xxxx]", + "TopicName": "[xxxx]" }, "ConsulClientOption": { - "IP": "118.195.191.41", - "Port": "8500", - "Datacenter": "dc1" + "IP": "[xxxx]", + "Port": "[xxxx]", + "Datacenter": "[xxxx]" }, "ConsulRegisterOption": { - "IP": "118.195.191.41", - "Port": "19005", + "IP": "[xxxx]", + "Port": "19001", "GroupName": "ApiMicroservice", "HealthCheckUrl": "/Health", "Interval": 10, @@ -83,10 +85,10 @@ "Tag": "13" }, "SMS": { - "ID": "LTAI5tJvjPaXCyyPMfXLNbVA", - "Secret": "fLQv7jjj57fUKLFK8REeAQPFVDjUYn", - "Sign": "JiftCC", - "Template": "SMS_221640732" + "ID": "[xxxx]", + "Secret": "[xxxx]", + "Sign": "[xxxx]", + "Template": "[xxxx]" }, "IPLibraryServiceUrl": "http://gRPCIPLibraryService" } \ No newline at end of file diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/appsettings.Staging.json b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/appsettings.Staging.json index c7ae2d34..07cf237d 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/appsettings.Staging.json +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/appsettings.Staging.json @@ -9,7 +9,10 @@ }, "AllowedHosts": "*", + "SqlLog_Enable": false, + "Consul_Enabled": false, + "DbCodeFirst_Enabled": false, "DbSeed_Enabled": false, "Apollo_Enabled": false, "HealthCheck_Enabled": false, @@ -25,23 +28,24 @@ "Cors_Enabled": true, "DbList": [ "Sqlite", "Mysql", "Sqlserver", "Oracle" ], - "DbSelect": "Mysql", - "Pan": { - "ZipPath": "D:/AppWeb/test/zip" - }, - + "DbSelect": "Sqlite", "DbConn": { - "WriteUrl": "server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]", + "WriteUrl": "DataSource=yi-sqlsugar-dev.db", + //"WriteUrl": "[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]", "ReadUrl": [ "server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]", "server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]", "server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]" ] }, - "JWTTokenOptions": { - "Audience": "http://localhost:7000", - "Issuer": "http://localhost:7000", - "SecurityKey": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDI2a2EJ7m872v0afyoSDJT2o1+SitIeJSWtLJU8/Wz2m7gStexajkeD+Lka6DSTy8gt9UwfgVQo6uKjVLG5Ex7PiGOODVqAEghBuS7JzIYU5RvI543nNDAPfnJsas96mSA7L/mD7RTE2drj6hf3oZjJpMPZUQI/B1Qjb5H3K3PNwIDAQAB" + "JwtAuthorize": { + "Issuer": "cc", + "Audience": "cc", + "PolicyName": "permission", + "DefaultScheme": "Bearer", + "IsHttps": false, + "Expiration": 300, + "ReExpiration": 3000 }, "RedisConnOptions": { "Host": "[xxxx]", diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/appsettings.json b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/appsettings.json index 94d17102..0278d8e5 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/appsettings.json +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/appsettings.json @@ -9,8 +9,11 @@ }, "AllowedHosts": "*", + "SqlLog_Enable": false, + "Consul_Enabled": false, - "DbSeed_Enabled": false, + "DbCodeFirst_Enabled": true, + "DbSeed_Enabled": true, "Apollo_Enabled": false, "HealthCheck_Enabled": false, "RabbitMQ_Enabled": false, diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db index 2b7e921a..a80e2499 100644 Binary files a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db differ diff --git a/Yi.Framework.Net6/Yi.Framework.Common/Models/GobalModel.cs b/Yi.Framework.Net6/Yi.Framework.Common/Models/GobalModel.cs new file mode 100644 index 00000000..1a86dd15 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Common/Models/GobalModel.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.Framework.Common.Models +{ + public static class GobalModel + { + public static bool SqlLogEnable { get; set; } = true; + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Common/QueueModel/OrderCreateQueueModel.cs b/Yi.Framework.Net6/Yi.Framework.Common/QueueModel/OrderCreateQueueModel.cs index fd20b344..0f715418 100644 --- a/Yi.Framework.Net6/Yi.Framework.Common/QueueModel/OrderCreateQueueModel.cs +++ b/Yi.Framework.Net6/Yi.Framework.Common/QueueModel/OrderCreateQueueModel.cs @@ -28,7 +28,7 @@ namespace Yi.Framework.Common.QueueModel /// 尝试次数 /// public int TryTime { get; set; } - + public OrderTypeEnum OrderType { get; set; } public enum OrderTypeEnum diff --git a/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/ICategoryService.cs b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/ICategoryService.cs new file mode 100644 index 00000000..88833ca8 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/ICategoryService.cs @@ -0,0 +1,9 @@ +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; + +namespace Yi.Framework.Interface +{ + public partial interface ICategoryService:IBaseService + { + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/ISkuService.cs b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/ISkuService.cs new file mode 100644 index 00000000..5adf4d8f --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/ISkuService.cs @@ -0,0 +1,9 @@ +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; + +namespace Yi.Framework.Interface +{ + public partial interface ISkuService:IBaseService + { + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/ISpecsGroupService.cs b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/ISpecsGroupService.cs new file mode 100644 index 00000000..f7bb04e6 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/ISpecsGroupService.cs @@ -0,0 +1,9 @@ +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; + +namespace Yi.Framework.Interface +{ + public partial interface ISpecsGroupService:IBaseService + { + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/ISpecsService.cs b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/ISpecsService.cs new file mode 100644 index 00000000..174689d2 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/ISpecsService.cs @@ -0,0 +1,9 @@ +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; + +namespace Yi.Framework.Interface +{ + public partial interface ISpecsService:IBaseService + { + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/ISpuService.cs b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/ISpuService.cs new file mode 100644 index 00000000..774a4cab --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/ISpuService.cs @@ -0,0 +1,9 @@ +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; + +namespace Yi.Framework.Interface +{ + public partial interface ISpuService:IBaseService + { + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Interface/ISkuService.cs b/Yi.Framework.Net6/Yi.Framework.Interface/ISkuService.cs new file mode 100644 index 00000000..f1766465 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Interface/ISkuService.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Yi.Framework.Common.Models; +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; + +namespace Yi.Framework.Interface +{ + public partial interface ISkuService:IBaseService + { + /// + /// 动态条件分页查询 + /// + /// + /// + /// + Task>> SelctPageList(SkuEntity entity, PageParModel page); + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Interface/ISpuService.cs b/Yi.Framework.Net6/Yi.Framework.Interface/ISpuService.cs new file mode 100644 index 00000000..01532604 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Interface/ISpuService.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Yi.Framework.Common.Models; +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; + +namespace Yi.Framework.Interface +{ + public partial interface ISpuService:IBaseService + { + /// + /// 动态条件分页查询 + /// + /// + /// + /// + Task>> SelctPageList(SpuEntity entity, PageParModel page); + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ArticleEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ArticleEntity.cs index fc9ad6b0..0f9cb8ca 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ArticleEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ArticleEntity.cs @@ -8,6 +8,6 @@ namespace Yi.Framework.Model.Models public partial class ArticleEntity:IBaseModelEntity { [Navigate(NavigateType.OneToOne,nameof(UserId))] - public UserEntity User { get; set; } + public UserEntity? User { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/CategoryEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/CategoryEntity.cs new file mode 100644 index 00000000..565f195e --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Model/CategoryEntity.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json.Serialization; +using SqlSugar; +namespace Yi.Framework.Model.Models +{ + /// + /// 商品分类表 + /// + public partial class CategoryEntity:IBaseModelEntity + { + [SugarColumn(IsIgnore = true)] + public List? Children { get; set; } + + + [Navigate(NavigateType.OneToMany,nameof(SpecsGroupEntity.CategoryId))] + public List? SpecsGroups { get; set; } + } +} \ No newline at end of file diff --git a/Yi.Framework.Net6/Yi.Framework.Model/MenuEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/MenuEntity.cs index e56f69ea..7cc31a48 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/MenuEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/MenuEntity.cs @@ -25,14 +25,14 @@ namespace Yi.Framework.Model.Models var r = new VueRouterModel(); r.OrderNum = m.OrderNum ?? 0; - var routerName = m.Router.Split("/").LastOrDefault(); + var routerName = m.Router?.Split("/").LastOrDefault(); r.Id = m.Id; - r.ParentId = (long)m.ParentId; + r.ParentId = m.ParentId??-1; //开头大写 - r.Name = routerName.First().ToString().ToUpper() + routerName.Substring(1); + r.Name = routerName?.First().ToString().ToUpper() + routerName?.Substring(1); r.Path = m.Router; - r.Hidden = (bool)!m.IsShow; + r.Hidden =!m.IsShow??false; if (m.MenuType == MenuTypeEnum.Catalogue.GetHashCode()) @@ -62,9 +62,9 @@ namespace Yi.Framework.Model.Models { Title = m.MenuName, Icon = m.MenuIcon, - NoCache = (bool)!m.IsCache + NoCache = !m.IsCache??true }; - if ((bool)m.IsLink) + if (m.IsLink??false) { r.Meta.link = m.Router; r.AlwaysShow = false; diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/ArticleEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/ArticleEntity.cs index 9f3cbcf4..c1dceebc 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/ArticleEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/ArticleEntity.cs @@ -22,12 +22,12 @@ namespace Yi.Framework.Model.Models /// 文章标题 /// [SugarColumn(ColumnName="Title" )] - public string Title { get; set; } + public string? Title { get; set; } /// /// 文章内容 /// [SugarColumn(ColumnName="Content" )] - public string Content { get; set; } + public string? Content { get; set; } /// /// 用户id /// @@ -72,11 +72,11 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } /// /// 图片列表 /// [SugarColumn(ColumnName="Images",IsJson = true)] - public List Images { get; set; } + public List? Images { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/CategoryEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/CategoryEntity.cs new file mode 100644 index 00000000..16131d5e --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/CategoryEntity.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json.Serialization; +using SqlSugar; +namespace Yi.Framework.Model.Models +{ + /// + /// 商品分类表 + /// + [SugarTable("Category")] + public partial class CategoryEntity:IBaseModelEntity + { + public CategoryEntity() + { + this.CreateTime = DateTime.Now; + } + [JsonConverter(typeof(ValueToStringConverter))] + [SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )] + public long Id { get; set; } + /// + /// 父级id + /// + [SugarColumn(ColumnName="ParentId" )] + public long? ParentId { get; set; } + /// + /// 分类名称 + /// + [SugarColumn(ColumnName="CategoryName" )] + public string CategoryName { get; set; } + /// + /// 创建者 + /// + [SugarColumn(ColumnName="CreateUser" )] + public long? CreateUser { get; set; } + /// + /// 创建时间 + /// + [SugarColumn(ColumnName="CreateTime" )] + public DateTime? CreateTime { get; set; } + /// + /// 修改者 + /// + [SugarColumn(ColumnName="ModifyUser" )] + public long? ModifyUser { get; set; } + /// + /// 修改时间 + /// + [SugarColumn(ColumnName="ModifyTime" )] + public DateTime? ModifyTime { get; set; } + /// + /// 是否删除 + /// + [SugarColumn(ColumnName="IsDeleted" )] + public bool? IsDeleted { get; set; } + /// + /// 租户Id + /// + [SugarColumn(ColumnName="TenantId" )] + public long? TenantId { get; set; } + /// + /// 排序字段 + /// + [SugarColumn(ColumnName="OrderNum" )] + public int? OrderNum { get; set; } + /// + /// 描述 + /// + [SugarColumn(ColumnName="Remark" )] + public string? Remark { get; set; } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/ConfigEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/ConfigEntity.cs index f41dd6b0..7fd11b35 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/ConfigEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/ConfigEntity.cs @@ -22,22 +22,22 @@ namespace Yi.Framework.Model.Models /// 配置名称 /// [SugarColumn(ColumnName="ConfigName" )] - public string ConfigName { get; set; } + public string? ConfigName { get; set; } /// /// 配置键 /// [SugarColumn(ColumnName="ConfigKey" )] - public string ConfigKey { get; set; } + public string? ConfigKey { get; set; } /// /// 配置值 /// [SugarColumn(ColumnName="ConfigValue" )] - public string ConfigValue { get; set; } + public string? ConfigValue { get; set; } /// /// 配置类别 /// [SugarColumn(ColumnName="ConfigType" )] - public string ConfigType { get; set; } + public string? ConfigType { get; set; } /// /// 创建者 /// @@ -77,6 +77,6 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DeptEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DeptEntity.cs index c8628796..bfc66554 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DeptEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DeptEntity.cs @@ -22,17 +22,17 @@ namespace Yi.Framework.Model.Models /// 部门名称 /// [SugarColumn(ColumnName="DeptName" )] - public string DeptName { get; set; } + public string? DeptName { get; set; } /// /// 部门编码 /// [SugarColumn(ColumnName="DeptCode" )] - public string DeptCode { get; set; } + public string? DeptCode { get; set; } /// /// 负责人 /// [SugarColumn(ColumnName="Leader" )] - public string Leader { get; set; } + public string? Leader { get; set; } /// /// 父级id /// @@ -77,6 +77,6 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DictionaryEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DictionaryEntity.cs index c95a26fa..b14c1f02 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DictionaryEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DictionaryEntity.cs @@ -22,12 +22,12 @@ namespace Yi.Framework.Model.Models /// 字典名称 /// [SugarColumn(ColumnName="DictName" )] - public string DictName { get; set; } + public string? DictName { get; set; } /// /// 字典类型 /// [SugarColumn(ColumnName="DictType" )] - public string DictType { get; set; } + public string? DictType { get; set; } /// /// 创建者 /// @@ -67,6 +67,6 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DictionaryInfoEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DictionaryInfoEntity.cs index 57dffa89..c1f7200e 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DictionaryInfoEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DictionaryInfoEntity.cs @@ -22,17 +22,17 @@ namespace Yi.Framework.Model.Models /// 字典类型 /// [SugarColumn(ColumnName="DictType" )] - public string DictType { get; set; } + public string? DictType { get; set; } /// /// 字典标签 /// [SugarColumn(ColumnName="DictLabel" )] - public string DictLabel { get; set; } + public string? DictLabel { get; set; } /// /// 字典值 /// [SugarColumn(ColumnName="DictValue" )] - public string DictValue { get; set; } + public string? DictValue { get; set; } /// /// 是否为该类型的默认值 /// @@ -77,16 +77,16 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } /// /// tag类型 /// [SugarColumn(ColumnName="ListClass" )] - public string ListClass { get; set; } + public string? ListClass { get; set; } /// /// tagClass /// [SugarColumn(ColumnName="CssClass" )] - public string CssClass { get; set; } + public string? CssClass { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/FileEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/FileEntity.cs index 4f0e5a77..1336abe1 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/FileEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/FileEntity.cs @@ -22,7 +22,7 @@ namespace Yi.Framework.Model.Models /// 文件类型 /// [SugarColumn(ColumnName="FileType" )] - public string FileType { get; set; } + public string? FileType { get; set; } /// /// 文件大小 /// @@ -32,12 +32,12 @@ namespace Yi.Framework.Model.Models /// 文件名 /// [SugarColumn(ColumnName="FileName" )] - public string FileName { get; set; } + public string? FileName { get; set; } /// /// 文件路径 /// [SugarColumn(ColumnName="FilePath" )] - public string FilePath { get; set; } + public string? FilePath { get; set; } /// /// 创建者 /// @@ -77,6 +77,6 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/LogEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/LogEntity.cs index b7a085b1..e2db6dc9 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/LogEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/LogEntity.cs @@ -43,7 +43,7 @@ namespace Yi.Framework.Model.Models /// 消息 /// [SugarColumn(ColumnName="Message" )] - public string Message { get; set; } + public string? Message { get; set; } /// /// 排序字段 /// @@ -53,6 +53,6 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/LoginLogEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/LoginLogEntity.cs index d2165318..9f0dc985 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/LoginLogEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/LoginLogEntity.cs @@ -22,32 +22,32 @@ namespace Yi.Framework.Model.Models /// 登录用户 /// [SugarColumn(ColumnName="LoginUser" )] - public string LoginUser { get; set; } + public string? LoginUser { get; set; } /// /// 登录地点 /// [SugarColumn(ColumnName="LoginLocation" )] - public string LoginLocation { get; set; } + public string? LoginLocation { get; set; } /// /// 登录Ip /// [SugarColumn(ColumnName="LoginIp" )] - public string LoginIp { get; set; } + public string? LoginIp { get; set; } /// /// 浏览器 /// [SugarColumn(ColumnName="Browser" )] - public string Browser { get; set; } + public string? Browser { get; set; } /// /// 操作系统 /// [SugarColumn(ColumnName="Os" )] - public string Os { get; set; } + public string? Os { get; set; } /// /// 登录信息 /// [SugarColumn(ColumnName="LogMsg" )] - public string LogMsg { get; set; } + public string? LogMsg { get; set; } /// /// 创建者 /// @@ -82,7 +82,7 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } /// /// 是否删除 /// diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/MenuEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/MenuEntity.cs index d10103ad..aeb3c471 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/MenuEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/MenuEntity.cs @@ -23,7 +23,7 @@ namespace Yi.Framework.Model.Models /// /// [SugarColumn(ColumnName="MenuName" )] - public string MenuName { get; set; } + public string? MenuName { get; set; } /// /// /// @@ -33,7 +33,7 @@ namespace Yi.Framework.Model.Models /// /// [SugarColumn(ColumnName="PermissionCode" )] - public string PermissionCode { get; set; } + public string? PermissionCode { get; set; } /// /// /// @@ -73,12 +73,12 @@ namespace Yi.Framework.Model.Models /// 菜单图标 /// [SugarColumn(ColumnName="MenuIcon" )] - public string MenuIcon { get; set; } + public string? MenuIcon { get; set; } /// /// 菜单组件路由 /// [SugarColumn(ColumnName="Router" )] - public string Router { get; set; } + public string? Router { get; set; } /// /// 是否为外部链接 /// @@ -103,16 +103,16 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } /// /// 组件路径 /// [SugarColumn(ColumnName="Component" )] - public string Component { get; set; } + public string? Component { get; set; } /// /// 路由参数 /// [SugarColumn(ColumnName="Query" )] - public string Query { get; set; } + public string? Query { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/OperationLogEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/OperationLogEntity.cs index 183e60a3..3ee911fd 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/OperationLogEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/OperationLogEntity.cs @@ -22,7 +22,7 @@ namespace Yi.Framework.Model.Models /// 操作模块 /// [SugarColumn(ColumnName="Title" )] - public string Title { get; set; } + public string? Title { get; set; } /// /// 操作类型 /// @@ -32,7 +32,7 @@ namespace Yi.Framework.Model.Models /// 请求方法 /// [SugarColumn(ColumnName="RequestMethod" )] - public string RequestMethod { get; set; } + public string? RequestMethod { get; set; } /// /// 操作人员 /// @@ -42,27 +42,27 @@ namespace Yi.Framework.Model.Models /// 操作Ip /// [SugarColumn(ColumnName="OperIp" )] - public string OperIp { get; set; } + public string? OperIp { get; set; } /// /// 操作地点 /// [SugarColumn(ColumnName="OperLocation" )] - public string OperLocation { get; set; } + public string? OperLocation { get; set; } /// /// 操作方法 /// [SugarColumn(ColumnName="Method" )] - public string Method { get; set; } + public string? Method { get; set; } /// /// 请求参数 /// [SugarColumn(ColumnName="RequestParam" )] - public string RequestParam { get; set; } + public string? RequestParam { get; set; } /// /// 请求结果 /// [SugarColumn(ColumnName="RequestResult" )] - public string RequestResult { get; set; } + public string? RequestResult { get; set; } /// /// 创建者 /// @@ -97,7 +97,7 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } /// /// 是否删除 /// diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/PostEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/PostEntity.cs index 35e513ca..02564b99 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/PostEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/PostEntity.cs @@ -22,12 +22,12 @@ namespace Yi.Framework.Model.Models /// 岗位编码 /// [SugarColumn(ColumnName="PostCode" )] - public string PostCode { get; set; } + public string? PostCode { get; set; } /// /// 岗位名称 /// [SugarColumn(ColumnName="PostName" )] - public string PostName { get; set; } + public string? PostName { get; set; } /// /// 创建者 /// @@ -67,6 +67,6 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/RoleDeptEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/RoleDeptEntity.cs index a63cc7ab..5a3689c0 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/RoleDeptEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/RoleDeptEntity.cs @@ -67,6 +67,6 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/RoleEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/RoleEntity.cs index 63a36218..e269079b 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/RoleEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/RoleEntity.cs @@ -9,20 +9,20 @@ namespace Yi.Framework.Model.Models /// 角色表 /// [SugarTable("Role")] - public partial class RoleEntity:IBaseModelEntity + public partial class RoleEntity : IBaseModelEntity { public RoleEntity() { this.CreateTime = DateTime.Now; } [JsonConverter(typeof(ValueToStringConverter))] - [SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )] - public long Id { get; set; } + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)] + public long Id { get; set; } /// /// /// - [SugarColumn(ColumnName="RoleName" )] - public string RoleName { get; set; } + [SugarColumn(ColumnName = "RoleName")] + public string? RoleName { get; set; } /// /// 创建者 /// @@ -57,7 +57,7 @@ namespace Yi.Framework.Model.Models /// 角色编码 /// [SugarColumn(ColumnName="RoleCode" )] - public string RoleCode { get; set; } + public string? RoleCode { get; set; } /// /// 排序字段 /// @@ -67,7 +67,7 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } /// /// 角色数据范围 /// diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/SkuEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/SkuEntity.cs new file mode 100644 index 00000000..76e374eb --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/SkuEntity.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json.Serialization; +using SqlSugar; +namespace Yi.Framework.Model.Models +{ + /// + /// Sku表 + /// + [SugarTable("Sku")] + public partial class SkuEntity:IBaseModelEntity + { + public SkuEntity() + { + this.CreateTime = DateTime.Now; + } + [JsonConverter(typeof(ValueToStringConverter))] + [SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )] + public long Id { get; set; } + /// + /// SpuId + /// + [SugarColumn(ColumnName="SpuId" )] + public long? SpuId { get; set; } + /// + /// 库存 + /// + [SugarColumn(ColumnName="Stock" )] + public int? Stock { get; set; } + /// + /// 价格 + /// + [SugarColumn(ColumnName="Price" )] + public int? Price { get; set; } + + /// + /// 创建者 + /// + [SugarColumn(ColumnName="CreateUser" )] + public long? CreateUser { get; set; } + /// + /// 创建时间 + /// + [SugarColumn(ColumnName="CreateTime" )] + public DateTime? CreateTime { get; set; } + /// + /// 修改者 + /// + [SugarColumn(ColumnName="ModifyUser" )] + public long? ModifyUser { get; set; } + /// + /// 修改时间 + /// + [SugarColumn(ColumnName="ModifyTime" )] + public DateTime? ModifyTime { get; set; } + /// + /// 是否删除 + /// + [SugarColumn(ColumnName="IsDeleted" )] + public bool? IsDeleted { get; set; } + /// + /// 租户Id + /// + [SugarColumn(ColumnName="TenantId" )] + public long? TenantId { get; set; } + /// + /// 排序字段 + /// + [SugarColumn(ColumnName="OrderNum" )] + public int? OrderNum { get; set; } + /// + /// 描述 + /// + [SugarColumn(ColumnName="Remark" )] + public string? Remark { get; set; } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/SpecsEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/SpecsEntity.cs new file mode 100644 index 00000000..a5b0c161 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/SpecsEntity.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json.Serialization; +using SqlSugar; +namespace Yi.Framework.Model.Models +{ + /// + /// 商品规格表 + /// + [SugarTable("Specs")] + public partial class SpecsEntity:IBaseModelEntity + { + public SpecsEntity() + { + this.CreateTime = DateTime.Now; + } + [JsonConverter(typeof(ValueToStringConverter))] + [SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )] + public long Id { get; set; } + /// + /// 商品规格组id + /// + [SugarColumn(ColumnName="SpecsGroupId" )] + public long? SpecsGroupId { get; set; } + /// + /// 商品规格名 + /// + [SugarColumn(ColumnName="SpecsName" )] + public string SpecsName { get; set; } + /// + /// 创建者 + /// + [SugarColumn(ColumnName="CreateUser" )] + public long? CreateUser { get; set; } + /// + /// 创建时间 + /// + [SugarColumn(ColumnName="CreateTime" )] + public DateTime? CreateTime { get; set; } + /// + /// 修改者 + /// + [SugarColumn(ColumnName="ModifyUser" )] + public long? ModifyUser { get; set; } + /// + /// 修改时间 + /// + [SugarColumn(ColumnName="ModifyTime" )] + public DateTime? ModifyTime { get; set; } + /// + /// 是否删除 + /// + [SugarColumn(ColumnName="IsDeleted" )] + public bool? IsDeleted { get; set; } + /// + /// 租户Id + /// + [SugarColumn(ColumnName="TenantId" )] + public long? TenantId { get; set; } + /// + /// 排序字段 + /// + [SugarColumn(ColumnName="OrderNum" )] + public int? OrderNum { get; set; } + /// + /// 描述 + /// + [SugarColumn(ColumnName="Remark" )] + public string? Remark { get; set; } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/SpecsGroupEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/SpecsGroupEntity.cs new file mode 100644 index 00000000..8dd9c248 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/SpecsGroupEntity.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json.Serialization; +using SqlSugar; +namespace Yi.Framework.Model.Models +{ + /// + /// 商品规格组表 + /// + [SugarTable("SpecsGroup")] + public partial class SpecsGroupEntity:IBaseModelEntity + { + public SpecsGroupEntity() + { + this.CreateTime = DateTime.Now; + } + [JsonConverter(typeof(ValueToStringConverter))] + [SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )] + public long Id { get; set; } + /// + /// 分类id + /// + [SugarColumn(ColumnName="CategoryId" )] + public long? CategoryId { get; set; } + /// + /// 商品规格组名 + /// + [SugarColumn(ColumnName="SpecsGroupName" )] + public string SpecsGroupName { get; set; } + /// + /// 创建者 + /// + [SugarColumn(ColumnName="CreateUser" )] + public long? CreateUser { get; set; } + /// + /// 创建时间 + /// + [SugarColumn(ColumnName="CreateTime" )] + public DateTime? CreateTime { get; set; } + /// + /// 修改者 + /// + [SugarColumn(ColumnName="ModifyUser" )] + public long? ModifyUser { get; set; } + /// + /// 修改时间 + /// + [SugarColumn(ColumnName="ModifyTime" )] + public DateTime? ModifyTime { get; set; } + /// + /// 是否删除 + /// + [SugarColumn(ColumnName="IsDeleted" )] + public bool? IsDeleted { get; set; } + /// + /// 租户Id + /// + [SugarColumn(ColumnName="TenantId" )] + public long? TenantId { get; set; } + /// + /// 排序字段 + /// + [SugarColumn(ColumnName="OrderNum" )] + public int? OrderNum { get; set; } + /// + /// 描述 + /// + [SugarColumn(ColumnName="Remark" )] + public string? Remark { get; set; } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/SpuEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/SpuEntity.cs new file mode 100644 index 00000000..51db453a --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/SpuEntity.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json.Serialization; +using SqlSugar; +namespace Yi.Framework.Model.Models +{ + /// + /// Spu表 + /// + [SugarTable("Spu")] + public partial class SpuEntity:IBaseModelEntity + { + public SpuEntity() + { + this.CreateTime = DateTime.Now; + } + [JsonConverter(typeof(ValueToStringConverter))] + [SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )] + public long Id { get; set; } + /// + /// 商品分类Id + /// + [SugarColumn(ColumnName="CategoryId" )] + public long? CategoryId { get; set; } + /// + /// 商品名称 + /// + [SugarColumn(ColumnName="SpuName" )] + public string? SpuName { get; set; } + /// + /// 商品详情 + /// + [SugarColumn(ColumnName="Details" )] + public string? Details { get; set; } + /// + /// 商品价格 + /// + [SugarColumn(ColumnName="Price" )] + public string? Price { get; set; } + + /// + /// 创建者 + /// + [SugarColumn(ColumnName="CreateUser" )] + public long? CreateUser { get; set; } + /// + /// 创建时间 + /// + [SugarColumn(ColumnName="CreateTime" )] + public DateTime? CreateTime { get; set; } + /// + /// 修改者 + /// + [SugarColumn(ColumnName="ModifyUser" )] + public long? ModifyUser { get; set; } + /// + /// 修改时间 + /// + [SugarColumn(ColumnName="ModifyTime" )] + public DateTime? ModifyTime { get; set; } + /// + /// 是否删除 + /// + [SugarColumn(ColumnName="IsDeleted" )] + public bool? IsDeleted { get; set; } + /// + /// 租户Id + /// + [SugarColumn(ColumnName="TenantId" )] + public long? TenantId { get; set; } + /// + /// 排序字段 + /// + [SugarColumn(ColumnName="OrderNum" )] + public int? OrderNum { get; set; } + /// + /// 描述 + /// + [SugarColumn(ColumnName="Remark" )] + public string? Remark { get; set; } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/TenantEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/TenantEntity.cs index 408b15d9..6fe01429 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/TenantEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/TenantEntity.cs @@ -22,7 +22,7 @@ namespace Yi.Framework.Model.Models /// /// [SugarColumn(ColumnName="TenantName" )] - public string TenantName { get; set; } + public string? TenantName { get; set; } /// /// 创建者 /// @@ -62,6 +62,6 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/UserEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/UserEntity.cs index 70d7731f..ba887c24 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/UserEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/UserEntity.cs @@ -22,7 +22,7 @@ namespace Yi.Framework.Model.Models /// /// [SugarColumn(ColumnName="Name" )] - public string Name { get; set; } + public string? Name { get; set; } /// /// /// @@ -72,42 +72,42 @@ namespace Yi.Framework.Model.Models /// /// [SugarColumn(ColumnName="Salt" )] - public string Salt { get; set; } + public string? Salt { get; set; } /// /// /// [SugarColumn(ColumnName="Icon" )] - public string Icon { get; set; } + public string? Icon { get; set; } /// /// /// [SugarColumn(ColumnName="Nick" )] - public string Nick { get; set; } + public string? Nick { get; set; } /// /// /// [SugarColumn(ColumnName="Email" )] - public string Email { get; set; } + public string? Email { get; set; } /// /// /// [SugarColumn(ColumnName="Ip" )] - public string Ip { get; set; } + public string? Ip { get; set; } /// /// /// [SugarColumn(ColumnName="Address" )] - public string Address { get; set; } + public string? Address { get; set; } /// /// /// [SugarColumn(ColumnName="Phone" )] - public string Phone { get; set; } + public string? Phone { get; set; } /// /// /// [SugarColumn(ColumnName="Introduction" )] - public string Introduction { get; set; } + public string? Introduction { get; set; } /// /// 排序字段 /// @@ -117,7 +117,7 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } /// /// 部门id /// diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/UserPostEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/UserPostEntity.cs index ef30ac12..bf737ff6 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/UserPostEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/UserPostEntity.cs @@ -67,6 +67,6 @@ namespace Yi.Framework.Model.Models /// 描述 /// [SugarColumn(ColumnName="Remark" )] - public string Remark { get; set; } + public string? Remark { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/RoleEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/RoleEntity.cs index 3aec15c2..6a99237e 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/RoleEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/RoleEntity.cs @@ -10,9 +10,9 @@ namespace Yi.Framework.Model.Models { [Navigate(typeof(RoleMenuEntity),nameof(RoleMenuEntity.RoleId),nameof(RoleMenuEntity.MenuId))] - public List Menus { get; set; } + public List? Menus { get; set; } [Navigate(typeof(RoleDeptEntity), nameof(RoleDeptEntity.RoleId), nameof(RoleDeptEntity.DeptId))] - public List Depts { get; set; } + public List? Depts { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/SkuEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/SkuEntity.cs new file mode 100644 index 00000000..582c3283 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Model/SkuEntity.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json.Serialization; +using SqlSugar; +namespace Yi.Framework.Model.Models +{ + /// + /// Sku表 + /// + public partial class SkuEntity:IBaseModelEntity + { + /// + /// 规格sku信息 + /// + [SugarColumn(ColumnName = "SpecsSkuInfo", IsJson = true)] + public List? SpecsSkuInfo { get; set; } + /// + /// 规格sku完整信息 + /// + [SugarColumn(ColumnName = "SpecsSkuAllInfo", IsJson = true)] + public List? SpecsSkuAllInfo { get; set; } + } + + public class SpecsSkuAllInfoModel + { + public string? SpecsGroupName { get; set; } + public string? SpecsName { get; set; } + } + public class SpecsSkuInfoModel + { + public long? SpecsGroupId { get; set; } + public long? SpecsId { get; set; } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Model/SpecsGroupEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/SpecsGroupEntity.cs new file mode 100644 index 00000000..3a4df243 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Model/SpecsGroupEntity.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json.Serialization; +using SqlSugar; +namespace Yi.Framework.Model.Models +{ + /// + /// 商品规格组表 + /// + public partial class SpecsGroupEntity:IBaseModelEntity + { + [Navigate(NavigateType.OneToMany, nameof(SpecsEntity.SpecsGroupId))] + public List? Specses { get; set; } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Model/SpuEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/SpuEntity.cs new file mode 100644 index 00000000..30ef1e5b --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Model/SpuEntity.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json.Serialization; +using SqlSugar; +namespace Yi.Framework.Model.Models +{ + + public partial class SpuEntity:IBaseModelEntity + { + /// + /// 规格Spu完整信息 + /// + [SugarColumn(ColumnName = "SpecsAllInfo", IsJson = true)] + public List? SpecsSpuAllInfo { get; set; } + /// + /// 规格Spu信息 + /// + [SugarColumn(ColumnName = "SpecsInfo", IsJson = true)] + public List? SpecsSpuInfo { get; set; } + + [Navigate(NavigateType.OneToMany, nameof(SkuEntity.SpuId))] + public List? Skus { get; set; } + } + + public class SpecsSpuAllInfoModel + { + public string? SpecsGroupName { get; set; } + public List? SpecsNames{ get;set;} + } + public class SpecsSpuInfoModel + { + public long? SpecsGroupId{ get; set; } + public List? SpecsIds { get; set; } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Model/UserEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/UserEntity.cs index dd3d2275..07d56a5a 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/UserEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/UserEntity.cs @@ -12,13 +12,13 @@ namespace Yi.Framework.Model.Models /// 看好啦!ORM精髓,导航属性 /// [Navigate(typeof(UserRoleEntity), nameof(UserRoleEntity.UserId), nameof(UserRoleEntity.RoleId))] - public List Roles { get; set; } + public List? Roles { get; set; } [Navigate(typeof(UserPostEntity), nameof(UserPostEntity.UserId), nameof(UserPostEntity.PostId))] - public List Posts { get; set; } + public List? Posts { get; set; } [Navigate( NavigateType.OneToOne,nameof(DeptId))] - public DeptEntity Dept { get; set; } + public DeptEntity? Dept { get; set; } /// /// 构建密码,MD5盐值加密 diff --git a/Yi.Framework.Net6/Yi.Framework.Model/Yi.Framework.Model.csproj b/Yi.Framework.Net6/Yi.Framework.Model/Yi.Framework.Model.csproj index 7bc07bb8..03cc9a11 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/Yi.Framework.Model.csproj +++ b/Yi.Framework.Net6/Yi.Framework.Model/Yi.Framework.Model.csproj @@ -2,6 +2,7 @@ net6.0 + enable diff --git a/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/CategoryService.cs b/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/CategoryService.cs new file mode 100644 index 00000000..ea55419a --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/CategoryService.cs @@ -0,0 +1,14 @@ +using SqlSugar; +using Yi.Framework.Interface; +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; + +namespace Yi.Framework.Service +{ + public partial class CategoryService : BaseService, ICategoryService + { + public CategoryService(IRepository repository) : base(repository) + { + } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/SkuService.cs b/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/SkuService.cs new file mode 100644 index 00000000..6d86af4c --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/SkuService.cs @@ -0,0 +1,14 @@ +using SqlSugar; +using Yi.Framework.Interface; +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; + +namespace Yi.Framework.Service +{ + public partial class SkuService : BaseService, ISkuService + { + public SkuService(IRepository repository) : base(repository) + { + } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/SpecsGroupService.cs b/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/SpecsGroupService.cs new file mode 100644 index 00000000..fc7edbe2 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/SpecsGroupService.cs @@ -0,0 +1,14 @@ +using SqlSugar; +using Yi.Framework.Interface; +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; + +namespace Yi.Framework.Service +{ + public partial class SpecsGroupService : BaseService, ISpecsGroupService + { + public SpecsGroupService(IRepository repository) : base(repository) + { + } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/SpecsService.cs b/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/SpecsService.cs new file mode 100644 index 00000000..0374e217 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/SpecsService.cs @@ -0,0 +1,14 @@ +using SqlSugar; +using Yi.Framework.Interface; +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; + +namespace Yi.Framework.Service +{ + public partial class SpecsService : BaseService, ISpecsService + { + public SpecsService(IRepository repository) : base(repository) + { + } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/SpuService.cs b/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/SpuService.cs new file mode 100644 index 00000000..a91bc78d --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/SpuService.cs @@ -0,0 +1,14 @@ +using SqlSugar; +using Yi.Framework.Interface; +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; + +namespace Yi.Framework.Service +{ + public partial class SpuService : BaseService, ISpuService + { + public SpuService(IRepository repository) : base(repository) + { + } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Service/SkuService.cs b/Yi.Framework.Net6/Yi.Framework.Service/SkuService.cs new file mode 100644 index 00000000..93bb7fe4 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Service/SkuService.cs @@ -0,0 +1,25 @@ +using SqlSugar; +using System.Collections.Generic; +using System.Threading.Tasks; +using Yi.Framework.Common.Models; +using Yi.Framework.Interface; +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; + +namespace Yi.Framework.Service +{ + public partial class SkuService : BaseService, ISkuService + { + public async Task>> SelctPageList(SkuEntity enetity, PageParModel page) + { + RefAsync total = 0; + var data = await _repository._DbQueryable + + .WhereIF(page.StartTime is not null && page.EndTime is not null, u => u.CreateTime >= page.StartTime && u.CreateTime <= page.EndTime) + .WhereIF(enetity.IsDeleted is not null, u => u.IsDeleted == enetity.IsDeleted) + .OrderBy(u => u.CreateTime, OrderByType.Desc) + .ToPageListAsync(page.PageNum, page.PageSize, total); + return new PageModel>(data, total); + } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Service/SpuService.cs b/Yi.Framework.Net6/Yi.Framework.Service/SpuService.cs new file mode 100644 index 00000000..c21b2c39 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Service/SpuService.cs @@ -0,0 +1,25 @@ +using SqlSugar; +using System.Collections.Generic; +using System.Threading.Tasks; +using Yi.Framework.Common.Models; +using Yi.Framework.Interface; +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; + +namespace Yi.Framework.Service +{ + public partial class SpuService : BaseService, ISpuService + { + public async Task>> SelctPageList(SpuEntity enetity, PageParModel page) + { + RefAsync total = 0; + var data = await _repository._DbQueryable + .Includes(spu=>spu.Skus) + .WhereIF(page.StartTime is not null && page.EndTime is not null, u => u.CreateTime >= page.StartTime && u.CreateTime <= page.EndTime) + .WhereIF(enetity.IsDeleted is not null, u => u.IsDeleted == enetity.IsDeleted) + .OrderBy(u => u.CreateTime, OrderByType.Desc) + .ToPageListAsync(page.PageNum, page.PageSize, total); + return new PageModel>(data, total); + } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/Appsettings.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/Appsettings.cs index 23c825f3..53fedd00 100644 --- a/Yi.Framework.Net6/Yi.Framework.WebCore/Appsettings.cs +++ b/Yi.Framework.Net6/Yi.Framework.WebCore/Appsettings.cs @@ -11,8 +11,8 @@ namespace Yi.Framework.WebCore /// public class Appsettings { - static IConfiguration Configuration { get; set; } - static string contentPath { get; set; } + static IConfiguration? Configuration { get; set; } + static string? contentPath { get; set; } public Appsettings(string contentPath) { @@ -37,14 +37,14 @@ namespace Yi.Framework.WebCore /// /// 节点配置 /// - public static string app(params string[] sections) + public static string? app(params string[] sections) { try { if (sections.Any()) { - return Configuration[string.Join(":", sections)]; + return Configuration?[string.Join(":", sections)]; } } catch (Exception) { } @@ -59,7 +59,7 @@ namespace Yi.Framework.WebCore } - public static bool Bool(object thisValue) + public static bool Bool(object? thisValue) { bool reval = false; if (thisValue != null && thisValue != DBNull.Value && bool.TryParse(thisValue.ToString(), out reval)) @@ -84,9 +84,9 @@ namespace Yi.Framework.WebCore } - public static IConfiguration appConfiguration(params string[] sections) + public static IConfiguration? appConfiguration(params string[] sections) { - return Configuration.GetSection(string.Join(":", sections)); + return Configuration?.GetSection(string.Join(":", sections)); } } } diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/AttributeExtend/GlobalLogAttribute.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/AttributeExtend/GlobalLogAttribute.cs index 4b02390e..20e5e3d1 100644 --- a/Yi.Framework.Net6/Yi.Framework.WebCore/AttributeExtend/GlobalLogAttribute.cs +++ b/Yi.Framework.Net6/Yi.Framework.WebCore/AttributeExtend/GlobalLogAttribute.cs @@ -35,9 +35,8 @@ namespace Yi.Framework.WebCore.AttributeExtend if (context.ActionDescriptor is not ControllerActionDescriptor controllerActionDescriptor) return; //查找标签,获取标签对象 - LogAttribute logAttribute = controllerActionDescriptor.MethodInfo.GetCustomAttributes(inherit: true) + LogAttribute? logAttribute = controllerActionDescriptor.MethodInfo.GetCustomAttributes(inherit: true) .FirstOrDefault(a => a.GetType().Equals(typeof(LogAttribute))) as LogAttribute; - //空对象直接返回 if (logAttribute is null) return; @@ -72,7 +71,7 @@ namespace Yi.Framework.WebCore.AttributeExtend { if (context.Result is ContentResult result && result.ContentType == "application/json") { - logEntity.RequestResult = result.Content.Replace("\r\n", "").Trim(); + logEntity.RequestResult = result.Content?.Replace("\r\n", "").Trim(); } if (context.Result is JsonResult result2) { diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/BuilderExtend/ApolloExtension.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/BuilderExtend/ApolloExtension.cs index 313fce11..36c73af5 100644 --- a/Yi.Framework.Net6/Yi.Framework.WebCore/BuilderExtend/ApolloExtension.cs +++ b/Yi.Framework.Net6/Yi.Framework.WebCore/BuilderExtend/ApolloExtension.cs @@ -50,12 +50,16 @@ namespace Yi.Framework.WebCore.BuilderExtend { foreach (var apolloProvider in root.Providers.Where(p => p is ApolloConfigurationProvider)) { - var property = apolloProvider.GetType().BaseType.GetProperty("Data", BindingFlags.Instance | BindingFlags.NonPublic); - var data = property.GetValue(apolloProvider) as IDictionary; - foreach (var item in data) + var property = apolloProvider.GetType().BaseType?.GetProperty("Data", BindingFlags.Instance | BindingFlags.NonPublic); + var data = property?.GetValue(apolloProvider) as IDictionary; + if (data is not null) { - Console.WriteLine($"key {item.Key} value {item.Value}"); + foreach (var item in data) + { + Console.WriteLine($"key {item.Key} value {item.Value}"); + } } + } }); } diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/BuilderExtend/JsonExtension.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/BuilderExtend/JsonExtension.cs index 55fa9629..cc59de83 100644 --- a/Yi.Framework.Net6/Yi.Framework.WebCore/BuilderExtend/JsonExtension.cs +++ b/Yi.Framework.Net6/Yi.Framework.WebCore/BuilderExtend/JsonExtension.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; +using System.Text.Json.Serialization; using System.Threading.Tasks; namespace Yi.Framework.WebCore.BuilderExtend @@ -13,11 +14,14 @@ namespace Yi.Framework.WebCore.BuilderExtend { public static void AddJsonFileService(this IMvcBuilder builder) { + builder.AddJsonOptions(options => + options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter())); + builder.AddNewtonsoftJson(options => { options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore; options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm"; - + //options.SerializerSettings.Converters.Add(new ValueToStringConverter()); }); diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/BuilderExtend/OptionsWritable/Internal/JsonOptionsWritable.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/BuilderExtend/OptionsWritable/Internal/JsonOptionsWritable.cs index 662976d5..47ee93ff 100644 --- a/Yi.Framework.Net6/Yi.Framework.WebCore/BuilderExtend/OptionsWritable/Internal/JsonOptionsWritable.cs +++ b/Yi.Framework.Net6/Yi.Framework.WebCore/BuilderExtend/OptionsWritable/Internal/JsonOptionsWritable.cs @@ -15,12 +15,12 @@ internal class JsonOptionsWritable : FileOptionsWritableBase public override void Update(Action configuration) { - JObject jObject = JsonConvert.DeserializeObject(File.ReadAllText(this.FileName)); + JObject? jObject = JsonConvert.DeserializeObject(File.ReadAllText(this.FileName)); if (jObject != null) { TOptions option = this.Monitor.CurrentValue ?? new TOptions(); - if (jObject.TryGetValue(this.Section, out JToken jtoken)) + if (jObject.TryGetValue(this.Section, out JToken? jtoken)) { option = JsonConvert.DeserializeObject(jtoken.ToString()) ?? new TOptions(); configuration?.Invoke(option); diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/CommonExtend/HttpContextExtend.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/CommonExtend/HttpContextExtend.cs index 790e85be..784be41e 100644 --- a/Yi.Framework.Net6/Yi.Framework.WebCore/CommonExtend/HttpContextExtend.cs +++ b/Yi.Framework.Net6/Yi.Framework.WebCore/CommonExtend/HttpContextExtend.cs @@ -50,7 +50,7 @@ namespace Yi.Framework.WebCore /// /// /// - public static string GetUserNameInfo(this HttpContext httpContext) + public static string? GetUserNameInfo(this HttpContext httpContext) { var p = httpContext; return httpContext.User.Claims.FirstOrDefault(u => u.Type == "userName")?.Value; @@ -61,10 +61,10 @@ namespace Yi.Framework.WebCore /// /// /// - public static string GetDeptIdInfo(this HttpContext httpContext) + public static string? GetDeptIdInfo(this HttpContext httpContext) { var p = httpContext; - return httpContext.User.Claims.FirstOrDefault(u => u.Type == "deptId").Value; + return httpContext.User.Claims.FirstOrDefault(u => u.Type == "deptId")?.Value; } /// @@ -72,10 +72,10 @@ namespace Yi.Framework.WebCore /// /// /// - public static string GetPermissionInfo(this HttpContext httpContext) + public static string? GetPermissionInfo(this HttpContext httpContext) { var p = httpContext; - return httpContext.User.Claims.FirstOrDefault(u => u.Type == "permission").Value; + return httpContext.User.Claims.FirstOrDefault(u => u.Type == "permission")?.Value; } @@ -87,7 +87,7 @@ namespace Yi.Framework.WebCore /// public static UserEntity GetUserEntityInfo(this HttpContext httpContext, out List menuIds) { - IEnumerable claimlist = null; + IEnumerable? claimlist = null; long resId = 0; try { @@ -139,7 +139,7 @@ namespace Yi.Framework.WebCore { string res = "zh-CN"; var str = httpContext.Request.Headers["Accept-Language"].FirstOrDefault(); - if (str.IsNotNull()) + if (str is not null) { res = str.Split(",")[0]; } @@ -167,7 +167,7 @@ namespace Yi.Framework.WebCore } else { - param = context.Request.QueryString.Value.ToString(); + param = context.Request.QueryString.Value is null?"": context.Request.QueryString.Value.ToString(); } return param; } diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/DbExtend/DbFiterExtend.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/DbExtend/DbFiterExtend.cs index 59aeb3d2..b5b33dab 100644 --- a/Yi.Framework.Net6/Yi.Framework.WebCore/DbExtend/DbFiterExtend.cs +++ b/Yi.Framework.Net6/Yi.Framework.WebCore/DbExtend/DbFiterExtend.cs @@ -21,7 +21,7 @@ namespace Yi.Framework.Core } //无需授权情况 - var userName = httpContext.GetUserNameInfo(); + var userName = httpContext?.GetUserNameInfo(); if (userName is null) { return; @@ -35,52 +35,57 @@ namespace Yi.Framework.Core //这里可以优化一下 //根据缓存获取全部用户信息 - var userRoleMenu = ServiceLocator.Instance.GetService().Get("用户id"); + var userRoleMenu = ServiceLocator.Instance?.GetService()?.Get("用户id"); - var roles = userRoleMenu.Roles; + var roles = userRoleMenu?.Roles; if (roles.IsNull()) { roles = new(); } //先测试部门就是LEBG - long deptId = (long)userRoleMenu.User.DeptId; - long userId = httpContext.GetUserIdInfo(); + long deptId = userRoleMenu?.User.DeptId ?? -1; + long userId = httpContext?.GetUserIdInfo()??-1; //根据角色的数据范围,来添加相对于的数据权限 - foreach (var role in roles) + if (roles is not null) { - DataScopeEnum dataScope = (DataScopeEnum)role.DataScope; - switch (dataScope) + foreach (var role in roles) { - case DataScopeEnum.ALL: - //直接放行 - break; - case DataScopeEnum.DEPT: - //只能查询到自己的部门的数据 - db.QueryFilter.Add(new TableFilterItem(it => it.DeptId == deptId, true)); - break; - case DataScopeEnum.USER: - //只能查询到自己 - db.QueryFilter.Add(new TableFilterItem(it => it.Id == userId, true)); - break; - case DataScopeEnum.CUSTOM: - //自定义查询 - var filter = new TableFilterItem(it => SqlFunc.Subqueryable().Where(f => f.DeptId == it.DeptId && f.RoleId == (long)role.Id).Any(), true); - db.QueryFilter.Add(filter); - break; - case DataScopeEnum.DEPT_FOLLOW: - //放行自己部门及以下 - var allChildDepts = db.Queryable().ToChildList(it => it.ParentId, deptId); + //默认为全部 + DataScopeEnum dataScope = (DataScopeEnum)(role.DataScope ?? DataScopeEnum.ALL.GetHashCode()); + switch (dataScope) + { + case DataScopeEnum.ALL: + //直接放行 + break; + case DataScopeEnum.DEPT: + //只能查询到自己的部门的数据 + db.QueryFilter.Add(new TableFilterItem(it => it.DeptId == deptId, true)); + break; + case DataScopeEnum.USER: + //只能查询到自己 + db.QueryFilter.Add(new TableFilterItem(it => it.Id == userId, true)); + break; + case DataScopeEnum.CUSTOM: + //自定义查询 + var filter = new TableFilterItem(it => SqlFunc.Subqueryable().Where(f => f.DeptId == it.DeptId && f.RoleId == (long)role.Id).Any(), true); + db.QueryFilter.Add(filter); + break; + case DataScopeEnum.DEPT_FOLLOW: + //放行自己部门及以下 + var allChildDepts = db.Queryable().ToChildList(it => it.ParentId, deptId); - var filter1 = new TableFilterItem(it => allChildDepts.Select(f => f.Id).ToList().Contains((long)it.DeptId), true); - db.QueryFilter.Add(filter1); + var filter1 = new TableFilterItem(it => allChildDepts.Select(f => f.Id).ToList().Contains(it.DeptId ?? -1), true); - //部门无需过滤 - //var filter2 = new TableFilterItem(it => allChildDepts.Select(f => f.Id).ToList().Contains(it.Id),true); - //db.QueryFilter.Add(filter2); - break; - default: - break; + db.QueryFilter.Add(filter1); + + //部门无需过滤 + //var filter2 = new TableFilterItem(it => allChildDepts.Select(f => f.Id).ToList().Contains(it.Id),true); + //db.QueryFilter.Add(filter2); + break; + default: + break; + } } } } diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/DbExtend/DbSeedExtend.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/DbExtend/DbSeedExtend.cs index 54a688f0..8e93a35c 100644 --- a/Yi.Framework.Net6/Yi.Framework.WebCore/DbExtend/DbSeedExtend.cs +++ b/Yi.Framework.Net6/Yi.Framework.WebCore/DbExtend/DbSeedExtend.cs @@ -13,7 +13,12 @@ namespace Yi.Framework.WebCore.DbExtend { public static class DbSeedExtend { - public static bool Invoer(ISqlSugarClient _Db) + /// + /// 初始化数据 + /// + /// + /// + public static bool DataInvoer(ISqlSugarClient _Db) { bool res = false; var users = SeedFactory.GetUserSeed(); @@ -87,14 +92,40 @@ namespace Yi.Framework.WebCore.DbExtend return res; } + /// + /// codeFirst初始化表 + /// + /// + /// + public static void TableInvoer(ISqlSugarClient _Db) + { + //创建数据库 + _Db.DbMaintenance.CreateDatabase(); + var typeList = Common.Helper.AssemblyHelper.GetClass("Yi.Framework.Model"); + foreach (var t in typeList) + { + //扫描如果存在SugarTable特性,直接codefirst + if (t.GetCustomAttributes(false).Any(a => a.GetType().Equals(typeof(SugarTable)))) + { + _Db.CodeFirst.SetStringDefaultLength(200).InitTables(t);//这样一个表就能成功创建了 + } + } + + } + public static void UseDbSeedInitService(this IApplicationBuilder app) { + if (Appsettings.appBool("DbCodeFirst_Enabled")) + { + var _Db = app.ApplicationServices.GetRequiredService(); + TableInvoer(_Db); + } if (Appsettings.appBool("DbSeed_Enabled")) { - var _Db = app.ApplicationServices.GetService(); - Invoer(_Db); + var _Db = app.ApplicationServices.GetRequiredService(); + DataInvoer(_Db); } } diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/FilterExtend/CustomExceptionFilterAttribute.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/FilterExtend/CustomExceptionFilterAttribute.cs index 0af7e9f8..7e6754b6 100644 --- a/Yi.Framework.Net6/Yi.Framework.WebCore/FilterExtend/CustomExceptionFilterAttribute.cs +++ b/Yi.Framework.Net6/Yi.Framework.WebCore/FilterExtend/CustomExceptionFilterAttribute.cs @@ -15,7 +15,7 @@ namespace Yi.Framework.WebCore.FilterExtend /// public class CustomExceptionFilterAttribute : IExceptionFilter { - private ILogger _logger = null; + private ILogger _logger; public CustomExceptionFilterAttribute(ILogger logger) { this._logger = logger; @@ -27,8 +27,8 @@ namespace Yi.Framework.WebCore.FilterExtend { context.Result = new JsonResult( Result.Error("操作失败").SetData(context.Exception.Message)); - string url = context.HttpContext.Request.Path.Value; - string actionName = context.ActionDescriptor.DisplayName; + string? url = context.HttpContext.Request.Path.Value; + string? actionName = context.ActionDescriptor.DisplayName; var logModel = new LogModel() { diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/FilterExtend/CustomIOCFilterFactoryAttribute.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/FilterExtend/CustomIOCFilterFactoryAttribute.cs index 77a08bcf..985117ab 100644 --- a/Yi.Framework.Net6/Yi.Framework.WebCore/FilterExtend/CustomIOCFilterFactoryAttribute.cs +++ b/Yi.Framework.Net6/Yi.Framework.WebCore/FilterExtend/CustomIOCFilterFactoryAttribute.cs @@ -11,7 +11,7 @@ namespace Yi.Framework.WebCore.FilterExtend /// public class CustomIOCFilterFactoryAttribute : Attribute, IFilterFactory { - private readonly Type _FilterType = null; + private readonly Type _FilterType; public CustomIOCFilterFactoryAttribute(Type type) { @@ -23,7 +23,7 @@ namespace Yi.Framework.WebCore.FilterExtend { //return (IFilterMetadata)serviceProvider.GetService(typeof(CustomExceptionFilterAttribute)); - return (IFilterMetadata)serviceProvider.GetService(this._FilterType); + return (IFilterMetadata)serviceProvider.GetService(this._FilterType)!; } } diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/FilterExtend/CustomResourceFilterAttribute.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/FilterExtend/CustomResourceFilterAttribute.cs index c8640ef7..031948f0 100644 --- a/Yi.Framework.Net6/Yi.Framework.WebCore/FilterExtend/CustomResourceFilterAttribute.cs +++ b/Yi.Framework.Net6/Yi.Framework.WebCore/FilterExtend/CustomResourceFilterAttribute.cs @@ -12,7 +12,7 @@ namespace Yi.Framework.WebCore.FilterExtend /// public class CustomResourceFilterAttribute : Attribute, IResourceFilter, IFilterMetadata { - private static Dictionary CustomCache = new Dictionary(); + private static Dictionary CustomCache = new Dictionary(); /// /// 发生在其他动作之前 /// diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/FilterExtend/LogActionFilterAttribute.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/FilterExtend/LogActionFilterAttribute.cs index 50cbca85..0e91e039 100644 --- a/Yi.Framework.Net6/Yi.Framework.WebCore/FilterExtend/LogActionFilterAttribute.cs +++ b/Yi.Framework.Net6/Yi.Framework.WebCore/FilterExtend/LogActionFilterAttribute.cs @@ -14,7 +14,7 @@ namespace Yi.Framework.WebCore.FilterExtend /// public class LogActionFilterAttribute : ActionFilterAttribute { - private ILogger _logger = null; + private ILogger _logger ; public LogActionFilterAttribute(ILogger logger) { this._logger = logger; @@ -22,11 +22,11 @@ namespace Yi.Framework.WebCore.FilterExtend public override void OnActionExecuting(ActionExecutingContext context) { - string url = context.HttpContext.Request.Path.Value; + string? url = context.HttpContext.Request.Path.Value; string argument = JsonConvert.SerializeObject(context.ActionArguments); - string controllerName = context.Controller.GetType().FullName; - string actionName = context.ActionDescriptor.DisplayName; + string? controllerName = context.Controller.GetType().FullName; + string? actionName = context.ActionDescriptor.DisplayName; LogModel logModel = new LogModel() { diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/ConsulRegisterHostExtend.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/ConsulRegisterHostExtend.cs new file mode 100644 index 00000000..4061172f --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/ConsulRegisterHostExtend.cs @@ -0,0 +1,126 @@ +using Consul; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Options; +using System; +using System.Threading; +using System.Threading.Tasks; +using Yi.Framework.Common.IOCOptions; + +namespace Yi.Framework.WebCore.MiddlewareExtend +{ + /// + /// 注册ConsulRegisterService 这个servcie在app启动的时候会自动注册服务信息 + /// + public class ConsulRegisterHostExtend : IHostedService + { + private readonly ConsulRegisterOption _consulRegisterOptions; + private readonly ConsulClientOption _consulClientOptions; + public ConsulRegisterHostExtend() + { + _consulRegisterOptions = Appsettings.app("ConsulRegisterOption"); + + _consulClientOptions = Appsettings.app("ConsulClientOption"); + } + public async Task StartAsync(CancellationToken cancellationToken) + { + var httpPort = this._consulRegisterOptions.Port; + //var grpcPort = Convert.ToInt32(Appsettings.app("GrpcPort")); + //------------------Http------------------ + using (ConsulClient client = new ConsulClient(c => + { + c.Address = new Uri($"http://{this._consulClientOptions.IP}:{this._consulClientOptions.Port}/"); + c.Datacenter = this._consulClientOptions.Datacenter; + })) + { + var serviceId = $"{this._consulRegisterOptions.IP}:{httpPort}-{this._consulRegisterOptions.GroupName}"; + + await client.Agent.ServiceDeregister(serviceId, cancellationToken); + + Console.WriteLine($"开始向Consul注册Http[{serviceId}]服务 ..."); + + await client.Agent.ServiceRegister(new AgentServiceRegistration() + { + ID = serviceId,//唯一Id + Name = this._consulRegisterOptions.GroupName,//组名称-Group + Address = this._consulRegisterOptions.IP, + Port = httpPort, + Tags = new string[] { "Http" }, + Check = new AgentServiceCheck() + { + Interval = TimeSpan.FromSeconds(this._consulRegisterOptions.Interval), + HTTP = $"http://{_consulRegisterOptions.IP}:{httpPort}/Health", + //GRPC = $"{this._consulRegisterOptions.IP}:{grpcPort}",//gRPC特有 + GRPCUseTLS = false,//支持http + Timeout = TimeSpan.FromSeconds(this._consulRegisterOptions.Timeout), + DeregisterCriticalServiceAfter = TimeSpan.FromSeconds(this._consulRegisterOptions.DeregisterCriticalServiceAfter), + + } + }); + } + + + //------------------Grpc------------------ + //using (ConsulClient client = new ConsulClient(c => + //{ + // c.Address = new Uri($"http://{this._consulClientOptions.IP}:{this._consulClientOptions.Port}/"); + // c.Datacenter = this._consulClientOptions.Datacenter; + //})) + //{ + // var serviceId = $"{this._consulRegisterOptions.IP}:{grpcPort}-{this._consulRegisterOptions.GrpcGroupName}"; + + // await client.Agent.ServiceDeregister(serviceId, cancellationToken); + + // Console.WriteLine($"开始向Consul注册Grpc[{serviceId}]服务 ..."); + + // await client.Agent.ServiceRegister(new AgentServiceRegistration() + // { + // ID = serviceId,//唯一Id + // Name = this._consulRegisterOptions.GrpcGroupName,//组名称-Group + // Address = this._consulRegisterOptions.IP, + // Port = grpcPort, + // Tags = new string[] { "Grpc" }, + // Check = new AgentServiceCheck() + // { + // Interval = TimeSpan.FromSeconds(this._consulRegisterOptions.Interval), + // //HTTP = this._consulRegisterOption.HealthCheckUrl, + // GRPC = $"{this._consulRegisterOptions.IP}:{grpcPort}",//gRPC特有 + // GRPCUseTLS = false,//支持http + // Timeout = TimeSpan.FromSeconds(this._consulRegisterOptions.Timeout), + // DeregisterCriticalServiceAfter = TimeSpan.FromSeconds(this._consulRegisterOptions.DeregisterCriticalServiceAfter), + + // } + // }); + //} + } + + /// + /// 正常注销调用 + /// + /// + /// + public async Task StopAsync(CancellationToken cancellationToken) + { + var httpPort = this._consulRegisterOptions.Port; + //var grpcPort = Appsettings.app("GrpcPort"); + + + using (ConsulClient client = new ConsulClient(c => + { + c.Address = new Uri($"http://{this._consulClientOptions.IP}:{this._consulClientOptions.Port}/"); + c.Datacenter = this._consulClientOptions.Datacenter; + })) { + + + var serviceId = $"{this._consulRegisterOptions.GroupName}:{this._consulRegisterOptions.IP}-{httpPort}"; + + //var grpcServiceId = $"{this._consulRegisterOptions.GrpcGroupName}:{this._consulRegisterOptions.IP}-{grpcPort}"; + + await client.Agent.ServiceDeregister(serviceId, cancellationToken); + //await client.Agent.ServiceDeregister(grpcServiceId, cancellationToken); + Console.WriteLine($"开始Consul注销[{serviceId}]服务 ..."); + + } + + } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/SqlsugarExtension.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/SqlsugarExtension.cs index e48a59f4..42a88bd3 100644 --- a/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/SqlsugarExtension.cs +++ b/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/SqlsugarExtension.cs @@ -4,14 +4,16 @@ using SqlSugar; using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; using System.Text; using System.Threading.Tasks; +using Yi.Framework.Common.Models; namespace Yi.Framework.WebCore.MiddlewareExtend { public static class SqlsugarExtension { - public static void AddSqlsugarServer(this IServiceCollection services, Action action = null) + public static void AddSqlsugarServer(this IServiceCollection services, Action? action = null) { DbType dbType; var slavaConFig = new List(); @@ -49,9 +51,16 @@ namespace Yi.Framework.WebCore.MiddlewareExtend { EntityService = (c, p) => { - // int? decimal?这种 isnullable=true - if (c.PropertyType.IsGenericType && - c.PropertyType.GetGenericTypeDefinition() == typeof(Nullable<>)) + //// int? decimal?这种 isnullable=true + //if (c.PropertyType.IsGenericType && + //c.PropertyType.GetGenericTypeDefinition() == typeof(Nullable<>)) + //{ + // p.IsNullable = true; + //} + + //高版C#写法 支持string?和string + if (new NullabilityInfoContext() + .Create(c).WriteState is NullabilityState.Nullable) { p.IsNullable = true; } @@ -60,7 +69,7 @@ namespace Yi.Framework.WebCore.MiddlewareExtend }, db => { - if (action.IsNotNull()) + if (action is not null) { action(db); } @@ -95,10 +104,9 @@ namespace Yi.Framework.WebCore.MiddlewareExtend }; db.Aop.OnLogExecuting = (s, p) => { - //暂时先关闭sql打印 - if (false) + if (GobalModel.SqlLogEnable) { - var _logger = ServiceLocator.Instance.GetService>(); + var _logger = ServiceLocator.Instance?.GetRequiredService>(); StringBuilder sb = new StringBuilder(); sb.Append("执行SQL:" + s.ToString()); @@ -106,8 +114,7 @@ namespace Yi.Framework.WebCore.MiddlewareExtend { sb.Append($"\r\n参数:{i.ParameterName},参数值:{i.Value}"); } - - _logger.LogInformation(sb.ToString()); + _logger?.LogInformation(sb.ToString()); } diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/StaticPageExtension.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/StaticPageExtension.cs index 429fdce7..758244f6 100644 --- a/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/StaticPageExtension.cs +++ b/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/StaticPageExtension.cs @@ -31,7 +31,7 @@ namespace Yi.Framework.WebCore.MiddlewareExtend { if (this._supportDelete && "Delete".Equals(context.Request.Query["ActionHeader"])) { - this.DeleteHmtl(context.Request.Path.Value); + this.DeleteHmtl(context.Request.Path.Value??""); context.Response.StatusCode = 200; } else if (this._supportWarmup && "ClearAll".Equals(context.Request.Query["ActionHeader"])) @@ -52,7 +52,7 @@ namespace Yi.Framework.WebCore.MiddlewareExtend copyStream.Position = 0; var reader = new StreamReader(copyStream); var content = await reader.ReadToEndAsync(); - string url = context.Request.Path.Value; + string url = context.Request.Path.Value??""; this.SaveHmtl(url, content); diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/SwaggerExtension.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/SwaggerExtension.cs index 1c4bca99..d49d925c 100644 --- a/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/SwaggerExtension.cs +++ b/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/SwaggerExtension.cs @@ -31,6 +31,10 @@ namespace Yi.Framework.WebCore.MiddlewareExtend //为 Swagger JSON and UI设置xml文档注释路径 //获取应用程序所在目录(绝对路径,不受工作目录影响,建议采用此方法获取路径使用windwos&Linux) var basePath = Path.GetDirectoryName(typeof(Program).Assembly.Location); + if (basePath is null) + { + throw new Exception("未找到swagger文件"); + } var apiXmlPath = Path.Combine(basePath, @"Config/SwaggerDoc.xml");//控制器层注释 //var entityXmlPath = Path.Combine(basePath, @"SwaggerDoc.xml");//实体注释 //c.IncludeXmlComments(apiXmlPath, true);//true表示显示控制器注释 diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/ServiceLocator.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/ServiceLocator.cs index d6e235d2..8d72a516 100644 --- a/Yi.Framework.Net6/Yi.Framework.WebCore/ServiceLocator.cs +++ b/Yi.Framework.Net6/Yi.Framework.WebCore/ServiceLocator.cs @@ -7,14 +7,14 @@ namespace Yi.Framework.WebCore { public static class ServiceLocator { - public static IServiceProvider Instance { get; set; } + public static IServiceProvider? Instance { get; set; } public static string Admin { get; set; } = "cc"; - public static bool GetHttp(out HttpContext httpContext) + public static bool GetHttp(out HttpContext? httpContext) { httpContext = null; - var httpContextAccessor = Instance.GetService(); + var httpContextAccessor = Instance?.GetService(); if (httpContextAccessor is null) { return false; diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/SignalRHub/MainHub.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/SignalRHub/MainHub.cs index d1baf01f..f8f24f98 100644 --- a/Yi.Framework.Net6/Yi.Framework.WebCore/SignalRHub/MainHub.cs +++ b/Yi.Framework.Net6/Yi.Framework.WebCore/SignalRHub/MainHub.cs @@ -16,7 +16,7 @@ namespace Yi.Framework.WebCore.SignalRHub public static readonly List clientUsers = new(); - private HttpContext _httpContext; + private HttpContext? _httpContext; private ILogger _logger; public MainHub(IHttpContextAccessor httpContextAccessor,ILogger logger) { @@ -32,20 +32,20 @@ namespace Yi.Framework.WebCore.SignalRHub /// public override Task OnConnectedAsync() { - var name = _httpContext.GetUserNameInfo(); - var loginUser = _httpContext.GetLoginLogInfo(); + var name = _httpContext?.GetUserNameInfo(); + var loginUser = _httpContext?.GetLoginLogInfo(); var user = clientUsers.Any(u => u.ConnnectionId == Context.ConnectionId); //判断用户是否存在,否则添加集合 - if (!user && Context.User.Identity.IsAuthenticated) + if (!user && (Context.User?.Identity?.IsAuthenticated??false)) { OnlineUser users = new(Context.ConnectionId) { - Browser= loginUser.Browser, - LoginLocation = loginUser.LoginLocation, - Ipaddr= loginUser.LoginIp, + Browser= loginUser?.Browser, + LoginLocation = loginUser?.LoginLocation, + Ipaddr= loginUser?.LoginIp, LoginTime=DateTime.Now, - Os=loginUser.Os, - UserName= name + Os=loginUser?.Os, + UserName= name??"" }; clientUsers.Add(users); _logger.LogInformation($"{DateTime.Now}:{name},{Context.ConnectionId}连接服务端success,当前已连接{clientUsers.Count}个"); @@ -63,7 +63,7 @@ namespace Yi.Framework.WebCore.SignalRHub /// /// /// - public override Task OnDisconnectedAsync(Exception exception) + public override Task OnDisconnectedAsync(Exception? exception) { var user = clientUsers.Where(p => p.ConnnectionId == Context.ConnectionId).FirstOrDefault(); //判断用户是否存在,否则添加集合 diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/SignalRHub/OnlineUser.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/SignalRHub/OnlineUser.cs index 8b3259d2..ac58ab1a 100644 --- a/Yi.Framework.Net6/Yi.Framework.WebCore/SignalRHub/OnlineUser.cs +++ b/Yi.Framework.Net6/Yi.Framework.WebCore/SignalRHub/OnlineUser.cs @@ -19,18 +19,18 @@ namespace Yi.Framework.WebCore.SignalRHub /// /// 客户端连接Id /// - public string ConnnectionId { get; } + public string? ConnnectionId { get; } /// /// 用户id /// public long? UserId { get; set; } - public string UserName { get; set; } - public DateTime LoginTime { get; set; } - public string Ipaddr { get; set; } - public string LoginLocation { get; set; } + public string? UserName { get; set; } + public DateTime? LoginTime { get; set; } + public string? Ipaddr { get; set; } + public string? LoginLocation { get; set; } - public string Os { get; set; } - public string Browser { get; set; } + public string? Os { get; set; } + public string? Browser { get; set; } } diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/Yi.Framework.WebCore.csproj b/Yi.Framework.Net6/Yi.Framework.WebCore/Yi.Framework.WebCore.csproj index bc7336af..a24eeae2 100644 --- a/Yi.Framework.Net6/Yi.Framework.WebCore/Yi.Framework.WebCore.csproj +++ b/Yi.Framework.Net6/Yi.Framework.WebCore/Yi.Framework.WebCore.csproj @@ -2,6 +2,7 @@ net6.0 + enable diff --git a/Yi.Vue3.x.Vant/components.d.ts b/Yi.Vue3.x.Vant/components.d.ts index b04c459e..9709bee6 100644 --- a/Yi.Vue3.x.Vant/components.d.ts +++ b/Yi.Vue3.x.Vant/components.d.ts @@ -15,7 +15,6 @@ declare module '@vue/runtime-core' { RouterView: typeof import('vue-router')['RouterView'] VanActionSheet: typeof import('vant/es')['ActionSheet'] VanButton: typeof import('vant/es')['Button'] - VanCell: typeof import('vant/es')['Cell'] VanCellGroup: typeof import('vant/es')['CellGroup'] VanCol: typeof import('vant/es')['Col'] VanDivider: typeof import('vant/es')['Divider'] @@ -27,10 +26,11 @@ declare module '@vue/runtime-core' { VanList: typeof import('vant/es')['List'] VanLoading: typeof import('vant/es')['Loading'] VanNavBar: typeof import('vant/es')['NavBar'] - VanPopup: typeof import('vant/es')['Popup'] VanPullRefresh: typeof import('vant/es')['PullRefresh'] VanRow: typeof import('vant/es')['Row'] VanSticky: typeof import('vant/es')['Sticky'] + VanSwipe: typeof import('vant/es')['Swipe'] + VanSwipeItem: typeof import('vant/es')['SwipeItem'] VanTab: typeof import('vant/es')['Tab'] VanTabbar: typeof import('vant/es')['Tabbar'] VanTabbarItem: typeof import('vant/es')['TabbarItem'] diff --git a/Yi.Vue3.x.Vant/src/api/articleApi.ts b/Yi.Vue3.x.Vant/src/api/articleApi.ts index 24ad276c..c7ad11a1 100644 --- a/Yi.Vue3.x.Vant/src/api/articleApi.ts +++ b/Yi.Vue3.x.Vant/src/api/articleApi.ts @@ -3,7 +3,6 @@ import { ArticleEntity } from '@/type/interface/ArticleEntity' export default { add(data:any) { - console.log(data) return myaxios({ url: `/article/add`, method: 'post', diff --git a/Yi.Vue3.x.Vant/src/api/skuApi.ts b/Yi.Vue3.x.Vant/src/api/skuApi.ts new file mode 100644 index 00000000..5c268d36 --- /dev/null +++ b/Yi.Vue3.x.Vant/src/api/skuApi.ts @@ -0,0 +1,18 @@ +import myaxios from '@/utils/myaxios' + +export default { + add(data:any) { + return myaxios({ + url: `/sku/add`, + method: 'post', + data: data + }) + }, + pageList(data:any) { + return myaxios({ + url: '/sku/pageList', + method: 'get', + params: data + }) + } +} \ No newline at end of file diff --git a/Yi.Vue3.x.Vant/src/api/spuApi.ts b/Yi.Vue3.x.Vant/src/api/spuApi.ts new file mode 100644 index 00000000..9f52a64f --- /dev/null +++ b/Yi.Vue3.x.Vant/src/api/spuApi.ts @@ -0,0 +1,18 @@ +import myaxios from '@/utils/myaxios' + +export default { + add(data:any) { + return myaxios({ + url: `/spu/add`, + method: 'post', + data: data + }) + }, + pageList(data:any) { + return myaxios({ + url: '/spu/pageList', + method: 'get', + params: data + }) + } +} \ No newline at end of file diff --git a/Yi.Vue3.x.Vant/src/layout/bottom/index.vue b/Yi.Vue3.x.Vant/src/layout/bottom/index.vue index 0f607970..8f9bdbe3 100644 --- a/Yi.Vue3.x.Vant/src/layout/bottom/index.vue +++ b/Yi.Vue3.x.Vant/src/layout/bottom/index.vue @@ -35,7 +35,8 @@ let tabbar=ref([ {icon:"wap-home",to:"/",title:"主页"}, {icon:"location-o",to:"",title:"发现"}, {icon:"",to:"",title:""}, - {icon:"friends-o",to:"",title:"商城"}, + {icon:"friends-o",to:"/shopIndex",title:"商城"}, + // {icon:"friends-o",to:"",title:"商城"}, {icon:"setting-o",to:"/my",title:"我的"}, ]) const onChange=(index:number)=>{ @@ -43,7 +44,8 @@ const onChange=(index:number)=>{ {icon:"wap-home-o",to:"/",title:"主页"}, {icon:"location-o",to:"",title:"发现"}, {icon:"",to:"",title:""}, - {icon:"friends-o",to:"",title:"商城"}, + {icon:"friends-o",to:"/shopIndex",title:"商城"}, + // {icon:"friends-o",to:"",title:"商城"}, {icon:"setting-o",to:"/my",title:"我的"}, ]; tabbar.value[index].icon=tabbar.value[index].icon.replace("-o","") diff --git a/Yi.Vue3.x.Vant/src/layout/head/index.vue b/Yi.Vue3.x.Vant/src/layout/head/index.vue new file mode 100644 index 00000000..d012f2e0 --- /dev/null +++ b/Yi.Vue3.x.Vant/src/layout/head/index.vue @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/Yi.Vue3.x.Vant/src/router/index.ts b/Yi.Vue3.x.Vant/src/router/index.ts index 4337c530..2ea52cdf 100644 --- a/Yi.Vue3.x.Vant/src/router/index.ts +++ b/Yi.Vue3.x.Vant/src/router/index.ts @@ -1,14 +1,20 @@ import { createWebHistory, createRouter } from 'vue-router'; import Layout from '@/layout/index.vue'; +import HeadLayout from '@/layout/head/index.vue' export const constantRoutes = [ - + { name:'Layout', path: '/', component: Layout, redirect:"/recommend", children: [ + { + path: '/shopIndex', + component: () => import('@/view/shop/shopIndex.vue'), + name: 'ShopIndex', + }, { path: '/my', component: () => import('@/view/my.vue'), @@ -49,6 +55,25 @@ export const constantRoutes = [ component: () => import('@/view/login.vue'), name: 'Login', }, + + { + name:'Shop', + path: '/shop', + component: HeadLayout, + redirect:"/shopIndex", + children: [ + { + path: '/shopDetails', + component: () => import('@/view/shop/shopDetails.vue'), + name: 'ShopDetails', + }, + { + path: '/shopSearch', + component: () => import('@/view/shop/shopSearch.vue'), + name: 'ShopSearch', + }, + ] + } ]; const router = createRouter({ diff --git a/Yi.Vue3.x.Vant/src/utils/myaxios.ts b/Yi.Vue3.x.Vant/src/utils/myaxios.ts index fbcd51fd..b25bde49 100644 --- a/Yi.Vue3.x.Vant/src/utils/myaxios.ts +++ b/Yi.Vue3.x.Vant/src/utils/myaxios.ts @@ -42,7 +42,15 @@ myaxios.interceptors.request.use(function(config:any) { myaxios.interceptors.response.use(async function(response) { //成功 const resp = response.data - + if(resp.code==401) + { + Notify({ type: 'warning', message: '登录过期' }); + //登出 + useUserStore().logOut().then(() => { + location.href = '/'; + }) + isRelogin.show = false; + } // store.dispatch("closeLoad"); return resp; }, async function(error) { diff --git a/Yi.Vue3.x.Vant/src/view/shop/shopDetails.vue b/Yi.Vue3.x.Vant/src/view/shop/shopDetails.vue new file mode 100644 index 00000000..f99b463c --- /dev/null +++ b/Yi.Vue3.x.Vant/src/view/shop/shopDetails.vue @@ -0,0 +1,5 @@ + + 这里是商品详情页 + + 返回商品首页 + \ No newline at end of file diff --git a/Yi.Vue3.x.Vant/src/view/shop/shopIndex.vue b/Yi.Vue3.x.Vant/src/view/shop/shopIndex.vue new file mode 100644 index 00000000..5880c164 --- /dev/null +++ b/Yi.Vue3.x.Vant/src/view/shop/shopIndex.vue @@ -0,0 +1,23 @@ + + 这里是商城主页 + + 1 + 2 + 3 + 4 + + + + + 点击前往搜索 + + + \ No newline at end of file diff --git a/Yi.Vue3.x.Vant/src/view/shop/shopSearch.vue b/Yi.Vue3.x.Vant/src/view/shop/shopSearch.vue new file mode 100644 index 00000000..1bab92f2 --- /dev/null +++ b/Yi.Vue3.x.Vant/src/view/shop/shopSearch.vue @@ -0,0 +1,37 @@ + + 这里是商品搜索页 + + 点击进入商品详情 + + 返回商品首页 +这个是spu: +商品名称:{{item.spuName}} + 规格组: {{spec.specsGroupName}} + 规格值: {{name}} + + + + + + + + + + \ No newline at end of file