diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs index 4885be3b..bfdc2523 100644 --- a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs +++ b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs @@ -92,5 +92,15 @@ namespace Yi.Framework.ApiMicroservice.Controllers var menuList= await _userService.GetMenusByUser(_user); return Result.Success().SetData(menuList); } + + /// + /// 给一个菜单添加子节点(注意:添加,不是覆盖) + /// + /// + /// + [HttpPost] + public async Task AddChildrenMenu(ChildrenDto childrenDto) + { + } } } diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/UserController.cs b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/UserController.cs index 277b79d2..a1d38072 100644 --- a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/UserController.cs +++ b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/UserController.cs @@ -92,6 +92,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers [HttpPost] public async Task SetRoleByUser(IdsListDto idsListDto) { + 有bug:无法运行,500报错; var _user = this.HttpContext.GetCurrentUserInfo(); await _userService.SetRolesByUser(idsListDto.ids2, idsListDto.ids1); return Result.Success(); diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/SwaggerDoc.xml b/Yi.Framework/Yi.Framework.ApiMicroservice/SwaggerDoc.xml index c81b652a..eee596b1 100644 --- a/Yi.Framework/Yi.Framework.ApiMicroservice/SwaggerDoc.xml +++ b/Yi.Framework/Yi.Framework.ApiMicroservice/SwaggerDoc.xml @@ -53,6 +53,19 @@ + + + 给一个菜单设置一个接口,Id1为菜单id,Id2为接口id + + + + + + + 得到该用户有哪些菜单,关联mould + + + 更 @@ -95,6 +108,13 @@ + + + 给角色设置菜单,多个角色与多个菜单,让每一个角色都设置,ids1为角色,ids2为菜单 + + + + 查 @@ -128,6 +148,13 @@ + + + 给多个用户设置多个角色,ids有用户id与 角色列表ids,多对多,ids1用户,ids2为角色 + + + + 必须实现IHostingStartup接口 diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/Utility/CustomAutofacModule.cs b/Yi.Framework/Yi.Framework.ApiMicroservice/Utility/CustomAutofacModule.cs index 54bc78c3..502f06a0 100644 --- a/Yi.Framework/Yi.Framework.ApiMicroservice/Utility/CustomAutofacModule.cs +++ b/Yi.Framework/Yi.Framework.ApiMicroservice/Utility/CustomAutofacModule.cs @@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Reflection; using System.Threading.Tasks; @@ -21,19 +22,19 @@ namespace Yi.Framework.ApiMicroservice.Utility { protected override void Load(ContainerBuilder containerBuilder) { - //var assembly = this.GetType().GetTypeInfo().Assembly; - //var builder = new ContainerBuilder(); - //var manager = new ApplicationPartManager(); - //manager.ApplicationParts.Add(new AssemblyPart(assembly)); - //manager.FeatureProviders.Add(new ControllerFeatureProvider()); - //var feature = new ControllerFeature(); - //manager.PopulateFeature(feature); - //builder.RegisterType().AsSelf().SingleInstance(); - //builder.RegisterTypes(feature.Controllers.Select(ti => ti.AsType()).ToArray()).PropertiesAutowired(); - - //containerBuilder.RegisterType().As().InstancePerDependency(); 瞬态 - //containerBuilder.RegisterType().As().SingleInstance(); 单例 - //containerBuilder.RegisterType().As().InstancePerLifetimeScope(); 作用域 + var basePath = AppContext.BaseDirectory; + var servicesDllFile = Path.Combine(basePath, "Yi.Framework.Service.dll"); + if (!(File.Exists(servicesDllFile))) + { + var msg = "service.dll 丢失,请编译后重新生成。"; + throw new Exception(msg); + } + var assemblysServices = Assembly.LoadFrom(servicesDllFile); + containerBuilder.RegisterAssemblyTypes(assemblysServices) + .AsImplementedInterfaces() + .InstancePerDependency() + .EnableInterfaceInterceptors(); + containerBuilder.Register(c => new CustomAutofacAop());//AOP注册 //containerBuilder.RegisterType().As().EnableInterfaceInterceptors();开启Aop @@ -41,10 +42,9 @@ namespace Yi.Framework.ApiMicroservice.Utility //将数据库对象注入 //containerBuilder.RegisterType().As().InstancePerLifetimeScope().EnableInterfaceInterceptors(); - containerBuilder.RegisterGeneric(typeof(BaseService<>)).As(typeof(IBaseService<>)).InstancePerLifetimeScope().EnableInterfaceInterceptors(); + //containerBuilder.RegisterGeneric(typeof(BaseService<>)).As(typeof(IBaseService<>)).InstancePerDependency().EnableInterfaceInterceptors(); - containerBuilder.RegisterType().As< IUserService >().InstancePerLifetimeScope().EnableInterfaceInterceptors(); - containerBuilder.RegisterType().As().InstancePerLifetimeScope().EnableInterfaceInterceptors(); + } diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/YIDB.db b/Yi.Framework/Yi.Framework.ApiMicroservice/YIDB.db index 485bdae7..8932385e 100644 Binary files a/Yi.Framework/Yi.Framework.ApiMicroservice/YIDB.db and b/Yi.Framework/Yi.Framework.ApiMicroservice/YIDB.db differ diff --git a/Yi.Framework/Yi.Framework.DTOModel/ChildrenDto.cs b/Yi.Framework/Yi.Framework.DTOModel/ChildrenDto.cs new file mode 100644 index 00000000..18ee3742 --- /dev/null +++ b/Yi.Framework/Yi.Framework.DTOModel/ChildrenDto.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.Framework.DTOModel +{ + public class ChildrenDto + { + public int parentId { get; set; } + public T data { get; set; } + } +} diff --git a/Yi.Framework/Yi.Framework.Interface/Yi - Backup.Framework.Interface.csproj b/Yi.Framework/Yi.Framework.Interface/Yi - Backup.Framework.Interface.csproj new file mode 100644 index 00000000..289ee267 --- /dev/null +++ b/Yi.Framework/Yi.Framework.Interface/Yi - Backup.Framework.Interface.csproj @@ -0,0 +1,19 @@ + + + + net5.0 + + + + + + + + + + + + + + + diff --git a/Yi.Framework/Yi.Framework.Interface/Yi.Framework.Interface.csproj b/Yi.Framework/Yi.Framework.Interface/Yi.Framework.Interface.csproj index 289ee267..4a1fafcd 100644 --- a/Yi.Framework/Yi.Framework.Interface/Yi.Framework.Interface.csproj +++ b/Yi.Framework/Yi.Framework.Interface/Yi.Framework.Interface.csproj @@ -12,8 +12,23 @@ + + + T4IService.cs + TextTemplatingFileGenerator + + + + + + True + True + T4IService.tt + + + diff --git a/Yi.Framework/Yi.Framework.Model/Yi - Backup.Framework.Model.csproj b/Yi.Framework/Yi.Framework.Model/Yi - Backup.Framework.Model.csproj new file mode 100644 index 00000000..7cfe4b70 --- /dev/null +++ b/Yi.Framework/Yi.Framework.Model/Yi - Backup.Framework.Model.csproj @@ -0,0 +1,23 @@ + + + + net5.0 + + + + + + + + + + + + + + + + + + + diff --git a/Yi.Framework/Yi.Framework.Model/Yi.Framework.Model.csproj b/Yi.Framework/Yi.Framework.Model/Yi.Framework.Model.csproj index 7cfe4b70..92106451 100644 --- a/Yi.Framework/Yi.Framework.Model/Yi.Framework.Model.csproj +++ b/Yi.Framework/Yi.Framework.Model/Yi.Framework.Model.csproj @@ -16,8 +16,23 @@ + + + TextTemplatingFileGenerator + T4DaraContext.cs + + + + + + True + True + T4DaraContext.tt + + + diff --git a/Yi.Framework/Yi.Framework.Service/Yi - Backup.Framework.Service.csproj b/Yi.Framework/Yi.Framework.Service/Yi - Backup.Framework.Service.csproj new file mode 100644 index 00000000..c54fe835 --- /dev/null +++ b/Yi.Framework/Yi.Framework.Service/Yi - Backup.Framework.Service.csproj @@ -0,0 +1,20 @@ + + + + net5.0 + + + + + + + + + + + + + + + + diff --git a/Yi.Framework/Yi.Framework.Service/Yi.Framework.Service.csproj b/Yi.Framework/Yi.Framework.Service/Yi.Framework.Service.csproj index c54fe835..104a6f4d 100644 --- a/Yi.Framework/Yi.Framework.Service/Yi.Framework.Service.csproj +++ b/Yi.Framework/Yi.Framework.Service/Yi.Framework.Service.csproj @@ -13,8 +13,23 @@ + + + T4Service.cs + TextTemplatingFileGenerator + + + + + + True + True + T4Service.tt + + + diff --git a/Yi.Vue/src/api/MenuApi.js b/Yi.Vue/src/api/MenuApi.js new file mode 100644 index 00000000..ad489f0d --- /dev/null +++ b/Yi.Vue/src/api/MenuApi.js @@ -0,0 +1,9 @@ +import myaxios from '@/util/myaxios' +export default { + getMenu() { + return myaxios({ + url: '/Menu/GetMenu', + method: 'get' + }) + }, +} \ No newline at end of file diff --git a/Yi.Vue/src/api/accountApi.js b/Yi.Vue/src/api/accountApi.js index 7c33252c..fa7645e4 100644 --- a/Yi.Vue/src/api/accountApi.js +++ b/Yi.Vue/src/api/accountApi.js @@ -16,12 +16,6 @@ export default { method: 'post', }) }, - logged() { - return myaxios({ - url: '/Account/logged', - method: 'post', - }) - }, register(username, password, email, code) { return myaxios({ url: `/Account/register?code=${code}`, diff --git a/Yi.Vue/src/api/actionApi.js b/Yi.Vue/src/api/actionApi.js deleted file mode 100644 index 902f625f..00000000 --- a/Yi.Vue/src/api/actionApi.js +++ /dev/null @@ -1,30 +0,0 @@ -import myaxios from '@/util/myaxios' -export default { - getActions() { - return myaxios({ - url: '/Action/getActions', - method: 'get' - }) - }, - addAction(action) { - return myaxios({ - url: '/action/addAction', - method: 'post', - data: action - }) - }, - updateAction(action) { - return myaxios({ - url: '/action/UpdateAction', - method: 'post', - data: action - }) - }, - delActionList(Ids) { - return myaxios({ - url: '/action/DelAllAction', - method: 'post', - data: Ids - }) - }, -} \ No newline at end of file diff --git a/Yi.Vue/src/api/roleApi.js b/Yi.Vue/src/api/roleApi.js index b539ee43..9969b632 100644 --- a/Yi.Vue/src/api/roleApi.js +++ b/Yi.Vue/src/api/roleApi.js @@ -1,50 +1,9 @@ import myaxios from '@/util/myaxios' export default { - getRoles() { + getRole() { return myaxios({ - url: '/Role/getRoles', - method: 'get' - }) - }, - AddRole(role) { - return myaxios({ - url: '/Role/AddRole', - method: 'post', - data: role - }) - }, - delRole(roleId) { - return myaxios({ - url: `/Role/DelRole?roleId=${roleId}`, - method: 'get' - }) - }, - updateRole(role) { - return myaxios({ - url: '/role/updateRole', - method: 'post', - data: role - }) - }, - delRoleList(Ids) { - return myaxios({ - url: '/role/delAllRole', - method: 'post', - data: Ids - }) - }, - setAction(Id, Ids) { - return myaxios({ - url: '/role/setAction', - method: 'post', - data: { "Id": Id, "Ids": Ids } - }) - }, - GetActionByRoleId(roleId) { - return myaxios({ - url: `/role/GetActionByRoleId?roleId=${roleId}`, + url: '/Role/getRole', method: 'get' }) } - } \ No newline at end of file diff --git a/Yi.Vue/src/api/userApi.js b/Yi.Vue/src/api/userApi.js index 99329ebe..48e22061 100644 --- a/Yi.Vue/src/api/userApi.js +++ b/Yi.Vue/src/api/userApi.js @@ -1,101 +1,10 @@ import myaxios from '@/util/myaxios' export default { - getAllUser() { + SetRoleByUser(userIds, roleIds) { return myaxios({ - url: '/User/getAllUser', - method: 'get' - }) - }, - getUserByUserId(userId) { - if (userId == undefined) { - userId = 0; - } - return myaxios({ - url: `/User/getUserByUserId?userId=${userId}`, - method: 'get' - }) - }, - - addUser(user) { - return myaxios({ - url: '/User/addUser', + url: '/User/SetRoleByUser', method: 'post', - data: user + data: { "ids1": userIds, "ids2": roleIds } }) }, - delUser(userId) { - return myaxios({ - url: `/User/delUser?userId=${userId}`, - method: 'get' - }) - }, - updateUser(user) { - return myaxios({ - url: '/User/updateUser', - method: 'post', - data: user - }) - }, - tryUpdateUser(form) { - return myaxios({ - url: '/User/tryUpdateUser', - method: 'post', - data: form - }) - }, - - delUserList(Ids) { - return myaxios({ - url: '/User/delAllUser', - method: 'post', - data: Ids - }) - }, - setRole(Id, Ids) { - return myaxios({ - url: '/User/setRole', - method: 'post', - data: { "Id": Id, "Ids": Ids } - }) - }, - - setRoleList(userIds, roleIds) { - return myaxios({ - url: '/User/setRoleList', - method: 'post', - data: { "userIds": userIds, "roleIds": roleIds } - }) - }, - getRoleByuserId(userId) { - if (userId == undefined) { - userId = 0; - } - return myaxios({ - url: `/User/getRoleByuserId?userId=${userId}`, - method: 'get' - }) - }, - getSpecialAction(userId) { - return myaxios({ - url: `/User/getSpecialAction?userId=${userId}`, - method: 'get' - }) - }, - setSpecialAction(Id, Ids) { - return myaxios({ - url: '/User/setSpecialAction', - method: 'post', - data: { "Id": Id, "Ids": Ids } - }) - }, - getActionByUserId(userId) { - if (userId == undefined) { - userId = 0; - } - return myaxios({ - url: `/User/getActionByUserId?userId=${userId}`, - method: 'get' - }) - } - } \ No newline at end of file diff --git a/Yi.Vue/src/components/ccCombobox.vue b/Yi.Vue/src/components/ccCombobox.vue index 6ff86779..623fab60 100644 --- a/Yi.Vue/src/components/ccCombobox.vue +++ b/Yi.Vue/src/components/ccCombobox.vue @@ -14,7 +14,6 @@ 关闭 - 保存 +
diff --git a/Yi.Vue/src/components/ccTable.vue b/Yi.Vue/src/components/ccTable.vue index 0442e063..5b7c3392 100644 --- a/Yi.Vue/src/components/ccTable.vue +++ b/Yi.Vue/src/components/ccTable.vue @@ -86,6 +86,9 @@ @@ -113,6 +118,7 @@ \ No newline at end of file diff --git a/Yi.Vue/src/views/AdmMenu.vue b/Yi.Vue/src/views/AdmMenu.vue index e65a1523..64241949 100644 --- a/Yi.Vue/src/views/AdmMenu.vue +++ b/Yi.Vue/src/views/AdmMenu.vue @@ -1,47 +1,29 @@ \ No newline at end of file diff --git a/Yi.Vue/src/views/AdmMould.vue b/Yi.Vue/src/views/AdmMould.vue index cd7449a2..ef77f35c 100644 --- a/Yi.Vue/src/views/AdmMould.vue +++ b/Yi.Vue/src/views/AdmMould.vue @@ -8,20 +8,20 @@ export default { data: () => ({ axiosUrls:{ - get:"role/getrole", - update:"role/updaterole", - del:"role/delListrole", - add:"role/addrole" + get:"mould/getmould", + update:"mould/updatemould", + del:"mould/delListmould", + add:"mould/addmould" }, headers: [ {text: "编号",align: "start",value: "id"}, - { text: "角色名", value: "role_name", sortable: false }, - { text: "简介", value: "introduce", sortable: false }, + { text: "接口名", value: "mould_name", sortable: false }, + { text: "接口地址", value: "url", sortable: false }, { text: "操作", value: "actions", sortable: false } ], defaultItem: { - role_name: "test", - introduce: "用于测试", + mould_name: "test", + url: "test/test", }, }), }; diff --git a/Yi.Vue/src/views/AdmRoleMenu.vue b/Yi.Vue/src/views/AdmRoleMenu.vue index 14b6d1ec..8e16bb2f 100644 --- a/Yi.Vue/src/views/AdmRoleMenu.vue +++ b/Yi.Vue/src/views/AdmRoleMenu.vue @@ -1,8 +1,11 @@ \ No newline at end of file diff --git a/Yi.Vue/src/views/AdmUser.vue b/Yi.Vue/src/views/AdmUser.vue index 107c2619..d69a1527 100644 --- a/Yi.Vue/src/views/AdmUser.vue +++ b/Yi.Vue/src/views/AdmUser.vue @@ -1,24 +1,84 @@