@@ -4,10 +4,7 @@
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using IRaCIS.Core.Infrastructure.Extention;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace IRaCIS.Core.Application.Contracts
|
||||
@@ -20,7 +17,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
IRepository<QCQuestion> _qcQuestionRepository,
|
||||
IRepository<TrialQCQuestion> _trialQCQuestionRepository) : BaseService, IQCQuestionService
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -37,12 +34,13 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
var initList = await _qcQuestionRepository
|
||||
.WhereIf(trialQCQuestionFilterSelect.TypeArray.Count() > 0, t => trialQCQuestionFilterSelect.TypeArray.Contains(t.Type))
|
||||
.WhereIf(trialQCQuestionFilterSelect.Id != null, t => t.Id != trialQCQuestionFilterSelect.Id && t.ParentId != trialQCQuestionFilterSelect.Id)
|
||||
.OrderBy(t => t.ShowOrder).Select(x => new TrialQCQuestionSelect() {
|
||||
.OrderBy(t => t.ShowOrder).Select(x => new TrialQCQuestionSelect()
|
||||
{
|
||||
ShowOrder = x.ShowOrder,
|
||||
Id = x.Id,
|
||||
ParentId = x.ParentId,
|
||||
QuestionName = x.QuestionName,
|
||||
LanguageType=x.LanguageType,
|
||||
LanguageType = x.LanguageType,
|
||||
TypeValue = x.TypeValue,
|
||||
|
||||
}).ToListAsync();
|
||||
@@ -88,13 +86,13 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
{
|
||||
|
||||
var QCQuestionQueryable = _qcQuestionRepository
|
||||
.WhereIf(queryQCQuestionConfigure.IsEnable != null,x=>x.IsEnable== queryQCQuestionConfigure.IsEnable)
|
||||
.WhereIf(queryQCQuestionConfigure.IsEnable != null, x => x.IsEnable == queryQCQuestionConfigure.IsEnable)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(queryQCQuestionConfigure.QuestionName), t => t.QuestionName.Contains(queryQCQuestionConfigure.QuestionName))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(queryQCQuestionConfigure.Type), t => t.Type.Contains(queryQCQuestionConfigure.Type))
|
||||
.WhereIf(queryQCQuestionConfigure.LanguageType!=null, t =>t.LanguageType== queryQCQuestionConfigure.LanguageType)
|
||||
.WhereIf(queryQCQuestionConfigure.IsDefeaultViewParent==true,t=>t.ParentId==null)
|
||||
.OrderByDescending(x=>x.LanguageType)
|
||||
.ThenBy(t=>t.ShowOrder)
|
||||
.WhereIf(queryQCQuestionConfigure.LanguageType != null, t => t.LanguageType == queryQCQuestionConfigure.LanguageType)
|
||||
.WhereIf(queryQCQuestionConfigure.IsDefeaultViewParent == true, t => t.ParentId == null)
|
||||
.OrderByDescending(x => x.LanguageType)
|
||||
.ThenBy(t => t.ShowOrder)
|
||||
.ProjectTo<QCQuestionConfigureView>(_mapper.ConfigurationProvider);
|
||||
|
||||
var defalutSortArray = new string[] { nameof(QCQuestionConfigureView.LanguageType) + " desc", nameof(QCQuestionConfigureView.ShowOrder) };
|
||||
@@ -125,7 +123,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
//---当前任务存在子问题,删除失败
|
||||
throw new BusinessValidationFailedException(_localizer["QCQuestion_HasChildQuestion"]);
|
||||
}
|
||||
await _qcQuestionRepository.DeleteFromQueryAsync(t => t.Id == qCQuestionConfigureId,true);
|
||||
await _qcQuestionRepository.DeleteFromQueryAsync(t => t.Id == qCQuestionConfigureId, true);
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
@@ -143,27 +141,28 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
public async Task<List<QCQuestionView>> GetQuestionView(QCQuestionViewInDto inDto)
|
||||
{
|
||||
var question = new List<QCQuestionView>();
|
||||
if (inDto.TrialId!= null)
|
||||
if (inDto.TrialId != null)
|
||||
{
|
||||
question = await _trialQCQuestionRepository.Where(x => x.TrialId == inDto.TrialId&&x.IsEnable).OrderBy(x => x.ShowOrder).ProjectTo<QCQuestionView>
|
||||
(_mapper.ConfigurationProvider, new
|
||||
{
|
||||
isEn_Us = _userInfo.IsEn_Us
|
||||
question = await _trialQCQuestionRepository.Where(x => x.TrialId == inDto.TrialId && x.IsEnable).OrderBy(x => x.ShowOrder).ProjectTo<QCQuestionView>
|
||||
(_mapper.ConfigurationProvider, new
|
||||
{
|
||||
isEn_Us = _userInfo.IsEn_Us
|
||||
|
||||
}).ToListAsync();
|
||||
}).ToListAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
question=await _qcQuestionRepository.Where(x=>x.IsEnable).OrderBy(x => x.ShowOrder).ProjectTo<QCQuestionView>(_mapper.ConfigurationProvider, new
|
||||
{
|
||||
isEn_Us = _userInfo.IsEn_Us
|
||||
question = await _qcQuestionRepository.Where(x => x.IsEnable).OrderBy(x => x.ShowOrder).ProjectTo<QCQuestionView>(_mapper.ConfigurationProvider, new
|
||||
{
|
||||
isEn_Us = _userInfo.IsEn_Us
|
||||
|
||||
}).ToListAsync();
|
||||
}).ToListAsync();
|
||||
}
|
||||
|
||||
|
||||
var result = question.Where(x => x.ParentId == null).ToList();
|
||||
result.ForEach(x => {
|
||||
result.ForEach(x =>
|
||||
{
|
||||
GetQuestionChild(x, question);
|
||||
});
|
||||
|
||||
@@ -178,13 +177,13 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
|
||||
if (parent.Childrens.Count != 0)
|
||||
{
|
||||
parent.Childrens.ForEach(x =>
|
||||
parent.Childrens.ForEach(x =>
|
||||
{
|
||||
GetQuestionChild(x, dataList);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user