|
|
@ -13,7 +13,6 @@ using System.Data; |
|
|
|
using Microsoft.AspNetCore.Http; |
|
|
|
using Microsoft.AspNetCore.Http; |
|
|
|
using Tiobon.Core.Common.UserManager; |
|
|
|
using Tiobon.Core.Common.UserManager; |
|
|
|
using Tiobon.Core.Common.Helper; |
|
|
|
using Tiobon.Core.Common.Helper; |
|
|
|
using Org.BouncyCastle.Crypto; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Tiobon.Core.Services; |
|
|
|
namespace Tiobon.Core.Services; |
|
|
|
|
|
|
|
|
|
|
@ -34,100 +33,11 @@ public class Ghre_CourseServices : BaseServices<Ghre_Course, Ghre_CourseDto, Ins |
|
|
|
base._caching = caching; |
|
|
|
base._caching = caching; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public override async Task<ServicePageResult<Ghre_CourseDto>> QueryFilterPage(QueryBody filter) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
RefAsync<int> totalCount = 0; |
|
|
|
|
|
|
|
string sql = @"SELECT *
|
|
|
|
|
|
|
|
FROM (SELECT A.*, |
|
|
|
|
|
|
|
B.ClassName CourseClassName, |
|
|
|
|
|
|
|
C.ClassName CourseClassName2, |
|
|
|
|
|
|
|
D.SceneName CourseSceneName, |
|
|
|
|
|
|
|
E.CourseWareName, |
|
|
|
|
|
|
|
F.StaffName ManagerStaffName, |
|
|
|
|
|
|
|
G.UserName CreateName, |
|
|
|
|
|
|
|
G.UserName UpdateName, |
|
|
|
|
|
|
|
CASE A.InOrOut |
|
|
|
|
|
|
|
WHEN 'In' THEN F.StaffName |
|
|
|
|
|
|
|
WHEN 'Out' THEN J.TeacherName |
|
|
|
|
|
|
|
END TeacherName, ISNULL(A.UpdateTime, A.CreateTime) CreateTime1 |
|
|
|
|
|
|
|
FROM Ghre_Course A |
|
|
|
|
|
|
|
LEFT JOIN Ghre_CourseClass B ON A.CourseClassId = B.Id |
|
|
|
|
|
|
|
LEFT JOIN Ghre_CourseClass C ON A.CourseClassId2 = C.Id |
|
|
|
|
|
|
|
LEFT JOIN Ghre_CourseScene D ON A.CourseSceneId = D.Id |
|
|
|
|
|
|
|
LEFT JOIN Ghre_CourseWare E ON A.CourseWareId = E.Id |
|
|
|
|
|
|
|
LEFT JOIN Ghra_Staff F ON A.ManagerId = F.StaffID |
|
|
|
|
|
|
|
LEFT JOIN Ghrs_User G ON A.CreateBy = G.UserId |
|
|
|
|
|
|
|
LEFT JOIN Ghrs_User H ON A.UpdateBy = H.UserId |
|
|
|
|
|
|
|
LEFT JOIN Ghra_Staff I ON A.TeacherId = I.StaffID |
|
|
|
|
|
|
|
LEFT JOIN Ghre_Teacher J ON A.SchoolTeacherId = I.StaffID |
|
|
|
|
|
|
|
WHERE A.IsEnable = 1) A";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(filter.orderBy)) |
|
|
|
|
|
|
|
filter.orderBy = "CreateTime1 DESC"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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; |
|
|
|
|
|
|
|
var data = await Db.SqlQueryable<Ghre_CourseDto>(sql) |
|
|
|
|
|
|
|
.OrderBy(filter.orderBy) |
|
|
|
|
|
|
|
.ToPageListAsync(filter.pageNum, filter.pageSize, totalCount); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data.ForEach(async x => |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
x.ChargeMethodLabel = await GetParaLabel("CourseChargeMethod", x.ChargeMethod); |
|
|
|
|
|
|
|
x.InOrOutLabel = await GetParaLabel("CourseInOrOut", x.InOrOut); |
|
|
|
|
|
|
|
x.IsOPenLabel = x.IsOPen == true ? "是" : "否"; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new ServicePageResult<Ghre_CourseDto>(filter.pageNum, totalCount, filter.pageSize, data); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public async Task<ServicePageResult<Ghre_CourseDto>> QueryList(QueryBody filter, string status, List<long> ids) |
|
|
|
public async Task<ServicePageResult<Ghre_CourseDto>> QueryList(QueryBody filter, string status, List<long> ids) |
|
|
|
{ |
|
|
|
{ |
|
|
|
RefAsync<int> totalCount = 0; |
|
|
|
RefAsync<int> totalCount = 0; |
|
|
|
string sql = @"SELECT *
|
|
|
|
string sql = @"SELECT *
|
|
|
|
FROM (SELECT A.*, |
|
|
|
FROM (SELECT A.*, |
|
|
|
B.ClassName CourseClassName, |
|
|
|
|
|
|
|
C.ClassName CourseClassName2, |
|
|
|
|
|
|
|
D.SceneName CourseSceneName, |
|
|
|
D.SceneName CourseSceneName, |
|
|
|
E.CourseWareName, |
|
|
|
E.CourseWareName, |
|
|
|
F.StaffName ManagerStaffName, |
|
|
|
F.StaffName ManagerStaffName, |
|
|
@ -138,8 +48,6 @@ public class Ghre_CourseServices : BaseServices<Ghre_Course, Ghre_CourseDto, Ins |
|
|
|
WHEN 'Out' THEN J.TeacherName |
|
|
|
WHEN 'Out' THEN J.TeacherName |
|
|
|
END TeacherName, ISNULL(A.UpdateTime, A.CreateTime) CreateTime1 |
|
|
|
END TeacherName, ISNULL(A.UpdateTime, A.CreateTime) CreateTime1 |
|
|
|
FROM Ghre_Course A |
|
|
|
FROM Ghre_Course A |
|
|
|
LEFT JOIN Ghre_CourseClass B ON A.CourseClassId = B.Id |
|
|
|
|
|
|
|
LEFT JOIN Ghre_CourseClass C ON A.CourseClassId2 = C.Id |
|
|
|
|
|
|
|
LEFT JOIN Ghre_CourseScene D ON A.CourseSceneId = D.Id |
|
|
|
LEFT JOIN Ghre_CourseScene D ON A.CourseSceneId = D.Id |
|
|
|
LEFT JOIN Ghre_CourseWare E ON A.CourseWareId = E.Id |
|
|
|
LEFT JOIN Ghre_CourseWare E ON A.CourseWareId = E.Id |
|
|
|
LEFT JOIN Ghra_Staff F ON A.ManagerId = F.StaffID |
|
|
|
LEFT JOIN Ghra_Staff F ON A.ManagerId = F.StaffID |
|
|
@ -211,11 +119,27 @@ public class Ghre_CourseServices : BaseServices<Ghre_Course, Ghre_CourseDto, Ins |
|
|
|
.OrderBy(filter.orderBy) |
|
|
|
.OrderBy(filter.orderBy) |
|
|
|
.ToPageListAsync(filter.pageNum, filter.pageSize, totalCount); |
|
|
|
.ToPageListAsync(filter.pageNum, filter.pageSize, totalCount); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var classsIds1 = data.Select(x => x.CourseClassId).Distinct().ToList(); |
|
|
|
|
|
|
|
var classsIds = new List<long>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classsIds1.ForEach(x => |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(x)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var courseClassIds = JsonConvert.DeserializeObject<List<long>>(x); |
|
|
|
|
|
|
|
classsIds = classsIds.Concat(courseClassIds).ToList(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
classsIds = classsIds.Distinct().ToList(); |
|
|
|
|
|
|
|
var classs = await _ghre_CourseClassServices.Query(x => classsIds.Contains(x.Id)); |
|
|
|
|
|
|
|
|
|
|
|
data.ForEach(async x => |
|
|
|
data.ForEach(async x => |
|
|
|
{ |
|
|
|
{ |
|
|
|
x.ChargeMethodLabel = await GetParaLabel("CourseChargeMethod", x.ChargeMethod); |
|
|
|
x.ChargeMethodLabel = await GetParaLabel("CourseChargeMethod", x.ChargeMethod); |
|
|
|
x.InOrOutLabel = await GetParaLabel("CourseInOrOut", x.InOrOut); |
|
|
|
x.InOrOutLabel = await GetParaLabel("CourseInOrOut", x.InOrOut); |
|
|
|
x.IsOPenLabel = x.IsOPen == true ? "是" : "否"; |
|
|
|
x.IsOPenLabel = x.IsOPen == true ? "是" : "否"; |
|
|
|
|
|
|
|
var courseClass = classs.Where(a => x.CourseClassId.Contains(a.Id.ToString())).ToList(); |
|
|
|
|
|
|
|
x.CourseClassName = string.Join(",", courseClass.Select(a => a.ClassName)); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
return new ServicePageResult<Ghre_CourseDto>(filter.pageNum, totalCount, filter.pageSize, data); |
|
|
|
return new ServicePageResult<Ghre_CourseDto>(filter.pageNum, totalCount, filter.pageSize, data); |
|
|
@ -291,6 +215,10 @@ public class Ghre_CourseServices : BaseServices<Ghre_Course, Ghre_CourseDto, Ins |
|
|
|
if (!string.IsNullOrWhiteSpace(examPaperId)) |
|
|
|
if (!string.IsNullOrWhiteSpace(examPaperId)) |
|
|
|
result.result.DT_TableDataT1[0].ExamPaperIds = JsonConvert.DeserializeObject<List<long>>(examPaperId); |
|
|
|
result.result.DT_TableDataT1[0].ExamPaperIds = JsonConvert.DeserializeObject<List<long>>(examPaperId); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string courseClassId = result.result.DT_TableDataT1[0].CourseClassId; |
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(courseClassId)) |
|
|
|
|
|
|
|
result.result.DT_TableDataT1[0].CourseClassIds = JsonConvert.DeserializeObject<List<long>>(courseClassId); |
|
|
|
|
|
|
|
|
|
|
|
else result.result.DT_TableDataT1[0].ExamPaperIds = new List<long>(); |
|
|
|
else result.result.DT_TableDataT1[0].ExamPaperIds = new List<long>(); |
|
|
|
|
|
|
|
|
|
|
|
if (body.doType == "Copy") |
|
|
|
if (body.doType == "Copy") |
|
|
@ -355,6 +283,7 @@ public class Ghre_CourseServices : BaseServices<Ghre_Course, Ghre_CourseDto, Ins |
|
|
|
public override async Task<long> Add(InsertGhre_CourseInput entity) |
|
|
|
public override async Task<long> Add(InsertGhre_CourseInput entity) |
|
|
|
{ |
|
|
|
{ |
|
|
|
entity.ExamPaperId = JsonHelper.ObjToJson(entity.ExamPaperIds); |
|
|
|
entity.ExamPaperId = JsonHelper.ObjToJson(entity.ExamPaperIds); |
|
|
|
|
|
|
|
entity.CourseClassId = JsonHelper.ObjToJson(entity.CourseClassIds); |
|
|
|
entity.Status = "Draft"; |
|
|
|
entity.Status = "Draft"; |
|
|
|
entity.DefaultCoverImageName = entity.DefaultCoverImageName ?? "defaultCourseCover1"; |
|
|
|
entity.DefaultCoverImageName = entity.DefaultCoverImageName ?? "defaultCourseCover1"; |
|
|
|
entity.UseDefaultCoverImage = entity.UseDefaultCoverImage ?? true; |
|
|
|
entity.UseDefaultCoverImage = entity.UseDefaultCoverImage ?? true; |
|
|
@ -365,6 +294,7 @@ public class Ghre_CourseServices : BaseServices<Ghre_Course, Ghre_CourseDto, Ins |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
editModel.ExamPaperId = JsonHelper.ObjToJson(editModel.ExamPaperIds); |
|
|
|
editModel.ExamPaperId = JsonHelper.ObjToJson(editModel.ExamPaperIds); |
|
|
|
|
|
|
|
editModel.CourseClassId = JsonHelper.ObjToJson(editModel.CourseClassIds); |
|
|
|
return await base.Update(Id, editModel); |
|
|
|
return await base.Update(Id, editModel); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|