Skip to content

Commit

Permalink
feat: dict list functionality temp stage
Browse files Browse the repository at this point in the history
  • Loading branch information
lzw5399 committed Apr 29, 2020
1 parent 9f2789c commit bf2f8e4
Show file tree
Hide file tree
Showing 10 changed files with 135 additions and 11 deletions.
10 changes: 0 additions & 10 deletions dl-api-csharp/Doublelives.Api/Controllers/AuthControllerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,5 @@ public override OkObjectResult Ok([ActionResultObjectValue] object value)

return base.Ok(response);
}

//public new OkObjectResult Ok()
//{
// var response = new ResponseBase
// {
// Data = string.Empty
// };

// return base.Ok(response);
//}
}
}
29 changes: 29 additions & 0 deletions dl-api-csharp/Doublelives.Api/Controllers/DictController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Doublelives.Api.Mappers;
using Doublelives.Api.Models.Dicts.Requests;
using Doublelives.Service.Dicts;
using Doublelives.Service.WorkContextAccess;
using Microsoft.AspNetCore.Mvc;

namespace Doublelives.Api.Controllers
{
public class DictController : AuthControllerBase
{
private readonly IDictService _dictService;

public DictController(
IWorkContextAccessor workContextAccessor,
IDictService dictService)
: base(workContextAccessor)
{
_dictService = dictService;
}

[HttpGet("list")]
public IActionResult List([FromQuery]DictListSearchRequest request)
{
var result = _dictService.GetPagedList(DictMapper.ToDictSearchDto(request));

return Ok("");
}
}
}
20 changes: 20 additions & 0 deletions dl-api-csharp/Doublelives.Api/Mappers/DictMapper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Doublelives.Api.Models.Dicts.Requests;
using Doublelives.Domain.Sys.Dto;

namespace Doublelives.Api.Mappers
{
public class DictMapper
{
public static DictSearchDto ToDictSearchDto(DictListSearchRequest request)
{
var dto = new DictSearchDto
{
Limit = request.Limit == 0 ? 20 : request.Limit,
Page = request.Page == 0 ? 1 : request.Page,
Name = request.Name
};

return dto;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Doublelives.Api.Models.Dicts.Requests
{
public class DictListSearchRequest : BasePagedListRequest
{
public string Name { get; set; }
}
}
2 changes: 2 additions & 0 deletions dl-api-csharp/Doublelives.Core/DIConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Doublelives.Infrastructure.Cache;
using Doublelives.Persistence;
using Doublelives.Service.Depts;
using Doublelives.Service.Dicts;
using Doublelives.Service.Menus;
using Doublelives.Service.Notices;
using Doublelives.Service.Pictures;
Expand Down Expand Up @@ -36,6 +37,7 @@ private static void ConfigureServices(IServiceCollection services, IConfiguratio
services.AddScoped<IDeptService, DeptService>();
services.AddScoped<IRoleService, RoleService>();
services.AddScoped<ITaskService, TaskService>();
services.AddScoped<IDictService, DictService>();
}

private static void ConfigurePersistence(IServiceCollection services, IConfiguration configuration)
Expand Down
33 changes: 33 additions & 0 deletions dl-api-csharp/Doublelives.Domain/Sys/Dto/DictProfileDto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;

namespace Doublelives.Domain.Sys.Dto
{
public class DictProfileDto
{
public int Id { get; set; }

public string Name { get; set; }

public string Num { get; set; }

/// <summary>
/// 上级dict的id
/// </summary>
public int? Pid { get; set; }

/// <summary>
/// 所有的下级的字典内容的信息 e.g."1:启用,2:禁用"
/// </summary>
public string Detail { get; set; }

public string Tips { get; set; }

public DateTime? CreateTime { get; set; }

public int? CreateBy { get; set; }

public DateTime? ModifyTime { get; set; }

public int? ModifyBy { get; set; }
}
}
7 changes: 7 additions & 0 deletions dl-api-csharp/Doublelives.Domain/Sys/Dto/DictSearchDto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Doublelives.Domain.Sys.Dto
{
public class DictSearchDto : BasePagedListDto
{
public string Name { get; set; }
}
}
22 changes: 22 additions & 0 deletions dl-api-csharp/Doublelives.Service/Dicts/DictService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Doublelives.Domain.Sys;
using Doublelives.Domain.Sys.Dto;
using Doublelives.Persistence;
using Doublelives.Shared.Models;

namespace Doublelives.Service.Dicts
{
public class DictService : IDictService
{
private readonly IUnitOfWork _unitOfWork;

public DictService(IUnitOfWork unitOfWork)
{
_unitOfWork = unitOfWork;
}

public PagedModel<DictProfileDto> GetPagedList(DictSearchDto criteria)
{
throw new System.NotImplementedException();
}
}
}
14 changes: 14 additions & 0 deletions dl-api-csharp/Doublelives.Service/Dicts/IDictService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Doublelives.Domain.Sys;
using Doublelives.Domain.Sys.Dto;
using Doublelives.Shared.Models;

namespace Doublelives.Service.Dicts
{
public interface IDictService
{
/// <summary>
/// 获取分页数据
/// </summary>
PagedModel<DictProfileDto> GetPagedList(DictSearchDto criteria);
}
}
2 changes: 1 addition & 1 deletion dl-api-csharp/Doublelives.Service/Roles/IRoleService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public interface IRoleService
List<SysRole> GetListByIds(List<int> ids);

/// <summary>
/// 获取所有的role
/// 获取分页的role
/// </summary>
PagedModel<RoleProfileDto> GetPagedList(RoleSearchDto criteria);
}
Expand Down

0 comments on commit bf2f8e4

Please sign in to comment.