对接ruoyi接口
用户、角色、菜单查询部分
This commit is contained in:
Binary file not shown.
@@ -229,6 +229,14 @@
|
|||||||
用户管理
|
用户管理
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.UpdateStatus(System.Int64,System.Boolean)">
|
||||||
|
<summary>
|
||||||
|
更改用户状态
|
||||||
|
</summary>
|
||||||
|
<param name="userId"></param>
|
||||||
|
<param name="isDel"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.Add(Yi.Framework.Model.Models.UserEntity)">
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.Add(Yi.Framework.Model.Models.UserEntity)">
|
||||||
<summary>
|
<summary>
|
||||||
添加用户,去重,密码加密
|
添加用户,去重,密码加密
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
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 DictionaryController
|
||||||
|
{
|
||||||
|
private IDictionaryService _iDictionaryService;
|
||||||
|
public DictionaryController(ILogger<DictionaryEntity> logger, IDictionaryService iDictionaryService)
|
||||||
|
{
|
||||||
|
_iDictionaryService = iDictionaryService;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[Route("{type}")]
|
||||||
|
public async Task<Result> GetListByType([FromRoute] string type)
|
||||||
|
{
|
||||||
|
return Result.Success().SetData(await _iDictionaryService._repository.GetListAsync(u=>u.DictType==type&&u.IsDeleted==false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,14 +20,20 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/[controller]/[action]")]
|
[Route("api/[controller]/[action]")]
|
||||||
public class MenuController : BaseCrudController<MenuEntity>
|
public class MenuController
|
||||||
{
|
{
|
||||||
private IMenuService _iMenuService;
|
private IMenuService _iMenuService;
|
||||||
public MenuController(ILogger<MenuEntity> logger, IMenuService iMenuService) : base(logger, iMenuService)
|
public MenuController(ILogger<MenuEntity> logger, IMenuService iMenuService)
|
||||||
{
|
{
|
||||||
_iMenuService = iMenuService;
|
_iMenuService = iMenuService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<Result> GetList()
|
||||||
|
{
|
||||||
|
return Result.Success().SetData(await _iMenuService._repository.GetListAsync());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -35,7 +41,6 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
//暂未制作逻辑删除与多租户的过滤
|
|
||||||
public async Task<Result> GetMenuTree()
|
public async Task<Result> GetMenuTree()
|
||||||
{
|
{
|
||||||
return Result.Success().SetData(await _iMenuService. GetMenuTreeAsync());
|
return Result.Success().SetData(await _iMenuService. GetMenuTreeAsync());
|
||||||
|
|||||||
@@ -29,6 +29,12 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
_iRoleService = iRoleService;
|
_iRoleService = iRoleService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<Result> PageList()
|
||||||
|
{
|
||||||
|
return Result.Success().SetData(await _iRoleService._repository.GetListAsync());
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 给多用户设置多角色
|
/// 给多用户设置多角色
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -29,6 +29,26 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
_iUserService = iUserService;
|
_iUserService = iUserService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<Result> PageList()
|
||||||
|
{
|
||||||
|
return Result.Success().SetData(await _iUserService._repository.GetListAsync());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更改用户状态
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <param name="isDel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPut]
|
||||||
|
public async Task<Result> UpdateStatus(long userId,bool isDel)
|
||||||
|
{
|
||||||
|
return Result.Success().SetData(await _iUserService._repository.UpdateIgnoreNullAsync(new UserEntity() { Id = userId, IsDeleted = isDel }));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 添加用户,去重,密码加密
|
/// 添加用户,去重,密码加密
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Binary file not shown.
13
Yi.Framework.Net6/Yi.Framework.Common/Enum/MenuTypeEnum.cs
Normal file
13
Yi.Framework.Net6/Yi.Framework.Common/Enum/MenuTypeEnum.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Common.Enum
|
||||||
|
{
|
||||||
|
public enum MenuTypeEnum
|
||||||
|
{
|
||||||
|
Catalogue=0, //目录
|
||||||
|
Menu=1, //菜单
|
||||||
|
Component = 2//组件
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,9 +4,9 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Yi.Framework.Common.Models.Enum
|
namespace Yi.Framework.Common.Enum
|
||||||
{
|
{
|
||||||
public enum ResultCode
|
public enum ResultCodeEnum
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 操作成功。
|
/// 操作成功。
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
using Microsoft.Extensions.Localization;
|
using Microsoft.Extensions.Localization;
|
||||||
using Yi.Framework.Common.Models.Enum;
|
using Yi.Framework.Common.Enum;
|
||||||
using Yi.Framework.Language;
|
using Yi.Framework.Language;
|
||||||
|
|
||||||
namespace Yi.Framework.Common.Models
|
namespace Yi.Framework.Common.Models
|
||||||
@@ -7,32 +7,32 @@ namespace Yi.Framework.Common.Models
|
|||||||
public class Result
|
public class Result
|
||||||
{
|
{
|
||||||
public static IStringLocalizer<LocalLanguage> _local;
|
public static IStringLocalizer<LocalLanguage> _local;
|
||||||
public ResultCode code { get; set; }
|
public ResultCodeEnum code { get; set; }
|
||||||
|
|
||||||
public bool status { get; set; }
|
public bool status { get; set; }
|
||||||
public string message { get; set; }
|
public string message { get; set; }
|
||||||
public object data { get; set; }
|
public object data { get; set; }
|
||||||
public static Result Expire(ResultCode code, string msg="")
|
public static Result Expire(ResultCodeEnum code, string msg="")
|
||||||
{
|
{
|
||||||
return new Result() { code = code, status=false, message = Get(msg, "token_expiration") };
|
return new Result() { code = code, status=false, message = Get(msg, "token_expiration") };
|
||||||
}
|
}
|
||||||
public static Result Error(string msg = "")
|
public static Result Error(string msg = "")
|
||||||
{
|
{
|
||||||
return new Result() { code = ResultCode.NotSuccess,status=false, message =Get(msg, "fail") };
|
return new Result() { code = ResultCodeEnum.NotSuccess,status=false, message =Get(msg, "fail") };
|
||||||
}
|
}
|
||||||
public static Result Success(string msg = "")
|
public static Result Success(string msg = "")
|
||||||
{
|
{
|
||||||
return new Result() { code = ResultCode.Success,status=true, message =Get( msg, "succeed" )};
|
return new Result() { code = ResultCodeEnum.Success,status=true, message =Get( msg, "succeed" )};
|
||||||
}
|
}
|
||||||
public static Result SuccessError(string msg = "")
|
public static Result SuccessError(string msg = "")
|
||||||
{
|
{
|
||||||
return new Result() { code = ResultCode.Success, status = false, message = Get(msg, "fail") };
|
return new Result() { code = ResultCodeEnum.Success, status = false, message = Get(msg, "fail") };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static Result UnAuthorize(string msg = "")
|
public static Result UnAuthorize(string msg = "")
|
||||||
{
|
{
|
||||||
return new Result() { code = ResultCode.NoPermission,status=false, message = Get(msg, "unAuthorize") };
|
return new Result() { code = ResultCodeEnum.NoPermission,status=false, message = Get(msg, "unAuthorize") };
|
||||||
}
|
}
|
||||||
public Result SetStatus(bool _status)
|
public Result SetStatus(bool _status)
|
||||||
{
|
{
|
||||||
@@ -52,7 +52,7 @@ namespace Yi.Framework.Common.Models
|
|||||||
this.data = obj;
|
this.data = obj;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
public Result SetCode(ResultCode Code)
|
public Result SetCode(ResultCodeEnum Code)
|
||||||
{
|
{
|
||||||
this.code = Code;
|
this.code = Code;
|
||||||
return this;
|
return this;
|
||||||
@@ -79,20 +79,20 @@ namespace Yi.Framework.Common.Models
|
|||||||
}
|
}
|
||||||
public class Result<T>
|
public class Result<T>
|
||||||
{
|
{
|
||||||
public ResultCode code { get; set; }
|
public ResultCodeEnum code { get; set; }
|
||||||
public string message { get; set; }
|
public string message { get; set; }
|
||||||
public T data { get; set; }
|
public T data { get; set; }
|
||||||
public static Result<T> Error(string msg = "fail")
|
public static Result<T> Error(string msg = "fail")
|
||||||
{
|
{
|
||||||
return new Result<T>() { code = ResultCode.NotSuccess, message = msg };
|
return new Result<T>() { code = ResultCodeEnum.NotSuccess, message = msg };
|
||||||
}
|
}
|
||||||
public static Result<T> Success(string msg = "succeed")
|
public static Result<T> Success(string msg = "succeed")
|
||||||
{
|
{
|
||||||
return new Result<T>() { code = ResultCode.Success, message = msg };
|
return new Result<T>() { code = ResultCodeEnum.Success, message = msg };
|
||||||
}
|
}
|
||||||
public static Result<T> UnAuthorize(string msg = "unAuthorize")
|
public static Result<T> UnAuthorize(string msg = "unAuthorize")
|
||||||
{
|
{
|
||||||
return new Result<T>() { code = ResultCode.NoPermission, message = msg };
|
return new Result<T>() { code = ResultCodeEnum.NoPermission, message = msg };
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result<T> SetData(T TValue)
|
public Result<T> SetData(T TValue)
|
||||||
@@ -101,7 +101,7 @@ namespace Yi.Framework.Common.Models
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result<T> SetCode(ResultCode Code)
|
public Result<T> SetCode(ResultCodeEnum Code)
|
||||||
{
|
{
|
||||||
this.code = Code;
|
this.code = Code;
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
using Yi.Framework.Model.Models;
|
||||||
|
using Yi.Framework.Repository;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Interface
|
||||||
|
{
|
||||||
|
public partial interface IDictionaryService:IBaseService<DictionaryEntity>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +1,9 @@
|
|||||||
using System.Collections.Generic;
|
using Yi.Framework.Model.Models;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Yi.Framework.Model.Models;
|
|
||||||
using Yi.Framework.Repository;
|
using Yi.Framework.Repository;
|
||||||
|
|
||||||
namespace Yi.Framework.Interface
|
namespace Yi.Framework.Interface
|
||||||
{
|
{
|
||||||
public partial interface IMenuService : IBaseService<MenuEntity>
|
public partial interface IMenuService:IBaseService<MenuEntity>
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using SqlSugar;
|
||||||
|
namespace Yi.Framework.Model.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 字典表
|
||||||
|
///</summary>
|
||||||
|
[SugarTable("Dictionary")]
|
||||||
|
public partial class DictionaryEntity:IBaseModelEntity
|
||||||
|
{
|
||||||
|
public DictionaryEntity()
|
||||||
|
{
|
||||||
|
this.IsDeleted = false;
|
||||||
|
this.CreateTime = DateTime.Now;
|
||||||
|
}
|
||||||
|
[JsonConverter(typeof(ValueToStringConverter))]
|
||||||
|
[SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )]
|
||||||
|
public long Id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 字典类型
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="DictType" )]
|
||||||
|
public string DictType { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 字典标签
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="DictLabel" )]
|
||||||
|
public string DictLabel { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 字典值
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="DictValue" )]
|
||||||
|
public string DictValue { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 是否为该类型的默认值
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="IsDefault" )]
|
||||||
|
public bool? IsDefault { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建者
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="CreateUser" )]
|
||||||
|
public long? CreateUser { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="CreateTime" )]
|
||||||
|
public DateTime? CreateTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 修改者
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="ModifyUser" )]
|
||||||
|
public long? ModifyUser { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 修改时间
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="ModifyTime" )]
|
||||||
|
public DateTime? ModifyTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 是否删除
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="IsDeleted" )]
|
||||||
|
public bool? IsDeleted { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 租户Id
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="TenantId" )]
|
||||||
|
public long? TenantId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -70,14 +70,29 @@ namespace Yi.Framework.Model.Models
|
|||||||
[SugarColumn(ColumnName="TenantId" )]
|
[SugarColumn(ColumnName="TenantId" )]
|
||||||
public long? TenantId { get; set; }
|
public long? TenantId { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// 菜单图标
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarColumn(ColumnName="MenuIcon" )]
|
[SugarColumn(ColumnName="MenuIcon" )]
|
||||||
public string MenuIcon { get; set; }
|
public string MenuIcon { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// 菜单组件路由
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarColumn(ColumnName="Router" )]
|
[SugarColumn(ColumnName="Router" )]
|
||||||
public string Router { get; set; }
|
public string Router { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 是否为外部链接
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="IsLink" )]
|
||||||
|
public bool? IsLink { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 是否缓存
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="IsCache" )]
|
||||||
|
public bool? IsCache { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 是否显示
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName="IsShow" )]
|
||||||
|
public bool? IsShow { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 DictionaryService : BaseService<DictionaryEntity>, IDictionaryService
|
||||||
|
{
|
||||||
|
public DictionaryService(IRepository<DictionaryEntity> repository) : base(repository)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user