Merge branch 'master' of http://192.168.1.2:8033/IRaCIS_Core_Api
This commit is contained in:
@@ -165,7 +165,40 @@ namespace IRaCIS.Application.Contracts
|
||||
|
||||
|
||||
|
||||
public class AddBasicDicAndChild
|
||||
{
|
||||
[NotDefault]
|
||||
public Guid ConfigTypeId { get; set; }
|
||||
|
||||
public bool IsEnable { get; set; }
|
||||
|
||||
public string Code { get; set; } = String.Empty;
|
||||
|
||||
public int ShowOrder { get; set; }
|
||||
public string Description { get; set; } = String.Empty;
|
||||
|
||||
public DicDataTypeEnum DataTypeEnum { get; set; }
|
||||
|
||||
|
||||
public List<AddBasicDicChild> ChildList { get; set; } = new List<AddBasicDicChild>();
|
||||
}
|
||||
|
||||
|
||||
public class AddBasicDicChild
|
||||
{
|
||||
public string Code { get; set; } = String.Empty;
|
||||
public string Value { get; set; } = String.Empty;
|
||||
|
||||
public string ValueCN { get; set; } = String.Empty;
|
||||
|
||||
public string ChildGroup { get; set; } = String.Empty;
|
||||
|
||||
public int ShowOrder { get; set; }
|
||||
|
||||
public string Description { get; set; } = String.Empty;
|
||||
|
||||
public bool IsEnable { get; set; } = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -38,13 +38,37 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
public Guid? Id { get; set; }
|
||||
public int State { get; set; }
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public string Code { get; set; }
|
||||
public string Code { get; set; } = string.Empty;
|
||||
public string Value { get; set; } = string.Empty;
|
||||
public string ValueCN { get; set; } = string.Empty;
|
||||
|
||||
public int InternationalizationType { get; set; }
|
||||
}
|
||||
|
||||
public class BatchAddInternationalization
|
||||
{
|
||||
public int InternationalizationType { get; set; }
|
||||
|
||||
public int State { get; set; }
|
||||
|
||||
public List<BatchAddInternationalizationDto> AddList { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class BatchAddInternationalizationDto
|
||||
{
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public string Code { get; set; } = string.Empty;
|
||||
public string Value { get; set; } = string.Empty;
|
||||
public string ValueCN { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class InternationalizationSimpleDto
|
||||
{
|
||||
public string Code { get; set; } = string.Empty;
|
||||
public string Value { get; set; } = string.Empty;
|
||||
public string ValueCN { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -88,6 +88,39 @@ namespace IRaCIS.Application.Services
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 添加字典 的同时 一起添加子项 --New
|
||||
/// </summary>
|
||||
/// <param name="addBasicDicAndChild"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput> AddBasicDicAndChild(AddBasicDicAndChild addBasicDicAndChild)
|
||||
{
|
||||
var verifyExp1 = new EntityVerifyExp<Dictionary>()
|
||||
{
|
||||
VerifyExp = t => t.Code == addBasicDicAndChild.Code && t.ParentId == null,
|
||||
VerifyMsg = $"已有{addBasicDicAndChild.Code}名称的字典",
|
||||
IsVerify = true
|
||||
};
|
||||
|
||||
|
||||
var entity = await _dicRepository.InsertFromDTOAsync(addBasicDicAndChild, false, verifyExp1);
|
||||
|
||||
var childList = _mapper.Map<List<Dictionary>>(addBasicDicAndChild.ChildList);
|
||||
|
||||
foreach (var item in childList)
|
||||
{
|
||||
item.DataTypeEnum = addBasicDicAndChild.DataTypeEnum;
|
||||
item.ParentId = entity.Id;
|
||||
}
|
||||
|
||||
await _dicRepository.AddRangeAsync(childList);
|
||||
|
||||
await _dicRepository.SaveChangesAsync();
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// New 查询条件
|
||||
/// </summary>
|
||||
|
||||
@@ -8,6 +8,9 @@ using IRaCIS.Core.Domain.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Application.Interfaces;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using IRaCIS.Core.Application.Helper;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
/// <summary>
|
||||
@@ -24,27 +27,70 @@ namespace IRaCIS.Core.Application.Service
|
||||
_internationalizationRepository = internationalizationRepository;
|
||||
}
|
||||
|
||||
|
||||
[AllowAnonymous]
|
||||
|
||||
public async Task<List<InternationalizationSimpleDto>> GetFrontInternationalizationList()
|
||||
{
|
||||
|
||||
var list = await _internationalizationRepository.Where(t => t.InternationalizationType == 0).Select(t => new InternationalizationSimpleDto()
|
||||
{
|
||||
Code = t.Code,
|
||||
Value = t.Value,
|
||||
ValueCN = t.ValueCN
|
||||
}).ToListAsync();
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<PageOutput<InternationalizationView>> GetInternationalizationList(InternationalizationQuery inQuery)
|
||||
{
|
||||
|
||||
var internationalizationQueryable =_internationalizationRepository
|
||||
.WhereIf(inQuery.Description!=null,t=>t.Description.Contains(inQuery.Description))
|
||||
var internationalizationQueryable = _internationalizationRepository
|
||||
.WhereIf(inQuery.Description != null, t => t.Description.Contains(inQuery.Description))
|
||||
.WhereIf(inQuery.Code != null, t => t.Code.Contains(inQuery.Code))
|
||||
.WhereIf(inQuery.State != null, t => t.State==inQuery.State)
|
||||
.WhereIf(inQuery.InternationalizationType != null, t => t.InternationalizationType == inQuery.InternationalizationType)
|
||||
|
||||
.WhereIf(inQuery.State != null, t => t.State == inQuery.State)
|
||||
.WhereIf(inQuery.InternationalizationType != null, t => t.InternationalizationType == inQuery.InternationalizationType)
|
||||
.WhereIf(inQuery.Value != null, t => t.Value.Contains(inQuery.Value))
|
||||
.WhereIf(inQuery.ValueCN != null, t => t.ValueCN.Contains(inQuery.ValueCN))
|
||||
.ProjectTo<InternationalizationView>(_mapper.ConfigurationProvider);
|
||||
.WhereIf(inQuery.ValueCN != null, t => t.ValueCN.Contains(inQuery.ValueCN))
|
||||
.ProjectTo<InternationalizationView>(_mapper.ConfigurationProvider);
|
||||
|
||||
var pageList = await internationalizationQueryable
|
||||
.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? "Id" : inQuery.SortField,
|
||||
.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(InternationalizationView.State) : inQuery.SortField,
|
||||
inQuery.Asc);
|
||||
|
||||
return pageList;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput> BatchAddInternationalization(BatchAddInternationalization batchAdd)
|
||||
{
|
||||
foreach (var item in batchAdd.AddList)
|
||||
{
|
||||
|
||||
var mapItem = _mapper.Map<InternationalizationAddOrEdit>(item);
|
||||
|
||||
mapItem.InternationalizationType = batchAdd.InternationalizationType;
|
||||
mapItem.State = batchAdd.State;
|
||||
|
||||
var verifyExp1 = new EntityVerifyExp<Internationalization>()
|
||||
{
|
||||
VerifyExp = t => t.Code == mapItem.Code && t.InternationalizationType == mapItem.InternationalizationType,
|
||||
|
||||
VerifyMsg = $"该类型已有{item.Code}名称的国际化标识",
|
||||
IsVerify = true
|
||||
};
|
||||
|
||||
var entity = await _internationalizationRepository.InsertOrUpdateAsync(mapItem, false, verifyExp1);
|
||||
}
|
||||
|
||||
await _internationalizationRepository.SaveChangesAsync();
|
||||
|
||||
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
public async Task<IResponseOutput> AddOrUpdateInternationalization(InternationalizationAddOrEdit addOrEditInternationalization)
|
||||
{
|
||||
@@ -56,7 +102,13 @@ namespace IRaCIS.Core.Application.Service
|
||||
IsVerify = true
|
||||
};
|
||||
|
||||
var entity = await _internationalizationRepository.InsertOrUpdateAsync(addOrEditInternationalization, true,verifyExp1);
|
||||
var entity = await _internationalizationRepository.InsertOrUpdateAsync(addOrEditInternationalization, true, verifyExp1);
|
||||
|
||||
if (addOrEditInternationalization.InternationalizationType == 1)
|
||||
{
|
||||
await InternationalizationHelper.AddOrUpdateJsonKeyValueAsync(entity.Code, entity.Value, entity.ValueCN);
|
||||
|
||||
}
|
||||
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
|
||||
|
||||
@@ -39,6 +39,10 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
CreateMap<AddOrEditBasicDic, Dictionary>().ReverseMap();
|
||||
|
||||
|
||||
CreateMap<AddBasicDicAndChild, Dictionary>().ForMember(o => o.ChildList, t => t.Ignore());
|
||||
CreateMap<AddBasicDicChild, Dictionary>();
|
||||
|
||||
CreateMap<Dictionary, BasicDicSelectCopy>()
|
||||
.ForMember(o => o.ParentChildCodeEnum, t => t.MapFrom(u => u.Parent.ChildCodeEnum))
|
||||
.ForMember(o => o.Value, t => t.MapFrom(u => u.MappedValue))
|
||||
@@ -57,6 +61,9 @@ namespace IRaCIS.Core.Application.Service
|
||||
CreateMap<Internationalization, InternationalizationView>();
|
||||
CreateMap<Internationalization, InternationalizationAddOrEdit>().ReverseMap();
|
||||
|
||||
CreateMap<BatchAddInternationalizationDto, InternationalizationAddOrEdit>();
|
||||
|
||||
|
||||
CreateMap<PublishLog, PublishLogView>();
|
||||
CreateMap<PublishLog, PublishLogAddOrEdit>().ReverseMap();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user