diff --git a/Tiobon.Core.Common/Attribute/QueryFilter.cs b/Tiobon.Core.Common/Attribute/QueryFilter.cs index 716ac82d..d0bc1a51 100644 --- a/Tiobon.Core.Common/Attribute/QueryFilter.cs +++ b/Tiobon.Core.Common/Attribute/QueryFilter.cs @@ -101,7 +101,7 @@ public class QueryBody } public class JsonParam { - public string columnValue { get; set; } + public object columnValue { get; set; } public string operationKey { get; set; } public string token { get; set; } diff --git a/Tiobon.Core.Services/BASE/BaseServices.cs b/Tiobon.Core.Services/BASE/BaseServices.cs index 9f47c61d..72822fce 100644 --- a/Tiobon.Core.Services/BASE/BaseServices.cs +++ b/Tiobon.Core.Services/BASE/BaseServices.cs @@ -3,7 +3,6 @@ using System.Dynamic; using System.Linq.Expressions; using AgileObjects.AgileMapper; using Microsoft.AspNetCore.Http; -using Newtonsoft.Json; using Newtonsoft.Json.Linq; using SqlSugar; using Tiobon.Core.Common; @@ -764,7 +763,7 @@ public class BaseServices : IBaseServ continue; if (!string.IsNullOrWhiteSpace(value)) { - var jsonParam = JsonConvert.DeserializeObject(value); + var jsonParam = JsonHelper.JsonToObj(value); switch (jsonParam.operationKey) { @@ -798,6 +797,22 @@ public class BaseServices : IBaseServ case "Less"://小于 conditions += $" AND {name} <'{jsonParam.columnValue}'"; break; + case "EqualAny":// + if (jsonParam.columnValue != null) + { + var ids = JsonHelper.JsonToObj>(jsonParam.columnValue.ToString()); + + conditions += $" AND {name} IN ({string.Join(",", ids.Select(id => "'" + id + "'"))})"; + } + break; + case "NotEqualAny":// + if (jsonParam.columnValue != null) + { + var ids = JsonHelper.JsonToObj>(jsonParam.columnValue.ToString()); + + conditions += $" AND {name} NOT IN ({string.Join(",", ids.Select(id => "'" + id + "'"))})"; + } + break; default: break; } diff --git a/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs b/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs index efbe86ec..fe45467b 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs @@ -38,15 +38,16 @@ public class Ghre_CourseServices : BaseServices totalCount = 0; string sql = @"SELECT * FROM (SELECT A.*, - D.SceneName CourseSceneName, - E.CourseWareName, - F.StaffName ManagerStaffName, + D.SceneName + ' (' + D.SceneNo + ')' CourseSceneName, + E.CourseWareName + ' (' + E.CourseWareNo + ')' CourseWareName, + F.StaffName + ' (' + F.StaffNo + ')' ManagerStaffName, G.UserName CreateName, H.UserName UpdateName, CASE A.InOrOut WHEN 'In' THEN F.StaffName 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 LEFT JOIN Ghre_CourseScene D ON A.CourseSceneId = D.Id LEFT JOIN Ghre_CourseWare E ON A.CourseWareId = E.Id @@ -107,6 +108,34 @@ public class Ghre_CourseServices : BaseServices='{jsonParam.columnValue}'"; + break; + case "Greater"://大于 + conditions += $" AND {name} >'{jsonParam.columnValue}'"; + break; + case "LessOrEqual"://小于等于 + conditions += $" AND {name} <='{jsonParam.columnValue}'"; + break; + case "Less"://小于 + conditions += $" AND {name} <'{jsonParam.columnValue}'"; + break; + case "EqualAny":// + if (jsonParam.columnValue != null) + { + var ids1 = JsonHelper.JsonToObj>(jsonParam.columnValue.ToString()); + + conditions += $" AND {name} IN ({string.Join(",", ids1.Select(id => "'" + id + "'"))})"; + } + break; + case "NotEqualAny":// + if (jsonParam.columnValue != null) + { + var ids1 = JsonHelper.JsonToObj>(jsonParam.columnValue.ToString()); + + conditions += $" AND ({name} NOT IN ({string.Join(",", ids1.Select(id => "'" + id + "'"))}) OR {name} IS NULL)"; + } + break; default: break; } @@ -139,7 +168,7 @@ public class Ghre_CourseServices : BaseServices x.CourseClassId.Contains(a.Id.ToString())).ToList(); - x.CourseClassName = string.Join(",", courseClass.Select(a => a.ClassName)); + x.CourseClassName = string.Join(",", courseClass.Select(a => a.ClassName + " (" + a.ClassNo + ")")); }); return new ServicePageResult(filter.pageNum, totalCount, filter.pageSize, data); diff --git a/Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs b/Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs index 9b495bd0..6b9eb268 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs @@ -74,11 +74,11 @@ public class Ghre_QuestionServices : BaseServices().Where(x => x.CourseName.Contains(jsonParam.columnValue)).Select(x => x.Id).ToListAsync(); + var ids = await Db.Queryable().Where(x => x.CourseName.Contains(jsonParam.columnValue.ToString())).Select(x => x.Id).ToListAsync(); query = query.Where(x => x.CourseId != null && ids.Contains(x.CourseId.Value)); break; case "NotInclude": - var ids1 = await Db.Queryable().Where(x => x.CourseName.Contains(jsonParam.columnValue)).Select(x => x.Id).ToListAsync(); + var ids1 = await Db.Queryable().Where(x => x.CourseName.Contains(jsonParam.columnValue.ToString())).Select(x => x.Id).ToListAsync(); query = query.Where(x => x.CourseId != null && !ids1.Contains(x.CourseId.Value)); break; case "IsNull": diff --git a/Tiobon.Core.Services/Ghre/Ghre_SchoolServices.cs b/Tiobon.Core.Services/Ghre/Ghre_SchoolServices.cs index 16fef37e..8565743e 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_SchoolServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_SchoolServices.cs @@ -42,7 +42,7 @@ public class Ghre_SchoolServices : BaseServices(value); - schoolNo1 = jsonParam?.columnValue; + schoolNo1 = jsonParam?.columnValue?.ToString(); } } var condition = string.Empty;