diff --git a/WebFirst/database/sqlite.db b/WebFirst/database/sqlite.db index 3dc4e708..70e922b6 100644 Binary files a/WebFirst/database/sqlite.db and b/WebFirst/database/sqlite.db differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml index bc6619da..a7dd4771 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml @@ -229,6 +229,14 @@ 用户管理 + + + 更改用户状态 + + + + + 添加用户,去重,密码加密 diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/DictionaryController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/DictionaryController.cs new file mode 100644 index 00000000..ade553f0 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/DictionaryController.cs @@ -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 logger, IDictionaryService iDictionaryService) + { + _iDictionaryService = iDictionaryService; + } + + [HttpGet] + [Route("{type}")] + public async Task GetListByType([FromRoute] string type) + { + return Result.Success().SetData(await _iDictionaryService._repository.GetListAsync(u=>u.DictType==type&&u.IsDeleted==false)); + } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs index b2c3a03c..0b63c7d1 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs @@ -20,14 +20,20 @@ namespace Yi.Framework.ApiMicroservice.Controllers /// [ApiController] [Route("api/[controller]/[action]")] - public class MenuController : BaseCrudController + public class MenuController { private IMenuService _iMenuService; - public MenuController(ILogger logger, IMenuService iMenuService) : base(logger, iMenuService) + public MenuController(ILogger logger, IMenuService iMenuService) { _iMenuService = iMenuService; } + [HttpGet] + public async Task GetList() + { + return Result.Success().SetData(await _iMenuService._repository.GetListAsync()); + } + /// @@ -35,7 +41,6 @@ namespace Yi.Framework.ApiMicroservice.Controllers /// /// [HttpGet] - //暂未制作逻辑删除与多租户的过滤 public async Task GetMenuTree() { 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 4ce473d8..cefe4d83 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs @@ -29,6 +29,12 @@ namespace Yi.Framework.ApiMicroservice.Controllers _iRoleService = iRoleService; } + [HttpGet] + public async Task PageList() + { + return Result.Success().SetData(await _iRoleService._repository.GetListAsync()); + } + /// /// 给多用户设置多角色 /// diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/UserController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/UserController.cs index ffe3831c..8642a4ff 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/UserController.cs +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/UserController.cs @@ -29,6 +29,26 @@ namespace Yi.Framework.ApiMicroservice.Controllers _iUserService = iUserService; } + [HttpGet] + public async Task PageList() + { + return Result.Success().SetData(await _iUserService._repository.GetListAsync()); + } + + /// + /// 更改用户状态 + /// + /// + /// + /// + [HttpPut] + public async Task UpdateStatus(long userId,bool isDel) + { + return Result.Success().SetData(await _iUserService._repository.UpdateIgnoreNullAsync(new UserEntity() { Id = userId, IsDeleted = isDel })); + + } + + /// /// 添加用户,去重,密码加密 /// 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 0d525280..d933c4ae 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.Common/Models/Enum/AgrFlagEnum.cs b/Yi.Framework.Net6/Yi.Framework.Common/Enum/AgrFlagEnum.cs similarity index 100% rename from Yi.Framework.Net6/Yi.Framework.Common/Models/Enum/AgrFlagEnum.cs rename to Yi.Framework.Net6/Yi.Framework.Common/Enum/AgrFlagEnum.cs diff --git a/Yi.Framework.Net6/Yi.Framework.Common/Models/Enum/DelFlagEnum.cs b/Yi.Framework.Net6/Yi.Framework.Common/Enum/DelFlagEnum.cs similarity index 100% rename from Yi.Framework.Net6/Yi.Framework.Common/Models/Enum/DelFlagEnum.cs rename to Yi.Framework.Net6/Yi.Framework.Common/Enum/DelFlagEnum.cs diff --git a/Yi.Framework.Net6/Yi.Framework.Common/Enum/MenuTypeEnum.cs b/Yi.Framework.Net6/Yi.Framework.Common/Enum/MenuTypeEnum.cs new file mode 100644 index 00000000..d1998e63 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Common/Enum/MenuTypeEnum.cs @@ -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//组件 + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Common/Models/Enum/ResultCode.cs b/Yi.Framework.Net6/Yi.Framework.Common/Enum/ResultCodeEnum.cs similarity index 91% rename from Yi.Framework.Net6/Yi.Framework.Common/Models/Enum/ResultCode.cs rename to Yi.Framework.Net6/Yi.Framework.Common/Enum/ResultCodeEnum.cs index 3e049148..c3fdd7fb 100644 --- a/Yi.Framework.Net6/Yi.Framework.Common/Models/Enum/ResultCode.cs +++ b/Yi.Framework.Net6/Yi.Framework.Common/Enum/ResultCodeEnum.cs @@ -4,9 +4,9 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace Yi.Framework.Common.Models.Enum +namespace Yi.Framework.Common.Enum { - public enum ResultCode + public enum ResultCodeEnum { /// /// 操作成功。 diff --git a/Yi.Framework.Net6/Yi.Framework.Common/Models/Enum/ShowFlagEnum.cs b/Yi.Framework.Net6/Yi.Framework.Common/Enum/ShowFlagEnum.cs similarity index 100% rename from Yi.Framework.Net6/Yi.Framework.Common/Models/Enum/ShowFlagEnum.cs rename to Yi.Framework.Net6/Yi.Framework.Common/Enum/ShowFlagEnum.cs diff --git a/Yi.Framework.Net6/Yi.Framework.Common/Models/Enum/TopFlagEnum.cs b/Yi.Framework.Net6/Yi.Framework.Common/Enum/TopFlagEnum.cs similarity index 100% rename from Yi.Framework.Net6/Yi.Framework.Common/Models/Enum/TopFlagEnum.cs rename to Yi.Framework.Net6/Yi.Framework.Common/Enum/TopFlagEnum.cs diff --git a/Yi.Framework.Net6/Yi.Framework.Common/Models/Enum/WriteAndReadEnum.cs b/Yi.Framework.Net6/Yi.Framework.Common/Enum/WriteAndReadEnum.cs similarity index 100% rename from Yi.Framework.Net6/Yi.Framework.Common/Models/Enum/WriteAndReadEnum.cs rename to Yi.Framework.Net6/Yi.Framework.Common/Enum/WriteAndReadEnum.cs diff --git a/Yi.Framework.Net6/Yi.Framework.Common/Models/Result.cs b/Yi.Framework.Net6/Yi.Framework.Common/Models/Result.cs index 12184c4f..8551c4a0 100644 --- a/Yi.Framework.Net6/Yi.Framework.Common/Models/Result.cs +++ b/Yi.Framework.Net6/Yi.Framework.Common/Models/Result.cs @@ -1,5 +1,5 @@ using Microsoft.Extensions.Localization; -using Yi.Framework.Common.Models.Enum; +using Yi.Framework.Common.Enum; using Yi.Framework.Language; namespace Yi.Framework.Common.Models @@ -7,32 +7,32 @@ namespace Yi.Framework.Common.Models public class Result { public static IStringLocalizer _local; - public ResultCode code { get; set; } + public ResultCodeEnum code { get; set; } public bool status { get; set; } public string message { 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") }; } 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 = "") { - 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 = "") { - 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 = "") { - 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) { @@ -52,7 +52,7 @@ namespace Yi.Framework.Common.Models this.data = obj; return this; } - public Result SetCode(ResultCode Code) + public Result SetCode(ResultCodeEnum Code) { this.code = Code; return this; @@ -79,20 +79,20 @@ namespace Yi.Framework.Common.Models } public class Result { - public ResultCode code { get; set; } + public ResultCodeEnum code { get; set; } public string message { get; set; } public T data { get; set; } public static Result Error(string msg = "fail") { - return new Result() { code = ResultCode.NotSuccess, message = msg }; + return new Result() { code = ResultCodeEnum.NotSuccess, message = msg }; } public static Result Success(string msg = "succeed") { - return new Result() { code = ResultCode.Success, message = msg }; + return new Result() { code = ResultCodeEnum.Success, message = msg }; } public static Result UnAuthorize(string msg = "unAuthorize") { - return new Result() { code = ResultCode.NoPermission, message = msg }; + return new Result() { code = ResultCodeEnum.NoPermission, message = msg }; } public Result SetData(T TValue) @@ -101,7 +101,7 @@ namespace Yi.Framework.Common.Models return this; } - public Result SetCode(ResultCode Code) + public Result SetCode(ResultCodeEnum Code) { this.code = Code; return this; diff --git a/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/IDictionaryService.cs b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/IDictionaryService.cs new file mode 100644 index 00000000..6fbea5da --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/IDictionaryService.cs @@ -0,0 +1,9 @@ +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; + +namespace Yi.Framework.Interface +{ + public partial interface IDictionaryService:IBaseService + { + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/IMenuService.cs b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/IMenuService.cs index f93cf04b..413a0ade 100644 --- a/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/IMenuService.cs +++ b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/IMenuService.cs @@ -1,11 +1,9 @@ -using System.Collections.Generic; -using System.Threading.Tasks; -using Yi.Framework.Model.Models; +using Yi.Framework.Model.Models; using Yi.Framework.Repository; namespace Yi.Framework.Interface { - public partial interface IMenuService : IBaseService - { + public partial interface IMenuService:IBaseService + { } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DictionaryEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DictionaryEntity.cs new file mode 100644 index 00000000..1b48af3e --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DictionaryEntity.cs @@ -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 +{ + /// + /// 字典表 + /// + [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; } + /// + /// 字典类型 + /// + [SugarColumn(ColumnName="DictType" )] + public string DictType { get; set; } + /// + /// 字典标签 + /// + [SugarColumn(ColumnName="DictLabel" )] + public string DictLabel { get; set; } + /// + /// 字典值 + /// + [SugarColumn(ColumnName="DictValue" )] + public string DictValue { get; set; } + /// + /// 是否为该类型的默认值 + /// + [SugarColumn(ColumnName="IsDefault" )] + public bool? IsDefault { 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/ModelsTemplate/MenuEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/MenuEntity.cs index b32d3177..9217ae7e 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/MenuEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/MenuEntity.cs @@ -70,14 +70,29 @@ namespace Yi.Framework.Model.Models [SugarColumn(ColumnName="TenantId" )] public long? TenantId { get; set; } /// - /// + /// 菜单图标 /// [SugarColumn(ColumnName="MenuIcon" )] public string MenuIcon { get; set; } /// - /// + /// 菜单组件路由 /// [SugarColumn(ColumnName="Router" )] public string Router { get; set; } + /// + /// 是否为外部链接 + /// + [SugarColumn(ColumnName="IsLink" )] + public bool? IsLink { get; set; } + /// + /// 是否缓存 + /// + [SugarColumn(ColumnName="IsCache" )] + public bool? IsCache { get; set; } + /// + /// 是否显示 + /// + [SugarColumn(ColumnName="IsShow" )] + public bool? IsShow { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/DictionaryService.cs b/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/DictionaryService.cs new file mode 100644 index 00000000..d2229e27 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/DictionaryService.cs @@ -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, IDictionaryService + { + public DictionaryService(IRepository repository) : base(repository) + { + } + } +}