添加获取模块类型列表
parent
df104ec527
commit
5c663ec3e9
|
@ -3,6 +3,7 @@
|
|||
// 生成时间 2022-03-28 16:43:52
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
|
@ -63,6 +64,26 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
|
||||
}
|
||||
|
||||
|
||||
public class ModuleTypeData
|
||||
{
|
||||
|
||||
public bool IsShow { get; set; }
|
||||
|
||||
public Guid Id { get; set; }
|
||||
public Guid? ParentId { get; set; }
|
||||
public Guid DictionaryId { get; set; }
|
||||
|
||||
public int ShowOrder { get; set; }
|
||||
public string DictionaryValue { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class GetModuleTypeListInDto
|
||||
{
|
||||
public Guid TrialId { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 复制其他对象到当前对象
|
||||
/// </summary>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
using IRaCIS.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Interfaces;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using MassTransit;
|
||||
|
@ -15,6 +16,8 @@ using Microsoft.Data.SqlClient;
|
|||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Npgsql;
|
||||
using NPOI.POIFS.Properties;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
|
@ -29,6 +32,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
IRepository<QCChallenge> _qCChallengeRepository,
|
||||
IRepository<Dictionary> _dictionaryRepository,
|
||||
IRepository<Trial> _trialRepository,
|
||||
IRepository<TrialAuditShow> _trialAuditShowRepository,
|
||||
IRepository<UserRole> _userRoleRepository,
|
||||
|
||||
IRepository<CheckChallengeDialog> _checkChallengeDialogRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IFrontAuditConfigService
|
||||
|
@ -1134,18 +1138,82 @@ namespace IRaCIS.Core.Application.Service
|
|||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取模块类型列表
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<object> GetModuleTypeList(GetModuleTypeListInDto inDto)
|
||||
{
|
||||
|
||||
from u in _frontAuditConfigRepository.AsQueryable()
|
||||
join p in _frontAuditConfigRepository.Where(x => x.EnumType == "Foreign" && x.IsEnable) on u.Id equals p.ParentId
|
||||
|
||||
|
||||
|
||||
var allfront = await (from data in _frontAuditConfigRepository.AsQueryable()
|
||||
join dic in _dictionaryRepository.Where(x => x.Parent.Code == "ModuleType" && x.IsEnable) on data.ModuleTypeId equals dic.Id
|
||||
join trialshow in _trialAuditShowRepository.Where(x => x.TrialId == inDto.TrialId) on data.Id equals trialshow.FrontAuditConfigId into trialshowtemp
|
||||
from lefttrialshow in trialshowtemp.DefaultIfEmpty()
|
||||
select new ModuleTypeData()
|
||||
{
|
||||
IsShow = lefttrialshow == null ? data.IsDefaultChoice : lefttrialshow.IsShow,
|
||||
Id = data.Id,
|
||||
ParentId = data.ParentId,
|
||||
DictionaryId = dic.Id,
|
||||
ShowOrder= dic.ShowOrder,
|
||||
DictionaryValue = _userInfo.IsEn_Us ? dic.Value : dic.ValueCN,
|
||||
}).ToListAsync();
|
||||
|
||||
var result = allfront.Where(x => x.IsShow).ToList();
|
||||
FindParent(result, result.Select(x => x.ParentId).ToList());
|
||||
void FindParent(List<ModuleTypeData> re, List<Guid?> Parentids)
|
||||
{
|
||||
|
||||
var parentList = allfront.Where(x => Parentids.Contains(x.Id)).ToList();
|
||||
if (parentList.Count > 0)
|
||||
{
|
||||
re.AddRange(parentList);
|
||||
|
||||
FindParent(re, parentList.Select(x => x.ParentId).ToList());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return result.OrderBy(x => x.ShowOrder).Select(x => new {
|
||||
|
||||
x.DictionaryId,
|
||||
x.DictionaryValue
|
||||
}).Distinct().ToList();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取Description
|
||||
/// </summary>
|
||||
/// <param name="moduleTypeId"></param>
|
||||
/// <param name="trialId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<List<string>> GetModuleTypeDescriptionList(Guid moduleTypeId)
|
||||
public async Task<List<string>> GetModuleTypeDescriptionList(Guid moduleTypeId,Guid trialId)
|
||||
{
|
||||
var result = (await _frontAuditConfigRepository.Where(x => x.ModuleTypeId == moduleTypeId && x.ObjectTypeId != null && x.OptTypeId != null && x.Description.Length > 0).Select(x => new { x.Description, x.DescriptionCN, x.Sort }).OrderBy(t => t.Sort).ToListAsync()
|
||||
).Select(t => _userInfo.IsEn_Us ? t.Description : t.DescriptionCN).Distinct().ToList();
|
||||
return result;
|
||||
|
||||
|
||||
var result = from data in _frontAuditConfigRepository.Where(x => x.ModuleTypeId == moduleTypeId && x.ObjectTypeId != null && x.OptTypeId != null && x.Description.Length > 0)
|
||||
join trialshow in _trialAuditShowRepository.Where(x => x.TrialId == trialId) on data.Id equals trialshow.FrontAuditConfigId into trialshowtemp
|
||||
from lefttrialshow in trialshowtemp.DefaultIfEmpty()
|
||||
select new
|
||||
{
|
||||
IsShow= lefttrialshow==null? data.IsDefaultChoice : lefttrialshow.IsShow,
|
||||
Description= _userInfo.IsEn_Us ? data.Description : data.DescriptionCN
|
||||
};
|
||||
|
||||
return result.Where(x=>x.IsShow).Select(x=>x.Description).Distinct().ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue