diff --git a/Yi.Framework.Net6/src/framework/Yi.Framework.Data/Entities/IState.cs b/Yi.Framework.Net6/src/framework/Yi.Framework.Data/Entities/IState.cs index 55e08fc5..fee2f365 100644 --- a/Yi.Framework.Net6/src/framework/Yi.Framework.Data/Entities/IState.cs +++ b/Yi.Framework.Net6/src/framework/Yi.Framework.Data/Entities/IState.cs @@ -8,6 +8,6 @@ namespace Yi.Framework.Data.Entities { public interface IState { - public bool? State { get; set; } + public bool State { get; set; } } } diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Dept/DeptGetOutputDto.cs b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Dept/DeptGetOutputDto.cs index 9de98d68..78ce84d1 100644 --- a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Dept/DeptGetOutputDto.cs +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Dept/DeptGetOutputDto.cs @@ -10,13 +10,12 @@ namespace Yi.RBAC.Application.Contracts.Identity.Dtos public class DeptGetOutputDto : IEntityDto { public long Id { get; set; } - public DateTime CreationTime { get; set; } = DateTime.Now; - public long? CreatorId { get; set; } public bool State { get; set; } public string DeptName { get; set; }=string.Empty; public string DeptCode { get; set; } = string.Empty; public string? Leader { get; set; } - public long ParentId { get; set; } public string? Remark { get; set; } + + public long? deptId { get; set; } } } diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Post/PostGetListOutputDto.cs b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Post/PostGetListOutputDto.cs index 239bf3b0..34088d31 100644 --- a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Post/PostGetListOutputDto.cs +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Post/PostGetListOutputDto.cs @@ -11,7 +11,6 @@ namespace Yi.RBAC.Application.Contracts.Identity.Dtos { public long Id { get; set; } public DateTime CreationTime { get; set; } = DateTime.Now; - public long? CreatorId { get; set; } public bool State { get; set; } public string PostCode { get; set; }=string.Empty; public string PostName { get; set; } = string.Empty; diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/User/UserGetOutputDto.cs b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/User/UserGetOutputDto.cs index 9c52a361..d43fde2a 100644 --- a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/User/UserGetOutputDto.cs +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/User/UserGetOutputDto.cs @@ -14,8 +14,6 @@ namespace Yi.RBAC.Application.Contracts.Identity.Dtos public string? Name { get; set; } public int? Age { get; set; } public string UserName { get; set; } = string.Empty; - public string Password { get; set; } = string.Empty; - public string Salt { get; set; } = string.Empty; public string? Icon { get; set; } public string? Nick { get; set; } public string? Email { get; set; } @@ -25,10 +23,13 @@ namespace Yi.RBAC.Application.Contracts.Identity.Dtos public string? Introduction { get; set; } public string? Remark { get; set; } public SexEnum Sex { get; set; } = SexEnum.Unknown; - public long? DeptId { get; set; } - public DateTime CreationTime { get; set; } = DateTime.Now; - public long? CreatorId { get; set; } - public bool State { get; set; } + public DateTime CreationTime { get; set; } + + public DeptGetOutputDto Dept { get; set; } + + public List Posts { get; set; } + + public List Roles { get; set; } } } diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/User/UserUpdateInputVo.cs b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/User/UserUpdateInputVo.cs index 84e0badd..c191ea6d 100644 --- a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/User/UserUpdateInputVo.cs +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/User/UserUpdateInputVo.cs @@ -1,3 +1,4 @@ +using Mapster; using System; using System.Collections.Generic; using System.Linq; @@ -9,12 +10,12 @@ namespace Yi.RBAC.Application.Contracts.Identity.Dtos { public class UserUpdateInputVo { - public long Id { get; set; } public string? Name { get; set; } public int? Age { get; set; } - public string UserName { get; set; } = string.Empty; - public string Password { get; set; } = string.Empty; - public string Salt { get; set; } = string.Empty; + public string? UserName { get; set; } + + [AdaptIgnore] + public string? Password { get; set; } public string? Icon { get; set; } public string? Nick { get; set; } public string? Email { get; set; } @@ -23,11 +24,11 @@ namespace Yi.RBAC.Application.Contracts.Identity.Dtos public long? Phone { get; set; } public string? Introduction { get; set; } public string? Remark { get; set; } - public SexEnum Sex { get; set; } = SexEnum.Unknown; + public SexEnum? Sex { get; set; } public long? DeptId { get; set; } - public DateTime CreationTime { get; set; } = DateTime.Now; - public long? CreatorId { get; set; } + public List? PostIds { get; set; } - public bool State { get; set; } + public List? RoleIds { get; set; } + public bool? State { get; set; } } } diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application/ApplicationSwaggerDoc.xml b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application/ApplicationSwaggerDoc.xml index 2cc21a17..91a733e9 100644 --- a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application/ApplicationSwaggerDoc.xml +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application/ApplicationSwaggerDoc.xml @@ -111,5 +111,20 @@ + + + 单查 + + + + + + + 更新用户 + + + + + diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application/Identity/UserService.cs b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application/Identity/UserService.cs index 85e99807..729cbb54 100644 --- a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application/Identity/UserService.cs +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application/Identity/UserService.cs @@ -8,6 +8,8 @@ using Yi.RBAC.Domain.Identity; using Yi.Framework.Uow; using Yi.Framework.Ddd.Dtos; using Yi.RBAC.Domain.Identity.Repositories; +using SqlSugar; +using Mapster; namespace Yi.RBAC.Application.Identity { @@ -36,7 +38,7 @@ namespace Yi.RBAC.Application.Identity { var entity = await MapToEntityAsync(input); - int total = 0; + RefAsync total = 0; var entities = await _DbQueryable.WhereIF(!string.IsNullOrEmpty(input.UserName), x => x.UserName.Contains(input.UserName!)). WhereIF(input.Phone is not null, x => x.Phone.ToString()!.Contains(input.Phone.ToString()!)). @@ -80,5 +82,47 @@ namespace Yi.RBAC.Application.Identity return result; } } + /// + /// 单查 + /// + /// + /// + public override async Task GetAsync(long id) + { + //使用导航树形查询 + var entity = await _DbQueryable.Includes(u => u.Roles).Includes(u => u.Posts).Includes(u => u.Dept).InSingleAsync(id); + + return await MapToGetOutputDtoAsync(entity); + } + + /// + /// 更新用户 + /// + /// + /// + /// + public async override Task UpdateAsync(long id, UserUpdateInputVo input) + { + if (await _repository.IsAnyAsync(u => input.UserName!.Equals(u.UserName) && !id.Equals(u.Id))) + { + throw new UserFriendlyException("用户已经在,更新失败"); + } + var entity = await _repository.GetByIdAsync(id); + //更新密码,特殊处理 + if (input.Password is not null) + { + entity.Password = input.Password; + entity.BuildPassword(); + } + await MapToEntityAsync(input, entity); + using (var uow = _unitOfWorkManager.CreateContext()) + { + var res1 = await _repository.UpdateAsync(entity); + await _userManager.GiveUserSetRoleAsync(new List { id }, input.RoleIds); + await _userManager.GiveUserSetPostAsync(new List { id }, input.PostIds); + uow.Commit(); + } + return await MapToGetOutputDtoAsync(entity); + } } } diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/DataSeeds/DeptDataSeed.cs b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/DataSeeds/DeptDataSeed.cs new file mode 100644 index 00000000..65d59a66 --- /dev/null +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/DataSeeds/DeptDataSeed.cs @@ -0,0 +1,138 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.Framework.Data.DataSeeds; +using Yi.Framework.Ddd.Repositories; +using Yi.RBAC.Domain.Dictionary.Entities; +using Yi.RBAC.Domain.Identity.Entities; + +namespace Yi.RBAC.Domain.DataSeeds +{ + [AppService(typeof(IDataSeed))] + public class DeptDataSeed : AbstractDataSeed + { + public DeptDataSeed(IRepository repository) : base(repository) + { + } + + public override List GetSeedData() + { + var entities =new List(); + + DeptEntity chengziDept = new DeptEntity() + { + Id = SnowflakeHelper.NextId, + DeptName = "橙子科技", + DeptCode = "Yi", + OrderNum = 100, + IsDeleted = false, + ParentId = 0, + Leader = "橙子", + Remark = "如名所指" + }; + entities.Add(chengziDept); + + + DeptEntity shenzhenDept = new DeptEntity() + { + Id = SnowflakeHelper.NextId, + DeptName = "深圳总公司", + OrderNum = 100, + IsDeleted = false, + ParentId = chengziDept.Id + }; + entities.Add(shenzhenDept); + + + DeptEntity jiangxiDept = new DeptEntity() + { + Id = SnowflakeHelper.NextId, + DeptName = "江西总公司", + OrderNum = 100, + IsDeleted = false, + ParentId = chengziDept.Id + }; + entities.Add(jiangxiDept); + + + + DeptEntity szDept1 = new DeptEntity() + { + Id = SnowflakeHelper.NextId, + DeptName = "研发部门", + OrderNum = 100, + IsDeleted = false, + ParentId = shenzhenDept.Id + }; + entities.Add(szDept1); + + DeptEntity szDept2 = new DeptEntity() + { + Id = SnowflakeHelper.NextId, + DeptName = "市场部门", + OrderNum = 100, + IsDeleted = false, + ParentId = shenzhenDept.Id + }; + entities.Add(szDept2); + + DeptEntity szDept3 = new DeptEntity() + { + Id = SnowflakeHelper.NextId, + DeptName = "测试部门", + OrderNum = 100, + IsDeleted = false, + ParentId = shenzhenDept.Id + }; + entities.Add(szDept3); + + DeptEntity szDept4 = new DeptEntity() + { + Id = SnowflakeHelper.NextId, + DeptName = "财务部门", + OrderNum = 100, + IsDeleted = false, + ParentId = shenzhenDept.Id + }; + entities.Add(szDept4); + + DeptEntity szDept5 = new DeptEntity() + { + Id = SnowflakeHelper.NextId, + DeptName = "运维部门", + OrderNum = 100, + IsDeleted = false, + ParentId = shenzhenDept.Id + }; + entities.Add(szDept5); + + + DeptEntity jxDept1 = new DeptEntity() + { + Id = SnowflakeHelper.NextId, + DeptName = "市场部门", + OrderNum = 100, + IsDeleted = false, + ParentId = jiangxiDept.Id + }; + entities.Add(jxDept1); + + + DeptEntity jxDept2 = new DeptEntity() + { + Id = SnowflakeHelper.NextId, + DeptName = "财务部门", + OrderNum = 100, + IsDeleted = false, + ParentId = jiangxiDept.Id + }; + entities.Add(jxDept2); + + + return entities; + } + } +} diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/DataSeeds/PostDataSeed.cs b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/DataSeeds/PostDataSeed.cs new file mode 100644 index 00000000..c09838f7 --- /dev/null +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/DataSeeds/PostDataSeed.cs @@ -0,0 +1,69 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.Framework.Data.DataSeeds; +using Yi.Framework.Ddd.Repositories; +using Yi.RBAC.Domain.Identity.Entities; + +namespace Yi.RBAC.Domain.DataSeeds +{ + [AppService(typeof(IDataSeed))] + public class PostDataSeed : AbstractDataSeed + { + public PostDataSeed(IRepository repository) : base(repository) + { + } + + public override List GetSeedData() + { + var entites=new List(); + + PostEntity Post1 = new PostEntity() + { + Id = SnowflakeHelper.NextId, + PostName = "董事长", + PostCode = "ceo", + OrderNum = 100, + IsDeleted = false + }; + entites.Add(Post1); + + PostEntity Post2 = new PostEntity() + { + Id = SnowflakeHelper.NextId, + PostName = "项目经理", + PostCode = "se", + OrderNum = 100, + IsDeleted = false + }; + entites.Add(Post2); + + PostEntity Post3 = new PostEntity() + { + Id = SnowflakeHelper.NextId, + PostName = "人力资源", + PostCode = "hr", + OrderNum = 100, + IsDeleted = false + }; + entites.Add(Post3); + + PostEntity Post4 = new PostEntity() + { + Id = SnowflakeHelper.NextId, + PostName = "普通员工", + PostCode = "user", + OrderNum = 100, + IsDeleted = false + }; + + entites.Add(Post4); + return entites; + } + } + + +} diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/DataSeeds/RoleDataSeed.cs b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/DataSeeds/RoleDataSeed.cs new file mode 100644 index 00000000..203f71dc --- /dev/null +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/DataSeeds/RoleDataSeed.cs @@ -0,0 +1,51 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.Framework.Data.DataSeeds; +using Yi.Framework.Ddd.Repositories; +using Yi.RBAC.Domain.Identity.Entities; +using Yi.RBAC.Domain.Shared.Identity.EnumClasses; + +namespace Yi.RBAC.Domain.DataSeeds +{ + [AppService(typeof(IDataSeed))] + public class RoleDataSeed : AbstractDataSeed + { + public RoleDataSeed(IRepository repository) : base(repository) + { + } + + public override List GetSeedData() + { + var entities = new List(); + RoleEntity role1 = new RoleEntity() + { + Id = SnowflakeHelper.NextId, + RoleName = "管理员", + RoleCode = "admin", + DataScope = DataScopeEnum.ALL, + OrderNum = 999, + Remark = "管理员", + IsDeleted = false + }; + entities.Add(role1); + + RoleEntity role2 = new RoleEntity() + { + Id = SnowflakeHelper.NextId, + RoleName = "测试角色", + RoleCode = "test", + DataScope = DataScopeEnum.ALL, + OrderNum = 1, + Remark = "测试用的角色", + IsDeleted = false + }; + entities.Add(role2); + + return entities; + } + } +} diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/Dictionary/Entities/DictionaryEntity.cs b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/Dictionary/Entities/DictionaryEntity.cs index f2153621..1a5e7713 100644 --- a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/Dictionary/Entities/DictionaryEntity.cs +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/Dictionary/Entities/DictionaryEntity.cs @@ -33,7 +33,7 @@ namespace Yi.RBAC.Domain.Dictionary.Entities /// /// 状态 /// - public bool? State { get; set; } = true; + public bool State { get; set; } = true; /// /// 描述 diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/Identity/Entities/DeptEntity.cs b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/Identity/Entities/DeptEntity.cs index 4eb5027b..022c416a 100644 --- a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/Identity/Entities/DeptEntity.cs +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/Identity/Entities/DeptEntity.cs @@ -54,7 +54,7 @@ namespace Yi.RBAC.Domain.Identity.Entities /// /// 状态 /// - public bool? State { get; set; } + public bool State { get; set; } = true; /// /// 部门名称 diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/Identity/Entities/MenuEntity.cs b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/Identity/Entities/MenuEntity.cs index cb829e36..00c36374 100644 --- a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/Identity/Entities/MenuEntity.cs +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/Identity/Entities/MenuEntity.cs @@ -56,7 +56,7 @@ namespace Yi.RBAC.Domain.Identity.Entities /// /// 状态 /// - public bool? State { get; set; } + public bool State { get; set; } /// /// 菜单名 diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/Identity/Entities/PostEntity.cs b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/Identity/Entities/PostEntity.cs index cd8989a7..57f3922c 100644 --- a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/Identity/Entities/PostEntity.cs +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/Identity/Entities/PostEntity.cs @@ -55,7 +55,7 @@ namespace Yi.RBAC.Domain.Identity.Entities /// /// 状态 /// - public bool? State { get; set; } + public bool State { get; set; }=true; /// /// 岗位编码 diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/Identity/Entities/RoleEntity.cs b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/Identity/Entities/RoleEntity.cs index 8c729679..f64a1ec2 100644 --- a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/Identity/Entities/RoleEntity.cs +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/Identity/Entities/RoleEntity.cs @@ -79,7 +79,7 @@ namespace Yi.RBAC.Domain.Identity.Entities /// /// 状态 /// - public bool? State { get; set; } + public bool State { get; set; }=true; [Navigate(typeof(RoleMenuEntity), nameof(RoleMenuEntity.RoleId), nameof(RoleMenuEntity.MenuId))] diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/Identity/Entities/UserEntity.cs b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/Identity/Entities/UserEntity.cs index 67d3d071..221fd070 100644 --- a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/Identity/Entities/UserEntity.cs +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/Identity/Entities/UserEntity.cs @@ -133,7 +133,7 @@ namespace Yi.RBAC.Domain.Identity.Entities /// /// 状态 /// - public bool? State { get; set; } = true; + public bool State { get; set; } = true; /// diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Web/yi-sqlsugar-dev.db b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Web/yi-sqlsugar-dev.db index 5791274a..4496b7a4 100644 Binary files a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Web/yi-sqlsugar-dev.db and b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Web/yi-sqlsugar-dev.db differ diff --git a/Yi.RuoYi.Vue3/src/api/system/dept.js b/Yi.RuoYi.Vue3/src/api/system/dept.js index cf28c932..0e0dcf67 100644 --- a/Yi.RuoYi.Vue3/src/api/system/dept.js +++ b/Yi.RuoYi.Vue3/src/api/system/dept.js @@ -3,7 +3,7 @@ import request from '@/utils/request' // 查询部门列表 export function listDept(query) { return request({ - url: '/dept/SelctGetList', + url: '/dept', method: 'get', params: query }) @@ -20,7 +20,7 @@ export function listDept(query) { // 查询部门详细 export function getDept(deptId) { return request({ - url: '/dept/getById/' + deptId, + url: '/dept/' + deptId, method: 'get' }) } @@ -28,7 +28,7 @@ export function getDept(deptId) { // 新增部门 export function addDept(data) { return request({ - url: '/dept/add', + url: '/dept', method: 'post', data: data }) @@ -37,7 +37,7 @@ export function addDept(data) { // 修改部门 export function updateDept(data) { return request({ - url: '/dept/update', + url: '/dept', method: 'put', data: data }) @@ -45,14 +45,9 @@ export function updateDept(data) { // 删除部门 export function delDept(deptId) { - if("string"==typeof(deptId)) - { - deptId=[deptId]; - } return request({ - url: '/dept/delList', - method: 'delete', - data:deptId + url: `/dept/${deptId}`, + method: 'delete' }) } diff --git a/Yi.RuoYi.Vue3/src/api/system/menu.js b/Yi.RuoYi.Vue3/src/api/system/menu.js index 2cab2ce1..14d58f26 100644 --- a/Yi.RuoYi.Vue3/src/api/system/menu.js +++ b/Yi.RuoYi.Vue3/src/api/system/menu.js @@ -3,7 +3,7 @@ import request from '@/utils/request' // 查询菜单列表 export function listMenu(query) { return request({ - url: '/menu/selctGetList', + url: '/menu', method: 'get', params: query }) @@ -12,7 +12,7 @@ export function listMenu(query) { // 查询菜单详细 export function getMenu(menuId) { return request({ - url: '/menu/getById/' + menuId, + url: '/menu/' + menuId, method: 'get' }) } @@ -36,7 +36,7 @@ export function roleMenuTreeselect(roleId) { // 新增菜单 export function addMenu(data) { return request({ - url: '/menu/add', + url: '/menu', method: 'post', data: data }) @@ -45,7 +45,7 @@ export function addMenu(data) { // 修改菜单 export function updateMenu(data) { return request({ - url: '/menu/update', + url: '/menu', method: 'put', data: data }) @@ -53,13 +53,9 @@ export function updateMenu(data) { // 删除菜单 export function delMenu(menuId) { - if("string"==typeof(menuId)) - { - menuId=[menuId]; - } + return request({ - url: '/menu/delList', - method: 'delete', - data:menuId + url: `/menu/${menuId}`, + method: 'delete' }) } \ No newline at end of file diff --git a/Yi.RuoYi.Vue3/src/api/system/post.js b/Yi.RuoYi.Vue3/src/api/system/post.js index dd1eebf4..073347dc 100644 --- a/Yi.RuoYi.Vue3/src/api/system/post.js +++ b/Yi.RuoYi.Vue3/src/api/system/post.js @@ -3,7 +3,7 @@ import request from '@/utils/request' // 查询岗位列表 export function listPost(query) { return request({ - url: '/post/pageList', + url: '/post', method: 'get', params: query }) @@ -12,7 +12,7 @@ export function listPost(query) { // 查询岗位详细 export function getPost(postId) { return request({ - url: '/post/getById/' + postId, + url: '/post/' + postId, method: 'get' }) } @@ -20,7 +20,7 @@ export function getPost(postId) { // 新增岗位 export function addPost(data) { return request({ - url: '/post/add', + url: '/post', method: 'post', data: data }) @@ -29,7 +29,7 @@ export function addPost(data) { // 修改岗位 export function updatePost(data) { return request({ - url: '/post/update', + url: '/post', method: 'put', data: data }) @@ -37,21 +37,16 @@ export function updatePost(data) { // 删除岗位 export function delPost(postId) { - if("string"==typeof(postId)) - { - postId=[postId]; - } return request({ - url: '/post/delList', - method: 'delete', - data:postId + url: `/post/${postId}`, + method: 'delete' }) } // 获取角色选择框列表 export function postOptionselect() { return request({ - url: '/post/getList', + url: '/post', method: 'get' }) diff --git a/Yi.RuoYi.Vue3/src/api/system/role.js b/Yi.RuoYi.Vue3/src/api/system/role.js index f000bd81..f2aa3db4 100644 --- a/Yi.RuoYi.Vue3/src/api/system/role.js +++ b/Yi.RuoYi.Vue3/src/api/system/role.js @@ -3,7 +3,7 @@ import request from '@/utils/request' // 查询角色列表 export function listRole(query) { return request({ - url: '/role/pageList', + url: '/role', method: 'get', params: query }) @@ -14,7 +14,7 @@ export function listRole(query) { // 查询角色详细 export function getRole(roleId) { return request({ - url: '/role/getById/' + roleId, + url: '/role/' + roleId, method: 'get' }) } @@ -22,7 +22,7 @@ export function getRole(roleId) { // 新增角色 export function addRole(data) { return request({ - url: '/role/add', + url: '/role', method: 'post', data: data }) @@ -31,7 +31,7 @@ export function addRole(data) { // 修改角色 export function updateRole(data) { return request({ - url: '/role/update', + url: '/role', method: 'put', data: data }) @@ -56,14 +56,9 @@ export function changeRoleStatus(roleId, isDel) { // 删除角色 export function delRole(roleId) { - if("string"==typeof(roleId)) - { - roleId=[roleId]; - } return request({ - url: '/role/delList', + url: `/role/${roleId}`, method: 'delete', - data:roleId }) } @@ -122,7 +117,7 @@ export function authUserSelectAll(data) { // 获取角色选择框列表 export function roleOptionselect() { return request({ - url: '/role/getList', + url: '/role', method: 'get' }) diff --git a/Yi.RuoYi.Vue3/src/api/system/user.js b/Yi.RuoYi.Vue3/src/api/system/user.js index aa88ec0f..90160258 100644 --- a/Yi.RuoYi.Vue3/src/api/system/user.js +++ b/Yi.RuoYi.Vue3/src/api/system/user.js @@ -4,7 +4,7 @@ import { parseStrEmpty } from "@/utils/ruoyi"; // 查询用户列表 export function listUser(query) { return request({ - url: '/user/pageList', + url: '/user', method: 'get', params: query }) @@ -13,7 +13,7 @@ export function listUser(query) { // 查询用户详细 export function getUser(userId) { return request({ - url: '/user/getById/' + parseStrEmpty(userId), + url: '/user/' + parseStrEmpty(userId), method: 'get' }) } @@ -28,24 +28,34 @@ export function addUser(data) { } // 修改用户 -export function updateUser(data) { +export function updateUser(id, data) { return request({ - url: '/user/update', + url: `/user/${id}`, method: 'put', - data: data + data: { + + userName: data.user.userName, + nick: data.user.nick, + password: data.user.password, + phone: data.user.phone, + email: data.user.email, + sex: data.user.sex, + state: data.user.state, + remark: data.user.remark, + postIds: data.postIds, + roleIds: data.roleIds, + deptId: data.deptId + + + } }) } // 删除用户 export function delUser(userId) { - if("string"==typeof(userId)) - { - userId=[userId]; - } return request({ - url: '/user/delList', + url: `/user/${userId}`, method: 'delete', - data:userId }) } @@ -85,7 +95,7 @@ export function updateUserProfile(data) { return request({ url: '/user/UpdateProfile', method: 'put', - data: {user:data} + data: { user: data } }) } diff --git a/Yi.RuoYi.Vue3/src/views/system/dept/index.vue b/Yi.RuoYi.Vue3/src/views/system/dept/index.vue index ca4fbc60..4afca6e1 100644 --- a/Yi.RuoYi.Vue3/src/views/system/dept/index.vue +++ b/Yi.RuoYi.Vue3/src/views/system/dept/index.vue @@ -191,7 +191,7 @@ const { queryParams, form, rules } = toRefs(data); function getList() { loading.value = true; listDept(queryParams.value).then(response => { - deptList.value = proxy.handleTree(response.data, "id"); + deptList.value = proxy.handleTree(response.data.items, "id"); loading.value = false; }); } diff --git a/Yi.RuoYi.Vue3/src/views/system/menu/index.vue b/Yi.RuoYi.Vue3/src/views/system/menu/index.vue index 83f71ca7..145d4d88 100644 --- a/Yi.RuoYi.Vue3/src/views/system/menu/index.vue +++ b/Yi.RuoYi.Vue3/src/views/system/menu/index.vue @@ -329,7 +329,7 @@ const { queryParams, form, rules } = toRefs(data); function getList() { loading.value = true; listMenu(queryParams.value).then(response => { - menuList.value = proxy.handleTree(response.data, "id"); + menuList.value = proxy.handleTree(response.data.items, "id"); loading.value = false; }); } @@ -338,7 +338,7 @@ function getTreeselect() { menuOptions.value = []; listMenu().then(response => { const menu = { id: 0, menuName: "主类目", children: [] }; - menu.children = proxy.handleTree(response.data, "id"); + menu.children = proxy.handleTree(response.data.items, "id"); menuOptions.value.push(menu); }); } diff --git a/Yi.RuoYi.Vue3/src/views/system/post/index.vue b/Yi.RuoYi.Vue3/src/views/system/post/index.vue index d1b66a4c..62d76580 100644 --- a/Yi.RuoYi.Vue3/src/views/system/post/index.vue +++ b/Yi.RuoYi.Vue3/src/views/system/post/index.vue @@ -186,7 +186,7 @@ const { queryParams, form, rules } = toRefs(data); function getList() { loading.value = true; listPost(queryParams.value).then(response => { - postList.value = response.data.data; + postList.value = response.data.items; total.value = response.data.total; loading.value = false; }); diff --git a/Yi.RuoYi.Vue3/src/views/system/role/index.vue b/Yi.RuoYi.Vue3/src/views/system/role/index.vue index 3650904e..c9371273 100644 --- a/Yi.RuoYi.Vue3/src/views/system/role/index.vue +++ b/Yi.RuoYi.Vue3/src/views/system/role/index.vue @@ -442,7 +442,7 @@ function getList() { loading.value = true; listRole(proxy.addDateRange(queryParams.value, dateRange.value)).then( (response) => { - roleList.value = response.data.data; + roleList.value = response.data.items; total.value = response.data.total; loading.value = false; } @@ -525,7 +525,7 @@ function handleAuthUser(row) { function getMenuTreeselect() { listMenu().then((response) => { const options = []; - response.data.forEach((m) => { + response.data.items.forEach((m) => { options.push({ id: m.id, label: m.menuName, diff --git a/Yi.RuoYi.Vue3/src/views/system/user/index.vue b/Yi.RuoYi.Vue3/src/views/system/user/index.vue index 5946e12a..6e6e11f2 100644 --- a/Yi.RuoYi.Vue3/src/views/system/user/index.vue +++ b/Yi.RuoYi.Vue3/src/views/system/user/index.vue @@ -81,9 +81,9 @@ @change="handleStatusChange(scope.row)"> - + @@ -321,7 +321,7 @@ watch(deptName, val => { function getDeptTree() { listDept().then(response => { const selectList = []; - response.data.forEach(res => { + response.data.items.forEach(res => { selectList.push({ id: res.id, label: res.deptName, parentId: res.parentId, orderNum: res.orderNum, children: [] }) } @@ -335,7 +335,7 @@ function getList() { listUser(proxy.addDateRange(queryParams.value, dateRange.value)).then(res => { loading.value = false; - userList.value = res.data.data; + userList.value = res.data.items; total.value = res.data.total; }); }; @@ -469,10 +469,10 @@ function reset() { if (postOptions.value.length == 0 || roleOptions.value.length == 0) { roleOptionselect().then(response => { //岗位从另一个接口获取全量 - roleOptions.value = response.data; + roleOptions.value = response.data.items; }) postOptionselect().then(response => { - postOptions.value = response.data; + postOptions.value = response.data.items; } @@ -512,7 +512,6 @@ response.data.posts.forEach(post => { }); form.value.deptId= response.data.deptId; - response.data.roles.forEach(role => { form.value.roleIds.push(role.id) }); @@ -529,7 +528,7 @@ function submitForm() { proxy.$refs["userRef"].validate(valid => { if (valid) { if (form.value.user.id != undefined) { - updateUser(form.value).then(response => { + updateUser(form.value.user.id,form.value).then(response => { proxy.$modal.msgSuccess("修改成功"); open.value = false; getList(); diff --git a/Yi.RuoYi.Vue3/src/views/tool/gen/genInfoForm.vue b/Yi.RuoYi.Vue3/src/views/tool/gen/genInfoForm.vue index bd14ccc2..56815603 100644 --- a/Yi.RuoYi.Vue3/src/views/tool/gen/genInfoForm.vue +++ b/Yi.RuoYi.Vue3/src/views/tool/gen/genInfoForm.vue @@ -269,7 +269,7 @@ function setSubTableColumns(value) { /** 查询菜单下拉树结构 */ function getMenuTreeselect() { listMenu().then(response => { - menuOptions.value = proxy.handleTree(response.data, "menuId"); + menuOptions.value = proxy.handleTree(response.data.items, "menuId"); }); }