菜单类型接口
This commit is contained in:
@@ -25,6 +25,13 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
_iDictionaryService = iDictionaryService;
|
_iDictionaryService = iDictionaryService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<Result> PageList([FromQuery] DictionaryEntity dic, [FromQuery] PageParModel page)
|
||||||
|
{
|
||||||
|
return Result.Success().SetData(await _iDictionaryService.SelctPageList(dic, page));
|
||||||
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("{type}")]
|
[Route("{type}")]
|
||||||
public async Task<Result> GetListByType([FromRoute] string type)
|
public async Task<Result> GetListByType([FromRoute] string type)
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Yi.Framework.Common.Models;
|
||||||
|
using Yi.Framework.Model.Models;
|
||||||
|
using Yi.Framework.Repository;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Interface
|
||||||
|
{
|
||||||
|
public partial interface IDictionaryService:IBaseService<DictionaryEntity>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 动态条件分页查询
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dic"></param>
|
||||||
|
/// <param name="page"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<PageModel<List<DictionaryEntity>>> SelctPageList(DictionaryEntity dic, PageParModel page);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -28,6 +28,13 @@ namespace Yi.Framework.Interface
|
|||||||
/// <param name="menuIds"></param>
|
/// <param name="menuIds"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<bool> GiveRoleSetMenu(List<long> roleIds, List<long> menuIds);
|
Task<bool> GiveRoleSetMenu(List<long> roleIds, List<long> menuIds);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 动态条件分页查询
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="role"></param>
|
||||||
|
/// <param name="page"></param>
|
||||||
|
/// <returns></returns>
|
||||||
Task<PageModel<List<RoleEntity>>> SelctPageList(RoleEntity role, PageParModel page);
|
Task<PageModel<List<RoleEntity>>> SelctPageList(RoleEntity role, PageParModel page);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ namespace Yi.Framework.Repository
|
|||||||
{
|
{
|
||||||
public interface IRepository<T> : ISimpleClient<T> where T : class, IBaseModelEntity, new()
|
public interface IRepository<T> : ISimpleClient<T> where T : class, IBaseModelEntity, new()
|
||||||
{
|
{
|
||||||
|
public ISugarQueryable<T> _DbQueryable { get; set; }
|
||||||
public ISqlSugarClient _Db { get; set; }
|
public ISqlSugarClient _Db { get; set; }
|
||||||
public Task<bool> UseTranAsync(Func<Task> func);
|
public Task<bool> UseTranAsync(Func<Task> func);
|
||||||
public Task<T> InsertReturnEntityAsync(T entity);
|
public Task<T> InsertReturnEntityAsync(T entity);
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ namespace Yi.Framework.Repository
|
|||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T"></typeparam>
|
||||||
public class Repository<T> : SimpleClient<T>, IRepository<T> where T : class, IBaseModelEntity, new()
|
public class Repository<T> : SimpleClient<T>, IRepository<T> where T : class, IBaseModelEntity, new()
|
||||||
{
|
{
|
||||||
|
public ISugarQueryable<T> _DbQueryable { get { return base.Context.Queryable<T>(); } set { } }
|
||||||
|
|
||||||
public ISqlSugarClient _Db { get { return base.Context; } set { } }
|
public ISqlSugarClient _Db { get { return base.Context; } set { } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 构造函数
|
/// 构造函数
|
||||||
|
|||||||
29
Yi.Framework.Net6/Yi.Framework.Service/DictionaryService.cs
Normal file
29
Yi.Framework.Net6/Yi.Framework.Service/DictionaryService.cs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Service
|
||||||
|
{
|
||||||
|
public partial class DictionaryService : BaseService<DictionaryEntity>, IDictionaryService
|
||||||
|
{
|
||||||
|
public async Task<PageModel<List<DictionaryEntity>>> SelctPageList(DictionaryEntity dic, PageParModel page)
|
||||||
|
{
|
||||||
|
RefAsync<int> total = 0;
|
||||||
|
var data = await _repository._DbQueryable
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(dic.DicName), u => u.DicName.Contains(dic.DicName))
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(dic.DictType), u => u.DictType.Contains(dic.DictType))
|
||||||
|
.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, OrderByType.Desc)
|
||||||
|
.ToPageListAsync(page.PageNum, page.PageSize, total);
|
||||||
|
|
||||||
|
return new PageModel<List<DictionaryEntity>>(data, total);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@ import request from '@/utils/request'
|
|||||||
// 查询字典类型列表
|
// 查询字典类型列表
|
||||||
export function listType(query) {
|
export function listType(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/dict/type/list',
|
url: '/dictionary/pageList',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user