diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml
index 5b5ff7b2..bc81ce88 100644
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml
+++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml
@@ -141,6 +141,13 @@
菜单管理
+
+
+ 动态条件查询全部
+
+
+
+
得到树形菜单
@@ -152,6 +159,12 @@
角色管理
+
+
+ 动态条件分页查询
+
+
+
给多用户设置多角色
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs
index dd32986a..81ab9f17 100644
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs
+++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs
@@ -20,7 +20,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
///
[ApiController]
[Route("api/[controller]/[action]")]
- public class MenuController
+ public class MenuController
{
private IMenuService _iMenuService;
public MenuController(ILogger logger, IMenuService iMenuService)
@@ -28,10 +28,16 @@ namespace Yi.Framework.ApiMicroservice.Controllers
_iMenuService = iMenuService;
}
+
+ ///
+ /// 动态条件查询全部
+ ///
+ ///
+ ///
[HttpGet]
- public async Task GetList()
+ public async Task GetList([FromQuery] MenuEntity menu)
{
- return Result.Success().SetData(await _iMenuService._repository.GetListAsync());
+ return Result.Success().SetData(await _iMenuService.SelctGetList(menu));
}
@@ -41,8 +47,8 @@ namespace Yi.Framework.ApiMicroservice.Controllers
///
[HttpGet]
public async Task GetMenuTree()
- {
- return Result.Success().SetData(await _iMenuService. GetMenuTreeAsync());
+ {
+ return Result.Success().SetData(await _iMenuService.GetMenuTreeAsync());
}
}
}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs
index cefe4d83..57b2bc89 100644
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs
+++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs
@@ -29,12 +29,17 @@ namespace Yi.Framework.ApiMicroservice.Controllers
_iRoleService = iRoleService;
}
+ ///
+ /// 动态条件分页查询
+ ///
+ ///
[HttpGet]
- public async Task PageList()
+ public async Task PageList([FromQuery] RoleEntity role, [FromQuery] PageParModel page)
{
- return Result.Success().SetData(await _iRoleService._repository.GetListAsync());
+ return Result.Success().SetData(await _iRoleService.SelctPageList(role, page));
}
+
///
/// 给多用户设置多角色
///
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 5dfa25bd..793982e8 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.Interface/IMenuService.cs b/Yi.Framework.Net6/Yi.Framework.Interface/IMenuService.cs
index f6b2f880..28427488 100644
--- a/Yi.Framework.Net6/Yi.Framework.Interface/IMenuService.cs
+++ b/Yi.Framework.Net6/Yi.Framework.Interface/IMenuService.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Threading.Tasks;
+using Yi.Framework.Common.Models;
using Yi.Framework.Model.Models;
using Yi.Framework.Repository;
@@ -8,5 +9,6 @@ namespace Yi.Framework.Interface
public partial interface IMenuService:IBaseService
{
Task> GetMenuTreeAsync();
+ Task> SelctGetList(MenuEntity menu);
}
}
diff --git a/Yi.Framework.Net6/Yi.Framework.Interface/IRoleService.cs b/Yi.Framework.Net6/Yi.Framework.Interface/IRoleService.cs
index 58895248..5350f42b 100644
--- a/Yi.Framework.Net6/Yi.Framework.Interface/IRoleService.cs
+++ b/Yi.Framework.Net6/Yi.Framework.Interface/IRoleService.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Threading.Tasks;
+using Yi.Framework.Common.Models;
using Yi.Framework.Model.Models;
using Yi.Framework.Repository;
@@ -27,5 +28,6 @@ namespace Yi.Framework.Interface
///
///
Task GiveRoleSetMenu(List roleIds, List menuIds);
+ Task>> SelctPageList(RoleEntity role, PageParModel page);
}
}
diff --git a/Yi.Framework.Net6/Yi.Framework.Service/MenuService.cs b/Yi.Framework.Net6/Yi.Framework.Service/MenuService.cs
index e85ef7f2..014dde7f 100644
--- a/Yi.Framework.Net6/Yi.Framework.Service/MenuService.cs
+++ b/Yi.Framework.Net6/Yi.Framework.Service/MenuService.cs
@@ -1,6 +1,7 @@
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;
@@ -9,11 +10,20 @@ namespace Yi.Framework.Service
{
public partial class MenuService : BaseService, IMenuService
{
+ public async Task> SelctGetList(MenuEntity menu)
+ {
+ var data = await _repository._Db.Queryable()
+ .WhereIF(!string.IsNullOrEmpty(menu.MenuName), u => u.MenuName.Contains(menu.MenuName))
+ .Where(u => u.IsDeleted == false)
+ .OrderBy(u => u.OrderNum, OrderByType.Desc)
+ .ToListAsync();
+ return data;
+ }
public async Task> GetMenuTreeAsync()
{
//ParentId 0,代表为根目录,只能存在一个
//复杂查询直接使用db代理
- return await _repository._Db.Queryable().Where(u=>u.IsDeleted==false).ToTreeAsync(it=>it.Children,it=>it.ParentId,0);
+ return await _repository._Db.Queryable().Where(u => u.IsDeleted == false).ToTreeAsync(it => it.Children, it => it.ParentId, 0);
}
}
}
diff --git a/Yi.Framework.Net6/Yi.Framework.Service/RoleService.cs b/Yi.Framework.Net6/Yi.Framework.Service/RoleService.cs
index 52546893..6e0f68ea 100644
--- a/Yi.Framework.Net6/Yi.Framework.Service/RoleService.cs
+++ b/Yi.Framework.Net6/Yi.Framework.Service/RoleService.cs
@@ -1,6 +1,8 @@
using SqlSugar;
+using System;
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;
@@ -46,5 +48,21 @@ namespace Yi.Framework.Service
return await _repository._Db.Queryable().Includes(u => u.Menus).InSingleAsync(roleId);
}
+
+
+
+ public async Task>> SelctPageList(RoleEntity role, PageParModel page)
+ {
+ RefAsync total = 0;
+ var data = await _repository._Db.Queryable()
+ .WhereIF(!string.IsNullOrEmpty(role.RoleName), u => u.RoleName.Contains(role.RoleName))
+ .WhereIF(!string.IsNullOrEmpty(role.RoleCode), u => u.RoleCode.Contains(role.RoleCode))
+ .WhereIF(page.StartTime.IsNotNull() && page.EndTime.IsNotNull(), u => u.CreateTime >= page.StartTime && u.CreateTime <= page.EndTime)
+ .Where(u => u.IsDeleted == role.IsDeleted)
+ .OrderBy(u => u.OrderNum, OrderByType.Desc)
+ .ToPageListAsync(page.PageNum, page.PageSize, total);
+
+ return new PageModel>(data, total);
+ }
}
}
diff --git a/Yi.Framework.Net6/Yi.Framework.Service/UserService.cs b/Yi.Framework.Net6/Yi.Framework.Service/UserService.cs
index 5f052ab6..c330927b 100644
--- a/Yi.Framework.Net6/Yi.Framework.Service/UserService.cs
+++ b/Yi.Framework.Net6/Yi.Framework.Service/UserService.cs
@@ -165,7 +165,7 @@ namespace Yi.Framework.Service
.WhereIF(!string.IsNullOrEmpty(user.Phone), u => u.Phone.Contains(user.Phone))
.WhereIF(page.StartTime.IsNotNull() && page.EndTime.IsNotNull(), u => u.CreateTime >= page.StartTime && u.CreateTime <= page.EndTime)
.Where(u => u.IsDeleted == false)
- .OrderBy(u => u.OrderNum)
+ .OrderBy(u => u.OrderNum, OrderByType.Desc)
.ToPageListAsync(page.PageNum, page.PageSize, total);
return new PageModel>(data, total);
diff --git a/Yi.Vue3.X.RuoYi/src/views/system/menu/index.vue b/Yi.Vue3.X.RuoYi/src/views/system/menu/index.vue
index eb6747de..02f091dc 100644
--- a/Yi.Vue3.X.RuoYi/src/views/system/menu/index.vue
+++ b/Yi.Vue3.X.RuoYi/src/views/system/menu/index.vue
@@ -9,8 +9,8 @@
@keyup.enter="handleQuery"
/>
-
-
+
+
-
+
@@ -360,7 +360,7 @@ function reset() {
isFrame: "1",
isCache: "0",
visible: "0",
- status: "0"
+ isDeleted: "0"
};
proxy.resetForm("menuRef");
}
diff --git a/Yi.Vue3.X.RuoYi/src/views/system/role/index.vue b/Yi.Vue3.X.RuoYi/src/views/system/role/index.vue
index 8262d2f9..275dec07 100644
--- a/Yi.Vue3.X.RuoYi/src/views/system/role/index.vue
+++ b/Yi.Vue3.X.RuoYi/src/views/system/role/index.vue
@@ -10,18 +10,18 @@
@keyup.enter="handleQuery"
/>
-
+
-
+
-
-
+
+
{
- roleList.value = response.data;
- total.value = response.total;
+ roleList.value = response.data.data;
+ total.value = response.data.total;
loading.value = false;
});
}