|
|
|
@ -64,41 +64,41 @@ namespace Tiobon.Core.Services |
|
|
|
|
return entity; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override async Task<ServicePageResult<Ghre_ExamPaperDto>> QueryFilterPage(QueryBody body) |
|
|
|
|
{ |
|
|
|
|
var data = await BaseDal.QueryFilterPage(body); |
|
|
|
|
var data1 = Mapper.Map(data.result.DT_TableDataT1).ToANew<List<Ghre_ExamPaperDto>>(); |
|
|
|
|
|
|
|
|
|
var linkIds = data1.Where(x => x.LinkId != null).Select(x => x.LinkId.Value).Distinct().ToList(); |
|
|
|
|
var courses = await _ghre_CourseServices.Query(x => linkIds.Contains(x.Id)); |
|
|
|
|
var courseScenes = await _ghre_CourseSceneServices.Query(x => linkIds.Contains(x.Id)); |
|
|
|
|
|
|
|
|
|
data1.ForEach(async x => |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
x.ScoreMethodLabel = await GetParaLabel("ScoreMethod", x.ScoreMethod); |
|
|
|
|
x.TotalScore1 = Regex.Replace(x.PassScore.ToString(), @"\.(0+)$", "") + "/" + Regex.Replace(x.TotalScore.ToString(), @"\.(0+)$", ""); |
|
|
|
|
x.SetMethodLabel = await GetParaLabel("SetMethod", x.SetMethod); |
|
|
|
|
|
|
|
|
|
if (x.LinkType == "CourseId") |
|
|
|
|
x.CourseName = courses.FirstOrDefault(o => o.Id == x.LinkId)?.CourseName; |
|
|
|
|
else if (x.LinkType == "CourseSceneId") |
|
|
|
|
x.CourseName = courseScenes.FirstOrDefault(o => o.Id == x.LinkId)?.SceneName; |
|
|
|
|
} |
|
|
|
|
catch (Exception) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
return new ServicePageResult<Ghre_ExamPaperDto>(body.pageNum, data.result.DT_TablePageInfoT1.TotalCount, body.pageSize, data1); |
|
|
|
|
} |
|
|
|
|
//public override async Task<ServicePageResult<Ghre_ExamPaperDto>> QueryFilterPage(QueryBody body) |
|
|
|
|
//{ |
|
|
|
|
// var data = await BaseDal.QueryFilterPage(body); |
|
|
|
|
// var data1 = Mapper.Map(data.result.DT_TableDataT1).ToANew<List<Ghre_ExamPaperDto>>(); |
|
|
|
|
|
|
|
|
|
// var linkIds = data1.Where(x => x.LinkId != null).Select(x => x.LinkId.Value).Distinct().ToList(); |
|
|
|
|
// var courses = await _ghre_CourseServices.Query(x => linkIds.Contains(x.Id)); |
|
|
|
|
// var courseScenes = await _ghre_CourseSceneServices.Query(x => linkIds.Contains(x.Id)); |
|
|
|
|
|
|
|
|
|
// data1.ForEach(async x => |
|
|
|
|
// { |
|
|
|
|
// try |
|
|
|
|
// { |
|
|
|
|
// x.ScoreMethodLabel = await GetParaLabel("ScoreMethod", x.ScoreMethod); |
|
|
|
|
// x.TotalScore1 = Regex.Replace(x.PassScore.ToString(), @"\.(0+)$", "") + "/" + Regex.Replace(x.TotalScore.ToString(), @"\.(0+)$", ""); |
|
|
|
|
// x.SetMethodLabel = await GetParaLabel("SetMethod", x.SetMethod); |
|
|
|
|
|
|
|
|
|
// if (x.LinkType == "CourseId") |
|
|
|
|
// x.CourseName = courses.FirstOrDefault(o => o.Id == x.LinkId)?.CourseName; |
|
|
|
|
// else if (x.LinkType == "CourseSceneId") |
|
|
|
|
// x.CourseName = courseScenes.FirstOrDefault(o => o.Id == x.LinkId)?.SceneName; |
|
|
|
|
// } |
|
|
|
|
// catch (Exception) |
|
|
|
|
// { |
|
|
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
// }); |
|
|
|
|
|
|
|
|
|
// return new ServicePageResult<Ghre_ExamPaperDto>(body.pageNum, data.result.DT_TablePageInfoT1.TotalCount, body.pageSize, data1); |
|
|
|
|
//} |
|
|
|
|
|
|
|
|
|
public async Task<ServicePageResult<Ghre_ExamPaperDto>> QueryList(QueryBody body, string status) |
|
|
|
|
{ |
|
|
|
|
var data = await QueryFilterPage1(body, status); |
|
|
|
|
var data = await base.QueryFilterPage(body, $"Status='{status}'"); |
|
|
|
|
var data1 = Mapper.Map(data.result.DT_TableDataT1).ToANew<List<Ghre_ExamPaperDto>>(); |
|
|
|
|
|
|
|
|
|
var linkIds = data1.Where(x => x.LinkId != null).Select(x => x.LinkId.Value).Distinct().ToList(); |
|
|
|
@ -128,60 +128,60 @@ namespace Tiobon.Core.Services |
|
|
|
|
return new ServicePageResult<Ghre_ExamPaperDto>(body.pageNum, data.result.DT_TablePageInfoT1.TotalCount, body.pageSize, data1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public async Task<ServicePageResult<Ghre_ExamPaper>> QueryFilterPage1(QueryBody filter, string status = null) |
|
|
|
|
{ |
|
|
|
|
if (string.IsNullOrWhiteSpace(filter.orderBy)) |
|
|
|
|
filter.orderBy = "CreateTime DESC"; |
|
|
|
|
RefAsync<int> totalCount = 0; |
|
|
|
|
var query = Db.Queryable<Ghre_ExamPaper>(); |
|
|
|
|
if (!string.IsNullOrWhiteSpace(status)) |
|
|
|
|
query = query.Where(x => x.Status == status); |
|
|
|
|
string conditions = "1=1"; |
|
|
|
|
if (filter.jsonParam != null) |
|
|
|
|
foreach (JProperty jProperty in filter.jsonParam.Properties()) |
|
|
|
|
{ |
|
|
|
|
var name = jProperty.Name; |
|
|
|
|
var value = jProperty.Value.ToString(); |
|
|
|
|
if (name == "page" || name == "pageSize") |
|
|
|
|
continue; |
|
|
|
|
if (!string.IsNullOrWhiteSpace(value)) |
|
|
|
|
{ |
|
|
|
|
var jsonParam = JsonConvert.DeserializeObject<JsonParam>(value); |
|
|
|
|
|
|
|
|
|
switch (jsonParam.operationKey) |
|
|
|
|
{ |
|
|
|
|
case "Include": |
|
|
|
|
conditions += $" AND {name} LIKE '%{jsonParam.columnValue}%'"; |
|
|
|
|
break; |
|
|
|
|
case "NotInclude": |
|
|
|
|
conditions += $" AND {name} NOT LIKE '%{jsonParam.columnValue}%'"; |
|
|
|
|
break; |
|
|
|
|
case "IsNull": |
|
|
|
|
conditions += $" AND {name} IS NULL"; |
|
|
|
|
break; |
|
|
|
|
case "NotNull": |
|
|
|
|
conditions += $" AND {name} IS NOT NULL"; |
|
|
|
|
break; |
|
|
|
|
case "Equal": |
|
|
|
|
conditions += $" AND {name} ='{jsonParam.columnValue}'"; |
|
|
|
|
break; |
|
|
|
|
case "NotEqual": |
|
|
|
|
conditions += $" AND {name} !='{jsonParam.columnValue}'"; |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (filter.pageSize == 0) |
|
|
|
|
filter.pageSize = 10000; |
|
|
|
|
query = query.Where(conditions); |
|
|
|
|
var list = await query |
|
|
|
|
.OrderByIF(!string.IsNullOrEmpty(filter.orderBy), filter.orderBy) |
|
|
|
|
.ToPageListAsync(filter.pageNum, filter.pageSize, totalCount); |
|
|
|
|
|
|
|
|
|
return new ServicePageResult<Ghre_ExamPaper>(filter.pageNum, totalCount, filter.pageSize, list); |
|
|
|
|
} |
|
|
|
|
//public async Task<ServicePageResult<Ghre_ExamPaper>> QueryFilterPage1(QueryBody filter, string status = null) |
|
|
|
|
//{ |
|
|
|
|
// if (string.IsNullOrWhiteSpace(filter.orderBy)) |
|
|
|
|
// filter.orderBy = "CreateTime DESC"; |
|
|
|
|
// RefAsync<int> totalCount = 0; |
|
|
|
|
// var query = Db.Queryable<Ghre_ExamPaper>(); |
|
|
|
|
// if (!string.IsNullOrWhiteSpace(status)) |
|
|
|
|
// query = query.Where(x => x.Status == status); |
|
|
|
|
// string conditions = "1=1"; |
|
|
|
|
// if (filter.jsonParam != null) |
|
|
|
|
// foreach (JProperty jProperty in filter.jsonParam.Properties()) |
|
|
|
|
// { |
|
|
|
|
// var name = jProperty.Name; |
|
|
|
|
// var value = jProperty.Value.ToString(); |
|
|
|
|
// if (name == "page" || name == "pageSize") |
|
|
|
|
// continue; |
|
|
|
|
// if (!string.IsNullOrWhiteSpace(value)) |
|
|
|
|
// { |
|
|
|
|
// var jsonParam = JsonConvert.DeserializeObject<JsonParam>(value); |
|
|
|
|
|
|
|
|
|
// switch (jsonParam.operationKey) |
|
|
|
|
// { |
|
|
|
|
// case "Include": |
|
|
|
|
// conditions += $" AND {name} LIKE '%{jsonParam.columnValue}%'"; |
|
|
|
|
// break; |
|
|
|
|
// case "NotInclude": |
|
|
|
|
// conditions += $" AND {name} NOT LIKE '%{jsonParam.columnValue}%'"; |
|
|
|
|
// break; |
|
|
|
|
// case "IsNull": |
|
|
|
|
// conditions += $" AND {name} IS NULL"; |
|
|
|
|
// break; |
|
|
|
|
// case "NotNull": |
|
|
|
|
// conditions += $" AND {name} IS NOT NULL"; |
|
|
|
|
// break; |
|
|
|
|
// case "Equal": |
|
|
|
|
// conditions += $" AND {name} ='{jsonParam.columnValue}'"; |
|
|
|
|
// break; |
|
|
|
|
// case "NotEqual": |
|
|
|
|
// conditions += $" AND {name} !='{jsonParam.columnValue}'"; |
|
|
|
|
// break; |
|
|
|
|
// default: |
|
|
|
|
// break; |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// if (filter.pageSize == 0) |
|
|
|
|
// filter.pageSize = 10000; |
|
|
|
|
// query = query.Where(conditions); |
|
|
|
|
// var list = await query |
|
|
|
|
// .OrderByIF(!string.IsNullOrEmpty(filter.orderBy), filter.orderBy) |
|
|
|
|
// .ToPageListAsync(filter.pageNum, filter.pageSize, totalCount); |
|
|
|
|
|
|
|
|
|
// return new ServicePageResult<Ghre_ExamPaper>(filter.pageNum, totalCount, filter.pageSize, list); |
|
|
|
|
//} |
|
|
|
|
|
|
|
|
|
public async Task<ServiceResult<DefaultGhre_ExamPaperInput>> QueryDefault(long Id) |
|
|
|
|
{ |
|
|
|
|