新增课程课程场景分析页面

master
xiaochanghai 1 month ago
parent 7c16f48503
commit 19bec64e17
  1. 13
      Tiobon.Core.Api/Controllers/Ghre/Ghre_CourseController.cs
  2. 7
      Tiobon.Core.Api/Tiobon.Core.xml
  3. 3
      Tiobon.Core.IServices/Ghre/IGhre_CourseServices.cs
  4. 9
      Tiobon.Core.Model/ViewModels/Extend/CourseAndScene.cs
  5. 1
      Tiobon.Core.Services/CommonServices.cs
  6. 103
      Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs
  7. 7
      Tiobon.Core/Tiobon.Core.xml

@ -1,4 +1,5 @@
using StackExchange.Profiling.Data;
using Tiobon.Core.Model.ViewModels.Extend;
namespace Tiobon.Core.Api.Controllers;
@ -103,4 +104,16 @@ public class Ghre_CourseController : BaseController<IGhre_CourseServices, Ghre_C
{
return await _service.QueryStatistic(id);
}
/// <summary>
/// 统计
/// </summary>
/// <param name="filter"></param>
/// <returns></returns>
[HttpPost("QueryCourseAndScene")]
public async Task<ServicePageResult<CourseAndScene>> QueryCourseAndScene([FromBody] QueryBody filter)
{
return await _service.QueryCourseAndScene(filter);
}
}

@ -813,6 +813,13 @@
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Tiobon.Core.Api.Controllers.Ghre_CourseController.QueryCourseAndScene(Tiobon.Core.Common.QueryBody)">
<summary>
统计
</summary>
<param name="filter"></param>
<returns></returns>
</member>
<member name="T:Tiobon.Core.Api.Controllers.Ghre_CourseSceneController">
<summary>
课程场景(Controller)

@ -2,6 +2,7 @@
using Tiobon.Core.IServices.BASE;
using Tiobon.Core.Model;
using Tiobon.Core.Model.Models;
using Tiobon.Core.Model.ViewModels.Extend;
namespace Tiobon.Core.IServices;
@ -28,4 +29,6 @@ public interface IGhre_CourseServices : IBaseServices<Ghre_Course, Ghre_CourseDt
Task<ServiceResult> ModifyCourseSortNo(List<Ghre_Course> courses);
Task<dynamic> QueryStatistic(long id);
Task<ServicePageResult<CourseAndScene>> QueryCourseAndScene(QueryBody filter);
}

@ -0,0 +1,9 @@
namespace Tiobon.Core.Model.ViewModels.Extend;
public class CourseAndScene
{
public long Id { get; set; }
public string CourseNo { get; set; }
public string Type { get; set; }
public string CourseName { get; set; }
}

@ -859,6 +859,7 @@ public partial class CommonServices : BaseServices<RootEntityTkey<int>>, ICommon
switch (param.menuName)
{
case "F_SurveyQuestionPool":
case "F_Training_CourseAndScene_Report":
case "F_QuestionBank":
toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "NewYN").FirstOrDefault();
if (toolbar != null) { toolbar.fnKey = "TBD1YN"; }

@ -1,5 +1,4 @@
using NPOI.SS.UserModel;
using Tiobon.Core.IServices;
using static Tiobon.Core.Model.Consts;
namespace Tiobon.Core.Services;
@ -1314,6 +1313,108 @@ public class Ghre_CourseServices : BaseServices<Ghre_Course, Ghre_CourseDto, Ins
}
#endregion
#region 查询课程、课程场景
public async Task<ServicePageResult<CourseAndScene>> QueryCourseAndScene(QueryBody filter)
{
RefAsync<int> totalCount = 0;
string sql = @"SELECT Id,
CourseNo,
CourseName,
Type from Ghre_CourseScene_V A";
if (string.IsNullOrWhiteSpace(filter.orderBy))
filter.orderBy = "CourseNo ASC";
string conditions = " WHERE 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);
if (name == "CourseNoOrName")
{
conditions += $" AND ( CourseNo LIKE '%{jsonParam.columnValue}%' OR CourseName LIKE '%{jsonParam.columnValue}%')";
continue;
}
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;
case "GreaterOrEqual"://大于等于
conditions += $" AND {name} >='{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<List<string>>(jsonParam.columnValue.ToString());
conditions += $" AND {name} IN ({string.Join(",", ids1.Select(id => "'" + id + "'"))})";
}
break;
case "NotEqualAny"://
if (jsonParam.columnValue != null)
{
var ids1 = JsonHelper.JsonToObj<List<string>>(jsonParam.columnValue.ToString());
conditions += $" AND ({name} NOT IN ({string.Join(",", ids1.Select(id => "'" + id + "'"))}) OR {name} IS NULL)";
}
break;
default:
break;
}
}
}
if (filter.pageSize == 0)
filter.pageSize = 10000;
sql += conditions;
var sql1 = GetQueryString(sql, filter.pageNum, filter.pageSize, filter.orderBy);
var data = DbAccess.QueryList<CourseAndScene>(sql1);
totalCount = await Db.Ado.GetIntAsync("SELECT COUNT(0) from Ghre_CourseScene_V A WHERE 1=1");
return new ServicePageResult<CourseAndScene>(filter.pageNum, totalCount, filter.pageSize, data);
}
#endregion
#region 课程统计
/// <summary>
/// 课程统计

@ -813,6 +813,13 @@
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Tiobon.Core.Api.Controllers.Ghre_CourseController.QueryCourseAndScene(Tiobon.Core.Common.QueryBody)">
<summary>
统计
</summary>
<param name="filter"></param>
<returns></returns>
</member>
<member name="T:Tiobon.Core.Api.Controllers.Ghre_CourseSceneController">
<summary>
课程场景(Controller)

Loading…
Cancel
Save