update 新增获取字典数据合并接口
This commit is contained in:
@@ -4014,6 +4014,11 @@
|
||||
编码
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Core.Service.DropDownDictTypesInput.Code">
|
||||
<summary>
|
||||
编码
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ewide.Core.Service.SysDictDataService">
|
||||
<summary>
|
||||
字典值服务
|
||||
@@ -4104,6 +4109,13 @@
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Ewide.Core.Service.SysDictTypeService.GetDictTypeDropDowns(Ewide.Core.Service.DropDownDictTypesInput)">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Ewide.Core.Service.SysDictTypeService.AddDictType(Ewide.Core.Service.AddDictTypeInput)">
|
||||
<summary>
|
||||
添加字典类型
|
||||
|
||||
@@ -75,6 +75,15 @@ namespace Ewide.Core.Service
|
||||
public string Code { get; set; }
|
||||
}
|
||||
|
||||
public class DropDownDictTypesInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 编码
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "字典类型编码不能为空")]
|
||||
public string[] Code { get; set; }
|
||||
}
|
||||
|
||||
public class QueryDictTypeInfoInput : DeleteDictTypeInput
|
||||
{
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace Ewide.Core.Service
|
||||
Task<dynamic> GetDictData([FromQuery] QueryDictDataInput input);
|
||||
Task<dynamic> GetDictDataList([FromQuery] QueryDictDataListInput input);
|
||||
Task<dynamic> GetDictDataListByDictTypeId(string dictTypeId);
|
||||
Task<dynamic> GetDictDataListByDictTypeIds(SysDictType[] dictTypes);
|
||||
Task<dynamic> QueryDictDataPageList([FromQuery] DictDataInput input);
|
||||
Task UpdateDictData(UpdateDictDataInput input);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace Ewide.Core.Service
|
||||
Task<List<DictTreeOutput>> GetDictTree();
|
||||
Task<dynamic> GetDictType([FromQuery] QueryDictTypeInfoInput input);
|
||||
Task<dynamic> GetDictTypeDropDown([FromQuery] DropDownDictTypeInput input);
|
||||
Task<dynamic> GetDictTypeDropDowns([FromQuery] DropDownDictTypesInput input);
|
||||
Task<dynamic> GetDictTypeList();
|
||||
Task<dynamic> QueryDictTypePageList([FromQuery] DictTypeInput input);
|
||||
Task UpdateDictType(UpdateDictTypeInput input);
|
||||
|
||||
@@ -10,6 +10,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ewide.Core.Service
|
||||
{
|
||||
@@ -150,6 +151,27 @@ namespace Ewide.Core.Service
|
||||
}).ToListAsync();
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
public async Task<dynamic> GetDictDataListByDictTypeIds(SysDictType[] dictTypes)
|
||||
{
|
||||
var dictTypeIds = dictTypes.Select(u => u.Id);
|
||||
var dictData = await _sysDictDataRep.DetachedEntities.Where(u => dictTypeIds.Contains(u.SysDictType.Id))
|
||||
.Where(u => u.Status != CommonStatus.DELETED).OrderBy(u => u.Sort)
|
||||
.ToListAsync();
|
||||
var result = new Dictionary<string, dynamic>();
|
||||
foreach (var dictType in dictTypes)
|
||||
{
|
||||
result.Add(dictType.Code, dictData.Where(u => u.TypeId == dictType.Id)
|
||||
.Select(u => new
|
||||
{
|
||||
u.Code,
|
||||
u.Value,
|
||||
u.Remark
|
||||
}));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除字典下所有值
|
||||
/// </summary>
|
||||
|
||||
@@ -64,7 +64,6 @@ namespace Ewide.Core.Service
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
[HttpGet("/sysDictType/dropDown")]
|
||||
public async Task<dynamic> GetDictTypeDropDown([FromQuery] DropDownDictTypeInput input)
|
||||
{
|
||||
@@ -73,6 +72,19 @@ namespace Ewide.Core.Service
|
||||
return await _sysDictDataService.GetDictDataListByDictTypeId(dictType.Id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("/sysDictType/dropDowns")]
|
||||
public async Task<dynamic> GetDictTypeDropDowns([FromQuery] DropDownDictTypesInput input)
|
||||
{
|
||||
var dictTypes = await _sysDictTypeRep.Where(u => input.Code.Contains(u.Code), false).ToArrayAsync();
|
||||
if (dictTypes.Length == 0) throw Oops.Oh(ErrorCode.D3000);
|
||||
return await _sysDictDataService.GetDictDataListByDictTypeIds(dictTypes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加字典类型
|
||||
/// </summary>
|
||||
|
||||
@@ -71,5 +71,19 @@
|
||||
"maxSize": 1048576,
|
||||
"contentType": [ "image/jpg", "image/png", "image/jpeg", "image/gif", "image/bmp", "text/plain", "application/pdf", "application/msword", "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.presentationml.presentation" ]
|
||||
}
|
||||
},
|
||||
|
||||
"CoreSettings": {
|
||||
"DefalutRoute": [
|
||||
"getLoginUser",
|
||||
"logout",
|
||||
"sysDictType:dropDown",
|
||||
"sysFileInfo:upload",
|
||||
"sysFileInfo:download",
|
||||
"sysFileInfo:preview",
|
||||
"sysUser:updateInfo",
|
||||
"sysUser:updatePwd",
|
||||
"sysUser:updateAvatar"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -20,10 +20,4 @@
|
||||
<ProjectReference Include="..\Ewide.Database.Migrations\Ewide.Database.Migrations.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="core.settings.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"CoreSettings": {
|
||||
"DefalutRoute": [
|
||||
"getLoginUser",
|
||||
"logout",
|
||||
"sysFileInfo:upload",
|
||||
"sysFileInfo:download",
|
||||
"sysFileInfo:preview",
|
||||
"sysUser:updateInfo",
|
||||
"sysUser:updatePwd",
|
||||
"sysUser:updateAvatar"
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user