|
|
|
@ -6,11 +6,13 @@ |
|
|
|
|
public class Ghra_TitleServices : BaseServices<Ghra_Title, Ghra_TitleDto, InsertGhra_TitleInput, EditGhra_TitleInput>, IGhra_TitleServices |
|
|
|
|
{ |
|
|
|
|
private readonly IBaseRepository<Ghra_Title> _dal; |
|
|
|
|
public Ghra_TitleServices(ICaching caching, IBaseRepository<Ghra_Title> dal) |
|
|
|
|
private readonly ICommonServices _commonServices; |
|
|
|
|
public Ghra_TitleServices(ICaching caching, IBaseRepository<Ghra_Title> dal, ICommonServices commonServices) |
|
|
|
|
{ |
|
|
|
|
this._dal = dal; |
|
|
|
|
base.BaseDal = dal; |
|
|
|
|
base._caching = caching; |
|
|
|
|
_commonServices = commonServices; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override async Task<Ghra_TitleDto> QueryById(object objId) |
|
|
|
@ -19,4 +21,133 @@ public class Ghra_TitleServices : BaseServices<Ghra_Title, Ghra_TitleDto, Insert |
|
|
|
|
|
|
|
|
|
return entity; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public async Task<dynamic> QuerySkillMatrix(QueryBody filter) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
dynamic obj = new ExpandoObject(); |
|
|
|
|
dynamic result = new ExpandoObject(); |
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(filter.orderBy)) |
|
|
|
|
filter.orderBy = "Type ASC"; |
|
|
|
|
|
|
|
|
|
string sql = $"SELECT * FROM Ghre_CourseScene_V WHERE IsEnable=1"; |
|
|
|
|
|
|
|
|
|
#region 处理查询条件 |
|
|
|
|
//Expression<Func<Ghrh_Resume, bool>> whereExpression = new Expression<Func<Ghrh_Resume, bool>>(); |
|
|
|
|
var whereExpression = Expressionable.Create<Ghrh_Resume>(); |
|
|
|
|
foreach (JProperty jProperty in filter.jsonParam.Properties()) |
|
|
|
|
{ |
|
|
|
|
var name = jProperty.Name; |
|
|
|
|
var value = jProperty.Value.ToString(); |
|
|
|
|
if (name == "page" || name == "pageSize") |
|
|
|
|
continue; |
|
|
|
|
if (value.IsNotEmptyOrNull()) |
|
|
|
|
{ |
|
|
|
|
//var jsonParam = JsonHelper.JsonToObj<JsonParam>(value); |
|
|
|
|
|
|
|
|
|
//switch (name) |
|
|
|
|
//{ |
|
|
|
|
// case "WaitRecommend": |
|
|
|
|
// if (jsonParam.columnValue.ObjToInt() == 1) |
|
|
|
|
// sql += $" AND C.Status = '{DIC_INTERVIEW_ORDER_STATUS.WaitRecommended}'"; |
|
|
|
|
// break; |
|
|
|
|
// case "HasRecommended": |
|
|
|
|
// if (jsonParam.columnValue.ObjToInt() == 1) |
|
|
|
|
// sql += $" AND C.Status = '{DIC_INTERVIEW_ORDER_STATUS.HasRecommended}'"; |
|
|
|
|
// break; |
|
|
|
|
// case "WaitAppointment": |
|
|
|
|
|
|
|
|
|
// default: |
|
|
|
|
// break; |
|
|
|
|
//} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#endregion |
|
|
|
|
if (filter.pageSize == 0) |
|
|
|
|
filter.pageSize = 10000; |
|
|
|
|
|
|
|
|
|
var sql1 = GetQueryString(sql, filter.pageNum, filter.pageSize, filter.orderBy); |
|
|
|
|
|
|
|
|
|
var totalCount = await Db.Ado.GetIntAsync("select count(0) from ( " + sql + ") A"); |
|
|
|
|
var list = DbAccess.QueryList<TitleSkillMatrix>(sql); |
|
|
|
|
|
|
|
|
|
ModuleParam param = new ModuleParam() |
|
|
|
|
{ |
|
|
|
|
langId = filter.langId, |
|
|
|
|
menuName = filter.menuName |
|
|
|
|
}; |
|
|
|
|
var module = await _commonServices.GetModuleInfoAsync(param); |
|
|
|
|
var result1 = new ServicePageResult<TitleSkillMatrix>(filter.pageNum, totalCount, filter.pageSize, list); |
|
|
|
|
result1.result.JM_TableColumnT1 = module.Data.JM_TableColumnT1; |
|
|
|
|
|
|
|
|
|
var columns = new JArray(); |
|
|
|
|
|
|
|
|
|
var titles = await Db.Queryable<Ghra_Title>().OrderBy(x => x.SortNo).ToListAsync(); |
|
|
|
|
var rules = await Db.Queryable<Ghre_StudyRule>().Where(x => x.RuleType == "Required" && x.TrainType == "Title").ToListAsync(); |
|
|
|
|
|
|
|
|
|
var dict = new Dictionary<string, List<int>>(); |
|
|
|
|
|
|
|
|
|
rules.ForEach(x => |
|
|
|
|
{ |
|
|
|
|
if (x.TitleId.IsNotEmptyOrNull()) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
var key = (x.CourseId ?? x.CourseSceneId).ObjToString(); |
|
|
|
|
if (dict.ContainsKey(key)) |
|
|
|
|
{ |
|
|
|
|
var ids = dict[key]; |
|
|
|
|
|
|
|
|
|
ids.AddRange(JsonHelper.JsonToObj<List<int>>(x.TitleId)); |
|
|
|
|
ids = ids.Distinct().ToList(); |
|
|
|
|
dict[key] = ids; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
dict.Add(key, JsonHelper.JsonToObj<List<int>>(x.TitleId)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < list.Count; i++) |
|
|
|
|
{ |
|
|
|
|
var column = list[i]; |
|
|
|
|
|
|
|
|
|
var item = new JObject |
|
|
|
|
{ |
|
|
|
|
new JProperty("Id", column.Id), |
|
|
|
|
new JProperty("CourseNo", column.CourseNo), |
|
|
|
|
new JProperty("CourseName", column.CourseName), |
|
|
|
|
new JProperty("Type", column.Type), |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
titles.ForEach(x => |
|
|
|
|
{ |
|
|
|
|
if (dict.ContainsKey(column.Id.ObjToString())) |
|
|
|
|
{ |
|
|
|
|
var ids = dict[column.Id.ObjToString()]; |
|
|
|
|
if (ids.Where(id => id == x.TitleID).Any()) |
|
|
|
|
item.Add(new JProperty("Title_" + x.TitleNo, "✔")); |
|
|
|
|
else |
|
|
|
|
item.Add(new JProperty("Title_" + x.TitleNo, "")); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
item.Add(new JProperty("Title_" + x.TitleNo, "")); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
columns.Add(item); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
result.JM_TableColumnT1 = module.Data.JM_TableColumnT1; |
|
|
|
|
result.DT_TablePageInfoT1 = result1.result.DT_TablePageInfoT1; |
|
|
|
|
result.DT_TableDataT1 = columns; |
|
|
|
|
obj.result = result; |
|
|
|
|
obj.Success = true; |
|
|
|
|
obj.code = "0"; |
|
|
|
|
obj.type = "success"; |
|
|
|
|
obj.message = "查询成功!"; |
|
|
|
|
return obj; |
|
|
|
|
} |
|
|
|
|
} |