From 1c9e9931948cc894f8f5295d344548049612ca61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com> Date: Sun, 24 Apr 2022 23:09:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=9A=E5=8A=A1=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WebFirst/database/sqlite.db | Bin 139264 -> 143360 bytes .../Config/SwaggerDoc.xml | 10 +++ .../Controllers/AccountController.cs | 3 + .../Controllers/MenuController.cs | 28 +++++++ .../Controllers/TestController.cs | 3 + .../Yi.Framework.ApiMicroservice/Program.cs | 2 +- .../yi-sqlsugar-dev.db | Bin 69632 -> 86016 bytes .../{IUserRoleService.cs => IMenuService.cs} | 2 +- .../Yi.Framework.Model/MenuEntity.cs | 15 ++++ .../Yi.Framework.Model/Models/MenuEntity.cs | 74 ++++++++++++++++++ .../Yi.Framework.Model/Models/RoleEntity.cs | 2 +- .../Models/RoleMenuEntity.cs | 64 +++++++++++++++ .../Yi.Framework.Model/Models/TenantEntity.cs | 59 ++++++++++++++ .../Yi.Framework.Model/Models/UserEntity.cs | 2 +- .../Models/UserRoleEntity.cs | 2 +- .../{UserRoleService.cs => MenuService.cs} | 4 +- 16 files changed, 263 insertions(+), 7 deletions(-) create mode 100644 Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs rename Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/{IUserRoleService.cs => IMenuService.cs} (61%) create mode 100644 Yi.Framework.Net6/Yi.Framework.Model/MenuEntity.cs create mode 100644 Yi.Framework.Net6/Yi.Framework.Model/Models/MenuEntity.cs create mode 100644 Yi.Framework.Net6/Yi.Framework.Model/Models/RoleMenuEntity.cs create mode 100644 Yi.Framework.Net6/Yi.Framework.Model/Models/TenantEntity.cs rename Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/{UserRoleService.cs => MenuService.cs} (50%) diff --git a/WebFirst/database/sqlite.db b/WebFirst/database/sqlite.db index d3374e00bcc0c64656b2b418b4721b318bfd33f7..a242e04be221acdf35ef35e3fd9cf091ce9c635e 100644 GIT binary patch delta 1372 zcmZWpYfKzf6rMXXyED76aj0cmRH$S5?ESx8={Hw zNUv$B#?l))Vk)#hghoPQ-Oz2dz7pG*G&P_NwMHZI-14w#s=v_0nH{iNC%O0BoH^fj zzH`sX?fR1Lnx;>rJk*6@SeCjrK7U`XXz0RhrRUB!#pVGo>d3Qzxln&z%STnjQ`i;^ zVM4#)Gd>nU%v$EIOR+eK1n9b&k<|j>)rb8wJ{VwgIrm3S;s`0Y1!VobWHN=vi zkh_ULF+?20?%@%<7k>0VK!X%cn+7Qe}9wM$l~l;ITJcDq|F zuu1t&Npwl*?!p##ZOOmmE8ALp+KP;vj2!zoa`v3l?tB35u-P4sLYJdZgO@aVRd{mp zdb(<#zri2W_r;N+g`?pID4g#6BDbU|5M55ug)$>sIgiRI;jV;%QN+aI@)Uy;stt<72TWLVVavjQD4TR3DiU3_-sS7#p zd>8YuNw}sBOqQ@F{2|;CZVR)*&%#Y%Qn)sr2F3)V`tK1~8J-k?D}$o=4_S(x2+1+s z=5U`I+{3|}3M>XaWOoLL(N1qE{$fCd2TQ>I$xao!7rTWCg#w{Y*=fFo&*u%?x7_<& zJNE>a%TerY_7dB}Rc9>VgWc+rQwRxGD)R3@ zBxNgnUdg-)vXz60IGH79x2?&iv1>LE zY;X1-5DVmV`0NH>oGzjI)q~M6%{Kdk@@DwVMua6z4=HbGjfQCUAEpFY7S#ykaAqt% z1j0At@QaKxn2tB*a%vM}*l)G0zHmwz``s<_jOQ?P&<0{w| zy6dBLn2B94V37m*^E7K?BSFjeWZOw zPwikc_==xrcWA3~FXP(%-%a%!rNO2i7f69jGc`q=AZt+iLz8{9RFd)$sF z0HD~$zuDPa>gS@sTUvK5oa=*CwA1H-kK=v5wxL?i4;H`?hV&6r8P#H%Q@yB`%1BX_ zsB}m?CwlQ6yhG4o5-A2!TiYamnQ0#k&-o?}Z zLBhAk<{=p*k^}||1&4M;5tOHP+1*m2*Mi>=?CF;);W1aY3lczffejdo&VqVd(O7A1 z?7y@OwkD2O!dUVkGYslc5g;YncWp#Fu5Hp5s?+KN^@O@r4X7SvMtPxJQ96`rMUh|1 zL-HAUyKG3a(i3SwYL}`dBF>0O@v?Y8Y!nxZdH4r@g>T}cIE+I$&(3^P$dKKnikufl zg{#78p;hqlGyEfdfZxZjOiTx!39*>Bz>VcrH|9k;z F`2&p8+U5WN diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml index de809849..94301420 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml @@ -4,6 +4,11 @@ Yi.Framework.ApiMicroservice + + + 账户控制器 + + Json To Sql 类比模式,通用模型 @@ -63,6 +68,11 @@ + + + 测试控制器 + + 仓储上下文对象测试 diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs index 365c5339..85f12094 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs @@ -17,6 +17,9 @@ using Yi.Framework.WebCore.AuthorizationPolicy; namespace Yi.Framework.ApiMicroservice.Controllers { + /// + /// 账户控制器 + /// [ApiController] [Route("api/[controller]/[action]")] public class AccountController :ControllerBase diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs new file mode 100644 index 00000000..0de84e65 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/MenuController.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 MenuController : BaseCrudController + { + private IMenuService _iMenuService; + public MenuController(ILogger logger, IMenuService iMenuService) : base(logger, iMenuService) + { + _iMenuService = iMenuService; + } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs index bec2e480..f8ecd6b6 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs @@ -19,6 +19,9 @@ using Yi.Framework.WebCore.AuthorizationPolicy; namespace Yi.Framework.ApiMicroservice.Controllers { + /// + /// 测试控制器 + /// [ApiController] [Route("api/[controller]/[action]")] public class TestController : ControllerBase diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Program.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Program.cs index a2623cf8..63e6ac9d 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Program.cs +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Program.cs @@ -130,7 +130,7 @@ ServiceLocator.Instance = app.Services; #region //ץȡע #endregion -//app.UseErrorHandlingService(); +app.UseErrorHandlingService(); #region //̬ļע #endregion 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 906d48707b349476aa402db41416b93284a1eb7e..19b0cca79cf28f8f6f8eb71cc148dcb85e863213 100644 GIT binary patch delta 617 zcmZozz|ydQb%L~@5d#B*C=kN{-$Wf_QzHgF_Z7TAArXet41C3WUcAaYpSYiL@8JsM z;^SD%k-+wqZ4;|ID+}{H=2E5zCT)h(jK3yMG&gI~5oH&bm1S(vE=f$vNe#-+N%c+5 zD}~V_&Oxq@A+8D`j!r(V3Q92H$$GrnlSR0N*+6PNQzqB*ichZQwVLeD$u^mTKZZj= zQ(uft+*x*V0*{0wOjEoej3ufq!X|Dn36ixBNzF^lD~UIR(85hp!tCObl8i0AX8buj7VM?c@QI{vLIDSAv3Q;!7tRuM?pb{mrDsG?wp@8Ifhq~BOtLTHLnCS zC?RfsB&{c$}DaO@hk=i|i-FIH|2)@bK0#g< zo+})IJW*`Vc=%Z@*cLN)v3v!=&58p5m^Qn!<}glXWp&y7oh^%T@@6)d%}Y5l88-)V zWizsH-(vVaSyABgW@TP=MlPNp22*iSQO4%L$?v(9IoSBwfYvfFOiti%=HQvjzyap) zaXGW_{ADl)YBQd^hg*}K{|5uRxUB5vr`&don~V8+8JX0XChy~xnJmD|!XIxKTAW(M f4AcqMy+|NovtYq{{)rnTSQ$Zr5MBW5q6rNEEY3Zc diff --git a/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/IUserRoleService.cs b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/IMenuService.cs similarity index 61% rename from Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/IUserRoleService.cs rename to Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/IMenuService.cs index a299d0af..413a0ade 100644 --- a/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/IUserRoleService.cs +++ b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/IMenuService.cs @@ -3,7 +3,7 @@ using Yi.Framework.Repository; namespace Yi.Framework.Interface { - public partial interface IUserRoleService:IBaseService + public partial interface IMenuService:IBaseService { } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/MenuEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/MenuEntity.cs new file mode 100644 index 00000000..96e7dfee --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Model/MenuEntity.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using SqlSugar; +namespace Yi.Framework.Model.Models +{ + /// + /// 菜单表 + /// + public partial class MenuEntity + { + [SqlSugar.SugarColumn(IsIgnore = true)] + public List Childs { get; set; } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Model/Models/MenuEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/Models/MenuEntity.cs new file mode 100644 index 00000000..ddc0db69 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Model/Models/MenuEntity.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using SqlSugar; +namespace Yi.Framework.Model.Models +{ + /// + /// 菜单表 + /// + [SugarTable("Menu")] + public partial class MenuEntity:IBaseModelEntity + { + public MenuEntity() + { + this.IsDeleted = false; + this.CreateTime = DateTime.Now; + } + /// + /// 1 + /// + [SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )] + public long Id { get; set; } + /// + /// + /// + [SugarColumn(ColumnName="MenuName" )] + public string MenuName { get; set; } + /// + /// + /// + [SugarColumn(ColumnName="MenuType" )] + public int? MenuType { get; set; } + /// + /// + /// + [SugarColumn(ColumnName="MenuCode" )] + public string PermissionCode { get; set; } + /// + /// + /// + [SugarColumn(ColumnName="ParentId" )] + public long? ParentId { 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; } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Model/Models/RoleEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/Models/RoleEntity.cs index e1b490db..346f7b23 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/Models/RoleEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/Models/RoleEntity.cs @@ -5,7 +5,7 @@ using SqlSugar; namespace Yi.Framework.Model.Models { /// - /// + /// 角色表 /// [SugarTable("Role")] public partial class RoleEntity:IBaseModelEntity diff --git a/Yi.Framework.Net6/Yi.Framework.Model/Models/RoleMenuEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/Models/RoleMenuEntity.cs new file mode 100644 index 00000000..a7b4d03d --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Model/Models/RoleMenuEntity.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using SqlSugar; +namespace Yi.Framework.Model.Models +{ + /// + /// 角色菜单关系表 + /// + [SugarTable("RoleMenu")] + public partial class RoleMenuEntity:IBaseModelEntity + { + public RoleMenuEntity() + { + this.IsDeleted = false; + this.CreateTime = DateTime.Now; + } + /// + /// 1 + /// + [SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )] + public long Id { get; set; } + /// + /// + /// + [SugarColumn(ColumnName="RoleId" )] + public long? RoleId { get; set; } + /// + /// + /// + [SugarColumn(ColumnName="MenuId" )] + public long? MenuId { 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; } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Model/Models/TenantEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/Models/TenantEntity.cs new file mode 100644 index 00000000..c052ec3d --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Model/Models/TenantEntity.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using SqlSugar; +namespace Yi.Framework.Model.Models +{ + /// + /// 租户表 + /// + [SugarTable("Tenant")] + public partial class TenantEntity:IBaseModelEntity + { + public TenantEntity() + { + this.IsDeleted = false; + this.CreateTime = DateTime.Now; + } + /// + /// 1 + /// + [SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )] + public long Id { get; set; } + /// + /// + /// + [SugarColumn(ColumnName="TenantName" )] + public string TenantName { 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; } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Model/Models/UserEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/Models/UserEntity.cs index 2936acb4..074ad70d 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/Models/UserEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/Models/UserEntity.cs @@ -5,7 +5,7 @@ using SqlSugar; namespace Yi.Framework.Model.Models { /// - /// + /// 用户表 /// [SugarTable("User")] public partial class UserEntity:IBaseModelEntity diff --git a/Yi.Framework.Net6/Yi.Framework.Model/Models/UserRoleEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/Models/UserRoleEntity.cs index e686a840..a974bd17 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/Models/UserRoleEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/Models/UserRoleEntity.cs @@ -5,7 +5,7 @@ using SqlSugar; namespace Yi.Framework.Model.Models { /// - /// + /// 用户角色关系表 /// [SugarTable("UserRole")] public partial class UserRoleEntity:IBaseModelEntity diff --git a/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/UserRoleService.cs b/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/MenuService.cs similarity index 50% rename from Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/UserRoleService.cs rename to Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/MenuService.cs index d48f838e..cee44d82 100644 --- a/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/UserRoleService.cs +++ b/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/MenuService.cs @@ -5,9 +5,9 @@ using Yi.Framework.Repository; namespace Yi.Framework.Service { - public partial class UserRoleService : BaseService, IUserRoleService + public partial class MenuService : BaseService, IMenuService { - public UserRoleService(IRepository repository) : base(repository) + public MenuService(IRepository repository) : base(repository) { } }