diff --git a/WebFirst/database/sqlite.db b/WebFirst/database/sqlite.db index 70e922b6..b49bcebf 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 2e26584c..5b5ff7b2 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml @@ -224,11 +224,25 @@ + + + 树形结构构建测试 + + + 用户管理 + + + 动态条件分页查询 + + + + + 更改用户状态 diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/LogController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/LogController.cs index 0b4d7231..ab1333dd 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/LogController.cs +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/LogController.cs @@ -35,10 +35,10 @@ namespace Yi.Framework.ApiMicroservice.Controllers { Random random = new Random(); var logList = new List() { - new LogEntity() { LogCreateTime = Convert.ToDateTime("2019-12-1"), Message = "jack"+random.Next() } , - new LogEntity() { LogCreateTime = Convert.ToDateTime("2022-02-1"), Message = "jack"+random.Next() }, - new LogEntity() { LogCreateTime = Convert.ToDateTime("2020-02-1"), Message = "jack"+random.Next() }, - new LogEntity() { LogCreateTime = Convert.ToDateTime("2021-12-1"), Message = "jack"+random.Next() } }; + new LogEntity() { CreateTime = Convert.ToDateTime("2019-12-1"), Message = "jack"+random.Next() } , + new LogEntity() { CreateTime = Convert.ToDateTime("2022-02-1"), Message = "jack"+random.Next() }, + new LogEntity() { CreateTime = Convert.ToDateTime("2020-02-1"), Message = "jack"+random.Next() }, + new LogEntity() { CreateTime = Convert.ToDateTime("2021-12-1"), Message = "jack"+random.Next() } }; return Result.Success().SetData(await _iLogService.AddListTest(logList)); } diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/UserController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/UserController.cs index 0a4b4055..436ccf56 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/UserController.cs +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/UserController.cs @@ -29,10 +29,16 @@ namespace Yi.Framework.ApiMicroservice.Controllers _iUserService = iUserService; } + /// + /// 动态条件分页查询 + /// + /// + /// + /// [HttpGet] - public async Task PageList([FromQuery]UserEntity user, [FromQuery] PageParModel page) + public async Task PageList([FromQuery] UserEntity user, [FromQuery] PageParModel page) { - return Result.Success().SetData(new PageModel(await _iUserService._repository.GetListAsync(),100) ); + return Result.Success().SetData(await _iUserService.SelctPageList(user, page)); } /// @@ -42,10 +48,10 @@ namespace Yi.Framework.ApiMicroservice.Controllers /// /// [HttpPut] - public async Task UpdateStatus(long userId,bool isDel) + public async Task UpdateStatus(long userId, bool isDel) { return Result.Success().SetData(await _iUserService._repository.UpdateIgnoreNullAsync(new UserEntity() { Id = userId, IsDeleted = isDel })); - + } @@ -56,7 +62,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers /// [Permission($"{nameof(UserEntity)}:add")] [HttpPost] - public override async Task Add(UserEntity entity) + public override async Task Add(UserEntity entity) { if (!await _iUserService.Exist(entity.UserName)) { 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 d933c4ae..5dfa25bd 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/PageParModel.cs b/Yi.Framework.Net6/Yi.Framework.Common/Models/PageParModel.cs index 20690108..e09fb507 100644 --- a/Yi.Framework.Net6/Yi.Framework.Common/Models/PageParModel.cs +++ b/Yi.Framework.Net6/Yi.Framework.Common/Models/PageParModel.cs @@ -11,5 +11,8 @@ namespace Yi.Framework.Common.Models { public int PageNum { get; set; } public int PageSize { get; set; } + + public DateTime? StartTime {get;set;} + public DateTime? EndTime { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/IDictionaryInfoService.cs b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/IDictionaryInfoService.cs new file mode 100644 index 00000000..7bf4b670 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/IDictionaryInfoService.cs @@ -0,0 +1,9 @@ +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; + +namespace Yi.Framework.Interface +{ + public partial interface IDictionaryInfoService:IBaseService + { + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/ILogService.cs b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/ILogService.cs index 7320c588..dc8bf5c6 100644 --- a/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/ILogService.cs +++ b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/ILogService.cs @@ -1,12 +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 ILogService : IBaseService - { - + public partial interface ILogService:IBaseService + { } } diff --git a/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/IRoleMenuService.cs b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/IRoleMenuService.cs new file mode 100644 index 00000000..a9a7479a --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/IRoleMenuService.cs @@ -0,0 +1,9 @@ +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; + +namespace Yi.Framework.Interface +{ + public partial interface IRoleMenuService:IBaseService + { + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/ITenantService.cs b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/ITenantService.cs new file mode 100644 index 00000000..31f8a4a9 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/ITenantService.cs @@ -0,0 +1,9 @@ +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; + +namespace Yi.Framework.Interface +{ + public partial interface ITenantService:IBaseService + { + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/IUserRoleService.cs b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/IUserRoleService.cs new file mode 100644 index 00000000..a299d0af --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Interface/IServiceTemplate/IUserRoleService.cs @@ -0,0 +1,9 @@ +using Yi.Framework.Model.Models; +using Yi.Framework.Repository; + +namespace Yi.Framework.Interface +{ + public partial interface IUserRoleService:IBaseService + { + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Interface/IUserService.cs b/Yi.Framework.Net6/Yi.Framework.Interface/IUserService.cs index bda0620d..488490e8 100644 --- a/Yi.Framework.Net6/Yi.Framework.Interface/IUserService.cs +++ b/Yi.Framework.Net6/Yi.Framework.Interface/IUserService.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Yi.Framework.Common.Models; using Yi.Framework.DTOModel; using Yi.Framework.Model.Models; using Yi.Framework.Repository; @@ -75,5 +76,13 @@ namespace Yi.Framework.Interface /// /// bool JudgePassword(UserEntity user, string password); + + /// + /// 动态条件分页查询 + /// + /// + /// + /// + Task>> SelctPageList(UserEntity user, PageParModel page); } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/LogEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/LogEntity.cs index 18aba3fb..a3951984 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/LogEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/LogEntity.cs @@ -12,7 +12,11 @@ namespace Yi.Framework.Model.Models public partial class LogEntity { [SplitField] //分表字段 在插入的时候会根据这个字段插入哪个表,在更新删除的时候用这个字段找出相关表 - public DateTime? LogCreateTime { get; set; } + /// + /// 创建时间 + /// + [SugarColumn(ColumnName = "CreateTime")] + public DateTime? CreateTime { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DictionaryEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DictionaryEntity.cs index 1b48af3e..23ac74bc 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DictionaryEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DictionaryEntity.cs @@ -20,26 +20,16 @@ namespace Yi.Framework.Model.Models [SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )] public long Id { get; set; } /// + /// 字典名称 + /// + [SugarColumn(ColumnName="DicName" )] + public string DicName { 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" )] @@ -69,5 +59,15 @@ namespace Yi.Framework.Model.Models /// [SugarColumn(ColumnName="TenantId" )] public long? TenantId { get; set; } + /// + /// 排序字段 + /// + [SugarColumn(ColumnName="OrderNum" )] + public int? OrderNum { get; set; } + /// + /// 描述 + /// + [SugarColumn(ColumnName="Remark" )] + public string Remark { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DictionaryInfoEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DictionaryInfoEntity.cs new file mode 100644 index 00000000..15d17ac2 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/DictionaryInfoEntity.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json.Serialization; +using SqlSugar; +namespace Yi.Framework.Model.Models +{ + /// + /// 字典信息表 + /// + [SugarTable("DictionaryInfo")] + public partial class DictionaryInfoEntity:IBaseModelEntity + { + public DictionaryInfoEntity() + { + 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; } + /// + /// 排序字段 + /// + [SugarColumn(ColumnName="OrderNum" )] + public int? OrderNum { get; set; } + /// + /// 描述 + /// + [SugarColumn(ColumnName="Remark" )] + public string Remark { get; set; } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/LogEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/LogEntity.cs index db54343a..6317608e 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/LogEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/LogEntity.cs @@ -1,12 +1,14 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Text.Json.Serialization; using SqlSugar; namespace Yi.Framework.Model.Models { /// /// 日志表 /// + public partial class LogEntity:IBaseModelEntity { public LogEntity() @@ -14,22 +16,15 @@ namespace Yi.Framework.Model.Models this.IsDeleted = false; this.CreateTime = DateTime.Now; } - /// - /// 1 - /// - [SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )] + [JsonConverter(typeof(ValueToStringConverter))] + [SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )] public long Id { get; set; } - /// /// 创建者 /// [SugarColumn(ColumnName="CreateUser" )] public long? CreateUser { get; set; } - /// - /// 创建时间 - /// - [SugarColumn(ColumnName="CreateTime" )] - public DateTime? CreateTime { get; set; } + /// /// 修改者 /// @@ -55,5 +50,15 @@ namespace Yi.Framework.Model.Models /// [SugarColumn(ColumnName="Message" )] public string Message { get; set; } + /// + /// 排序字段 + /// + [SugarColumn(ColumnName="OrderNum" )] + public int? OrderNum { get; set; } + /// + /// 描述 + /// + [SugarColumn(ColumnName="Remark" )] + public string Remark { 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 9217ae7e..e4eb303b 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/MenuEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/MenuEntity.cs @@ -94,5 +94,15 @@ namespace Yi.Framework.Model.Models /// [SugarColumn(ColumnName="IsShow" )] public bool? IsShow { get; set; } + /// + /// 排序字段 + /// + [SugarColumn(ColumnName="OrderNum" )] + public int? OrderNum { get; set; } + /// + /// 描述 + /// + [SugarColumn(ColumnName="Remark" )] + public string Remark { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/RoleEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/RoleEntity.cs index 99c9da38..024827e3 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/RoleEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/RoleEntity.cs @@ -59,5 +59,15 @@ namespace Yi.Framework.Model.Models /// [SugarColumn(ColumnName="RoleCode" )] public string RoleCode { get; set; } + /// + /// 排序字段 + /// + [SugarColumn(ColumnName="OrderNum" )] + public int? OrderNum { get; set; } + /// + /// 描述 + /// + [SugarColumn(ColumnName="Remark" )] + public string Remark { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/TenantEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/TenantEntity.cs index f3fdf91c..3c473c47 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/TenantEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/TenantEntity.cs @@ -54,5 +54,15 @@ namespace Yi.Framework.Model.Models /// [SugarColumn(ColumnName="TenantId" )] public long? TenantId { get; set; } + /// + /// 排序字段 + /// + [SugarColumn(ColumnName="OrderNum" )] + public int? OrderNum { get; set; } + /// + /// 描述 + /// + [SugarColumn(ColumnName="Remark" )] + public string Remark { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/UserEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/UserEntity.cs index 71eac2ad..ce0be875 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/UserEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/UserEntity.cs @@ -109,5 +109,15 @@ namespace Yi.Framework.Model.Models /// [SugarColumn(ColumnName="Introduction" )] public string Introduction { get; set; } + /// + /// 排序字段 + /// + [SugarColumn(ColumnName="OrderNum" )] + public int? OrderNum { get; set; } + /// + /// 描述 + /// + [SugarColumn(ColumnName="Remark" )] + public string Remark { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/DictionaryInfoService.cs b/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/DictionaryInfoService.cs new file mode 100644 index 00000000..7764cd2a --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/DictionaryInfoService.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 DictionaryInfoService : BaseService, IDictionaryInfoService + { + public DictionaryInfoService(IRepository repository) : base(repository) + { + } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/RoleMenuService.cs b/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/RoleMenuService.cs new file mode 100644 index 00000000..db43413e --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/RoleMenuService.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 RoleMenuService : BaseService, IRoleMenuService + { + public RoleMenuService(IRepository repository) : base(repository) + { + } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/TenantService.cs b/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/TenantService.cs new file mode 100644 index 00000000..6093f532 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/TenantService.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 TenantService : BaseService, ITenantService + { + public TenantService(IRepository repository) : base(repository) + { + } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/UserRoleService.cs b/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/UserRoleService.cs new file mode 100644 index 00000000..d48f838e --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Service/ServiceTemplate/UserRoleService.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 UserRoleService : BaseService, IUserRoleService + { + public UserRoleService(IRepository repository) : base(repository) + { + } + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Service/UserService.cs b/Yi.Framework.Net6/Yi.Framework.Service/UserService.cs index 84d3d9dd..5f052ab6 100644 --- a/Yi.Framework.Net6/Yi.Framework.Service/UserService.cs +++ b/Yi.Framework.Net6/Yi.Framework.Service/UserService.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using Yi.Framework.Common.Helper; +using Yi.Framework.Common.Models; using Yi.Framework.DTOModel; using Yi.Framework.Interface; using Yi.Framework.Model.Models; @@ -30,7 +31,7 @@ namespace Yi.Framework.Service } public async Task Exist(string userName, Action userAction = null) { - var user = await _repository.GetFirstAsync(u => u.UserName == userName&& u.IsDeleted==false); + var user = await _repository.GetFirstAsync(u => u.UserName == userName && u.IsDeleted == false); if (userAction != null) { userAction.Invoke(user); @@ -113,7 +114,7 @@ namespace Yi.Framework.Service //首先获取到该用户全部信息,导航到角色、菜单,(菜单需要去重,完全交给Set来处理即可) //得到用户 - var user = await _repository._Db.Queryable().Includes(u => u.Roles.Where(r=>r.IsDeleted==false).ToList(), r => r.Menus.Where(m=>m.IsDeleted==false).ToList()).InSingleAsync(userId); + var user = await _repository._Db.Queryable().Includes(u => u.Roles.Where(r => r.IsDeleted == false).ToList(), r => r.Menus.Where(m => m.IsDeleted == false).ToList()).InSingleAsync(userId); //得到角色集合 var roleList = user.Roles; @@ -140,12 +141,12 @@ namespace Yi.Framework.Service userRoleMenu.User = user; - + return userRoleMenu; } - public bool JudgePassword(UserEntity user,string password) + public bool JudgePassword(UserEntity user, string password) { if (user.Password == MD5Helper.SHA2Encode(password, user.Salt)) { @@ -153,5 +154,21 @@ namespace Yi.Framework.Service } return false; } + + + public async Task>> SelctPageList(UserEntity user, PageParModel page) + { + RefAsync total = 0; + var data = await _repository._Db.Queryable() + .WhereIF(!string.IsNullOrEmpty(user.UserName), u => u.UserName.Contains(user.UserName)) + .WhereIF(!string.IsNullOrEmpty(user.Name), u => u.Name.Contains(user.Name)) + .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) + .ToPageListAsync(page.PageNum, page.PageSize, total); + + return new PageModel>(data, total); + } } } diff --git a/Yi.Vue3.X.RuoYi/src/utils/ruoyi.js b/Yi.Vue3.X.RuoYi/src/utils/ruoyi.js index 908e39be..9a9dc3d3 100644 --- a/Yi.Vue3.X.RuoYi/src/utils/ruoyi.js +++ b/Yi.Vue3.X.RuoYi/src/utils/ruoyi.js @@ -59,10 +59,12 @@ export function addDateRange(params, dateRange, propName) { search.params = typeof (search.params) === 'object' && search.params !== null && !Array.isArray(search.params) ? search.params : {}; dateRange = Array.isArray(dateRange) ? dateRange : []; if (typeof (propName) === 'undefined') { - search.params['beginTime'] = dateRange[0]; - search.params['endTime'] = dateRange[1]; + // search.params['beginTime'] = dateRange[0]; + // search.params['endTime'] = dateRange[1]; + search.startTime=dateRange[0]; + search.endTime=dateRange[1]; } else { - search.params['begin' + propName] = dateRange[0]; + search.params['start' + propName] = dateRange[0]; search.params['end' + propName] = dateRange[1]; } return search; diff --git a/Yi.Vue3.X.RuoYi/src/views/system/user/index.vue b/Yi.Vue3.X.RuoYi/src/views/system/user/index.vue index c8336fe0..d80094ff 100644 --- a/Yi.Vue3.X.RuoYi/src/views/system/user/index.vue +++ b/Yi.Vue3.X.RuoYi/src/views/system/user/index.vue @@ -37,18 +37,18 @@ @keyup.enter="handleQuery" /> - + - +