|
@@ -60,21 +60,24 @@ public class NceeExportService : INceeExportService, ITransient
|
|
|
var lbs = await ExportLine(nceePlanId, courses, lineLevelTable, "区县");
|
|
|
await File.WriteAllBytesAsync(lbPath, lbs);
|
|
|
|
|
|
- // 导出机构转换成绩
|
|
|
- var orgConvertScores = await ExportOrgConvertScore(nceePlanId, orgList, "区县", isExportConvertRange: nceePlan.Config.ConvertEnabled);
|
|
|
- foreach (var convertScore in orgConvertScores)
|
|
|
+ if (nceePlan.Config.ExportConvertScoreEnabled)
|
|
|
{
|
|
|
- string orgPath = Path.Combine(filePath, convertScore.Key);
|
|
|
- Directory.CreateDirectory(orgPath);
|
|
|
- await File.WriteAllBytesAsync(Path.Combine(orgPath, $"{nceePlan.Name}-转换成绩-{convertScore.Key}.xlsx"), convertScore.Value);
|
|
|
- File.Copy(rangePath4, Path.Combine(orgPath, Path.GetFileName(rangePath4)));
|
|
|
- File.Copy(rangePath8, Path.Combine(orgPath, Path.GetFileName(rangePath8)));
|
|
|
- File.Copy(lbPath, Path.Combine(orgPath, Path.GetFileName(lbPath)));
|
|
|
- }
|
|
|
+ // 导出机构转换成绩
|
|
|
+ var orgConvertScores = await ExportOrgConvertScore(nceePlanId, orgList, "区县", isExportConvertRange: nceePlan.Config.ConvertEnabled, isExportOrder: nceePlan.Config.ExportOrderEnabled);
|
|
|
+ foreach (var convertScore in orgConvertScores)
|
|
|
+ {
|
|
|
+ string orgPath = Path.Combine(filePath, convertScore.Key);
|
|
|
+ Directory.CreateDirectory(orgPath);
|
|
|
+ await File.WriteAllBytesAsync(Path.Combine(orgPath, $"{nceePlan.Name}-转换成绩-{convertScore.Key.Split("-")[1]}.xlsx"), convertScore.Value);
|
|
|
+ File.Copy(rangePath4, Path.Combine(orgPath, Path.GetFileName(rangePath4)));
|
|
|
+ File.Copy(rangePath8, Path.Combine(orgPath, Path.GetFileName(rangePath8)));
|
|
|
+ File.Copy(lbPath, Path.Combine(orgPath, Path.GetFileName(lbPath)));
|
|
|
+ }
|
|
|
|
|
|
- // 导出全部转换成绩
|
|
|
- var convertScoreBytes = await ExportConvertScore(nceePlanId, "区县", isExportConvertRange: nceePlan.Config.ConvertEnabled);
|
|
|
- await File.WriteAllBytesAsync(Path.Combine(filePath, $"{nceePlan.Name}-转换成绩-总表.xlsx"), convertScoreBytes);
|
|
|
+ // 导出全部转换成绩
|
|
|
+ var convertScoreBytes = await ExportConvertScore(nceePlanId, "区县", isExportConvertRange: nceePlan.Config.ConvertEnabled, isExportOrder: nceePlan.Config.ExportOrderEnabled);
|
|
|
+ await File.WriteAllBytesAsync(Path.Combine(filePath, $"{nceePlan.Name}-转换成绩-总表.xlsx"), convertScoreBytes);
|
|
|
+ }
|
|
|
|
|
|
string outFileName = $"{nceePlan.Name}-统计结果.zip";
|
|
|
string outFilePath = Path.Combine(fileRoot, outFileName);
|
|
@@ -160,18 +163,21 @@ public class NceeExportService : INceeExportService, ITransient
|
|
|
await File.WriteAllBytesAsync(Path.Combine(orgPath, $"{nceePlan.Name}-{range.Key}-分段统计-历史类.xlsx"), range.Value);
|
|
|
}
|
|
|
|
|
|
- // 导出各机构转换成绩
|
|
|
- var orgConvertScores = await ExportOrgConvertScore(nceePlanId, orgList, "学校", isExportConvertRange: nceePlan.Config.ConvertEnabled);
|
|
|
- foreach (var convertScore in orgConvertScores)
|
|
|
+ if (nceePlan.Config.ExportConvertScoreEnabled)
|
|
|
{
|
|
|
- string orgPath = Path.Combine(filePath, convertScore.Key);
|
|
|
- Directory.CreateDirectory(orgPath);
|
|
|
- await File.WriteAllBytesAsync(Path.Combine(orgPath, $"{nceePlan.Name}-转换成绩-{convertScore.Key}.xlsx"), convertScore.Value);
|
|
|
- }
|
|
|
+ // 导出各机构转换成绩
|
|
|
+ var orgConvertScores = await ExportOrgConvertScore(nceePlanId, orgList, "学校", isExportConvertRange: nceePlan.Config.ConvertEnabled);
|
|
|
+ foreach (var convertScore in orgConvertScores)
|
|
|
+ {
|
|
|
+ string orgPath = Path.Combine(filePath, convertScore.Key);
|
|
|
+ Directory.CreateDirectory(orgPath);
|
|
|
+ await File.WriteAllBytesAsync(Path.Combine(orgPath, $"{nceePlan.Name}-转换成绩-{convertScore.Key}.xlsx"), convertScore.Value);
|
|
|
+ }
|
|
|
|
|
|
- // 导出全部转换成绩
|
|
|
- var convertScoreBytes = await ExportConvertScore(nceePlanId, "学校", isExportConvertRange: nceePlan.Config.ConvertEnabled);
|
|
|
- await File.WriteAllBytesAsync(Path.Combine(filePath, $"{nceePlan.Name}-转换成绩-总表.xlsx"), convertScoreBytes);
|
|
|
+ // 导出全部转换成绩
|
|
|
+ var convertScoreBytes = await ExportConvertScore(nceePlanId, "学校", isExportConvertRange: nceePlan.Config.ConvertEnabled);
|
|
|
+ await File.WriteAllBytesAsync(Path.Combine(filePath, $"{nceePlan.Name}-转换成绩-总表.xlsx"), convertScoreBytes);
|
|
|
+ }
|
|
|
|
|
|
string outFileName = $"{nceePlan.Name}-统计结果.zip";
|
|
|
string outFilePath = Path.Combine(fileRoot, outFileName);
|
|
@@ -866,22 +872,50 @@ public class NceeExportService : INceeExportService, ITransient
|
|
|
int ci = 0;
|
|
|
int scoreWidth = 10;
|
|
|
_exportExcelService.AddCell("上线合并汇总", titleRow, ci++, cellStyle.TitleStyle, sheet, scoreWidth);
|
|
|
- for (; ci < 8; ci++)
|
|
|
+ for (; ci < 16; ci++)
|
|
|
{
|
|
|
_exportExcelService.AddCell("", titleRow, ci, cellStyle.TitleStyle, sheet, scoreWidth);
|
|
|
}
|
|
|
sheet.AddMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 0, ci - 1));
|
|
|
|
|
|
+ IRow headerRow0 = sheet.CreateRow(rowNum++);
|
|
|
+ headerRow0.HeightInPoints = 15;
|
|
|
+ ci = 0;
|
|
|
+ _exportExcelService.AddCell(orgTitle, headerRow0, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("两类合并", headerRow0, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("", headerRow0, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("", headerRow0, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("", headerRow0, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("", headerRow0, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("物理类", headerRow0, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("", headerRow0, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("", headerRow0, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("", headerRow0, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("", headerRow0, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("历史类", headerRow0, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("", headerRow0, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("", headerRow0, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("", headerRow0, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("", headerRow0, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+
|
|
|
IRow headerRow1 = sheet.CreateRow(rowNum++);
|
|
|
headerRow1.HeightInPoints = 15;
|
|
|
ci = 0;
|
|
|
- _exportExcelService.AddCell(orgTitle, headerRow1, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("", headerRow1, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("参考人数", headerRow1, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("特控", headerRow1, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("", headerRow1, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("本科", headerRow1, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("", headerRow1, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
_exportExcelService.AddCell("参考人数", headerRow1, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
_exportExcelService.AddCell("特控", headerRow1, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
_exportExcelService.AddCell("", headerRow1, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
_exportExcelService.AddCell("本科", headerRow1, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
_exportExcelService.AddCell("", headerRow1, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
- _exportExcelService.AddCell("高职", headerRow1, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("参考人数", headerRow1, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("特控", headerRow1, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("", headerRow1, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("本科", headerRow1, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
_exportExcelService.AddCell("", headerRow1, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
|
|
|
IRow headerRow2 = sheet.CreateRow(rowNum++);
|
|
@@ -893,14 +927,33 @@ public class NceeExportService : INceeExportService, ITransient
|
|
|
_exportExcelService.AddCell("比例(%)", headerRow2, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
_exportExcelService.AddCell("人数", headerRow2, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
_exportExcelService.AddCell("比例(%)", headerRow2, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("", headerRow2, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("人数", headerRow2, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("比例(%)", headerRow2, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
_exportExcelService.AddCell("人数", headerRow2, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
_exportExcelService.AddCell("比例(%)", headerRow2, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("", headerRow2, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("人数", headerRow2, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("比例(%)", headerRow2, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("人数", headerRow2, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("比例(%)", headerRow2, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+
|
|
|
+ sheet.AddMergedRegion(new CellRangeAddress(rowNum - 3, rowNum - 1, 0, 0));
|
|
|
+ sheet.AddMergedRegion(new CellRangeAddress(rowNum - 3, rowNum - 3, 1, 5));
|
|
|
+ sheet.AddMergedRegion(new CellRangeAddress(rowNum - 3, rowNum - 3, 6, 10));
|
|
|
+ sheet.AddMergedRegion(new CellRangeAddress(rowNum - 3, rowNum - 3, 11, 15));
|
|
|
|
|
|
- sheet.AddMergedRegion(new CellRangeAddress(rowNum - 2, rowNum - 1, 0, 0));
|
|
|
sheet.AddMergedRegion(new CellRangeAddress(rowNum - 2, rowNum - 1, 1, 1));
|
|
|
sheet.AddMergedRegion(new CellRangeAddress(rowNum - 2, rowNum - 2, 2, 3));
|
|
|
sheet.AddMergedRegion(new CellRangeAddress(rowNum - 2, rowNum - 2, 4, 5));
|
|
|
- sheet.AddMergedRegion(new CellRangeAddress(rowNum - 2, rowNum - 2, 6, 7));
|
|
|
+
|
|
|
+ sheet.AddMergedRegion(new CellRangeAddress(rowNum - 2, rowNum - 1, 6, 6));
|
|
|
+ sheet.AddMergedRegion(new CellRangeAddress(rowNum - 2, rowNum - 2, 7, 8));
|
|
|
+ sheet.AddMergedRegion(new CellRangeAddress(rowNum - 2, rowNum - 2, 9, 10));
|
|
|
+
|
|
|
+ sheet.AddMergedRegion(new CellRangeAddress(rowNum - 2, rowNum - 1, 11, 11));
|
|
|
+ sheet.AddMergedRegion(new CellRangeAddress(rowNum - 2, rowNum - 2, 12, 13));
|
|
|
+ sheet.AddMergedRegion(new CellRangeAddress(rowNum - 2, rowNum - 2, 14, 15));
|
|
|
#endregion
|
|
|
|
|
|
#region 数据
|
|
@@ -915,8 +968,16 @@ public class NceeExportService : INceeExportService, ITransient
|
|
|
_exportExcelService.AddCell(dr["line_rate_1"], row, rci++, cellStyle.PercentCellStyleP2, zeroToBlank: true);
|
|
|
_exportExcelService.AddCell(dr["line_count_2"], row, rci++, cellStyle.CenterCellStyle, zeroToBlank: true);
|
|
|
_exportExcelService.AddCell(dr["line_rate_2"], row, rci++, cellStyle.PercentCellStyleP2, zeroToBlank: true);
|
|
|
- _exportExcelService.AddCell(dr["line_count_3"], row, rci++, cellStyle.CenterCellStyle, zeroToBlank: true);
|
|
|
- _exportExcelService.AddCell(dr["line_rate_3"], row, rci++, cellStyle.PercentCellStyleP2, zeroToBlank: true);
|
|
|
+ _exportExcelService.AddCell(dr["d_4_total_count"], row, rci++, cellStyle.CenterCellStyle);
|
|
|
+ _exportExcelService.AddCell(dr["d_4_line_count_1"], row, rci++, cellStyle.CenterCellStyle, zeroToBlank: true);
|
|
|
+ _exportExcelService.AddCell(dr["d_4_line_rate_1"], row, rci++, cellStyle.PercentCellStyleP2, zeroToBlank: true);
|
|
|
+ _exportExcelService.AddCell(dr["d_4_line_count_2"], row, rci++, cellStyle.CenterCellStyle, zeroToBlank: true);
|
|
|
+ _exportExcelService.AddCell(dr["d_4_line_rate_2"], row, rci++, cellStyle.PercentCellStyleP2, zeroToBlank: true);
|
|
|
+ _exportExcelService.AddCell(dr["d_8_total_count"], row, rci++, cellStyle.CenterCellStyle);
|
|
|
+ _exportExcelService.AddCell(dr["d_8_line_count_1"], row, rci++, cellStyle.CenterCellStyle, zeroToBlank: true);
|
|
|
+ _exportExcelService.AddCell(dr["d_8_line_rate_1"], row, rci++, cellStyle.PercentCellStyleP2, zeroToBlank: true);
|
|
|
+ _exportExcelService.AddCell(dr["d_8_line_count_2"], row, rci++, cellStyle.CenterCellStyle, zeroToBlank: true);
|
|
|
+ _exportExcelService.AddCell(dr["d_8_line_rate_2"], row, rci++, cellStyle.PercentCellStyleP2, zeroToBlank: true);
|
|
|
}
|
|
|
#endregion
|
|
|
}
|
|
@@ -1639,8 +1700,8 @@ public class NceeExportService : INceeExportService, ITransient
|
|
|
_exportExcelService.AddCell("总分X", headerRow, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
if (isExportOrder)
|
|
|
{
|
|
|
- _exportExcelService.AddCell("联考次", headerRow, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
- _exportExcelService.AddCell("区次", headerRow, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("联考序X", headerRow, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
+ _exportExcelService.AddCell("区序X", headerRow, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
}
|
|
|
_exportExcelService.AddCell("语文", headerRow, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
|
_exportExcelService.AddCell("数学", headerRow, ci++, cellStyle.ColumnFillHeaderStyle, sheet, scoreWidth);
|
|
@@ -2772,30 +2833,63 @@ public class NceeExportService : INceeExportService, ITransient
|
|
|
/// <returns></returns>
|
|
|
private async Task<DataTable> GetLineCountTable(int nceePlanId)
|
|
|
{
|
|
|
- var dt = await _rep.SqlQueryAsync(@"
|
|
|
-SELECT IFNULL(T2.short_name, '合计') AS sys_org_name, T1.*,
|
|
|
- T1.line_count_1 / T1.total_count AS line_rate_1,
|
|
|
- T1.line_count_2 / T1.total_count AS line_rate_2,
|
|
|
- T1.line_count_3 / T1.total_count AS line_rate_3
|
|
|
+ var dt = await _rep.SqlQueryAsync($@"
|
|
|
+SELECT T1.*,
|
|
|
+ T2.d_4_total_count, T2.d_4_line_count_1, T2.d_4_line_count_2, T2.d_4_line_count_3,
|
|
|
+ T2.d_4_line_count_1 / T2.d_4_total_count AS d_4_line_rate_1,
|
|
|
+ T2.d_4_line_count_2 / T2.d_4_total_count AS d_4_line_rate_2,
|
|
|
+ T2.d_4_line_count_3 / T2.d_4_total_count AS d_4_line_rate_3,
|
|
|
+ T2.d_8_total_count, T2.d_8_line_count_1, T2.d_8_line_count_2, T2.d_8_line_count_3,
|
|
|
+ T2.d_8_line_count_1 / T2.d_8_total_count AS d_8_line_rate_1,
|
|
|
+ T2.d_8_line_count_2 / T2.d_8_total_count AS d_8_line_rate_2,
|
|
|
+ T2.d_8_line_count_3 / T2.d_8_total_count AS d_8_line_rate_3
|
|
|
FROM
|
|
|
+(
|
|
|
+ SELECT IFNULL(T2.short_name, '合计') AS sys_org_name, T1.*,
|
|
|
+ T1.line_count_1 / T1.total_count AS line_rate_1,
|
|
|
+ T1.line_count_2 / T1.total_count AS line_rate_2,
|
|
|
+ T1.line_count_3 / T1.total_count AS line_rate_3
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT T1.type, T1.sys_org_id,
|
|
|
+ MAX(T1.total_count) AS total_count,
|
|
|
+ SUM(CASE WHEN T1.ncee_line_level = 1 THEN T1.line_count ELSE 0 END) AS line_count_1,
|
|
|
+ SUM(CASE WHEN T1.ncee_line_level = 2 THEN T1.line_count ELSE 0 END) AS line_count_2,
|
|
|
+ SUM(CASE WHEN T1.ncee_line_level = 3 THEN T1.line_count ELSE 0 END) AS line_count_3
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT T1.type, T1.sys_org_id, T1.ncee_line_level, SUM(T1.line_count) AS line_count, SUM(T1.total_count) AS total_count
|
|
|
+ FROM ncee_line_total AS T1
|
|
|
+ WHERE T1.ncee_plan_id = {nceePlanId} AND (T1.type = 1 OR T1.type = 4) AND T1.ncee_course_comb_id IS NULL
|
|
|
+ GROUP BY T1.type, T1.sys_org_id, T1.ncee_line_level
|
|
|
+ ) AS T1
|
|
|
+ GROUP BY T1.type, T1.sys_org_id
|
|
|
+ ) AS T1
|
|
|
+ LEFT JOIN sys_org AS T2 ON T1.sys_org_id = T2.id
|
|
|
+) AS T1
|
|
|
+LEFT JOIN
|
|
|
(
|
|
|
SELECT T1.type, T1.sys_org_id,
|
|
|
- MAX(T1.total_count) AS total_count,
|
|
|
- SUM(CASE WHEN T1.ncee_line_level = 1 THEN T1.line_count ELSE 0 END) AS line_count_1,
|
|
|
- SUM(CASE WHEN T1.ncee_line_level = 2 THEN T1.line_count ELSE 0 END) AS line_count_2,
|
|
|
- SUM(CASE WHEN T1.ncee_line_level = 3 THEN T1.line_count ELSE 0 END) AS line_count_3
|
|
|
- FROM
|
|
|
+ MAX(CASE WHEN T1.direction_course_id = 4 THEN T1.total_count ELSE 0 END) AS d_4_total_count,
|
|
|
+ SUM(CASE WHEN T1.direction_course_id = 4 AND T1.ncee_line_level = 1 THEN T1.line_count ELSE 0 END) AS d_4_line_count_1,
|
|
|
+ SUM(CASE WHEN T1.direction_course_id = 4 AND T1.ncee_line_level = 2 THEN T1.line_count ELSE 0 END) AS d_4_line_count_2,
|
|
|
+ SUM(CASE WHEN T1.direction_course_id = 4 AND T1.ncee_line_level = 3 THEN T1.line_count ELSE 0 END) AS d_4_line_count_3,
|
|
|
+ MAX(CASE WHEN T1.direction_course_id = 8 THEN T1.total_count ELSE 0 END) AS d_8_total_count,
|
|
|
+ SUM(CASE WHEN T1.direction_course_id = 8 AND T1.ncee_line_level = 1 THEN T1.line_count ELSE 0 END) AS d_8_line_count_1,
|
|
|
+ SUM(CASE WHEN T1.direction_course_id = 8 AND T1.ncee_line_level = 2 THEN T1.line_count ELSE 0 END) AS d_8_line_count_2,
|
|
|
+ SUM(CASE WHEN T1.direction_course_id = 8 AND T1.ncee_line_level = 3 THEN T1.line_count ELSE 0 END) AS d_8_line_count_3
|
|
|
+ FROM
|
|
|
(
|
|
|
- SELECT T1.type, T1.sys_org_id, T1.ncee_line_level, SUM(T1.line_count) AS line_count, SUM(T1.total_count) AS total_count
|
|
|
+ SELECT T1.direction_course_id, T1.type, T1.sys_org_id, T1.ncee_line_level, SUM(T1.line_count) AS line_count, SUM(T1.total_count) AS total_count
|
|
|
FROM ncee_line_total AS T1
|
|
|
- WHERE T1.ncee_plan_id = @nceePlanId AND (T1.type = 1 OR T1.type = 4) AND T1.ncee_course_comb_id IS NULL
|
|
|
- GROUP BY T1.type, T1.sys_org_id, T1.ncee_line_level
|
|
|
+ WHERE T1.ncee_plan_id = {nceePlanId} AND (T1.type = 1 OR T1.type = 4) AND T1.ncee_course_comb_id IS NULL
|
|
|
+ GROUP BY T1.direction_course_id, T1.type, T1.sys_org_id, T1.ncee_line_level
|
|
|
) AS T1
|
|
|
GROUP BY T1.type, T1.sys_org_id
|
|
|
-) AS T1
|
|
|
-LEFT JOIN sys_org AS T2 ON T1.sys_org_id = T2.id
|
|
|
+) AS T2 ON T1.type = T2.type AND IFNULL(T1.sys_org_id, 0) = IFNULL(T2.sys_org_id, 0)
|
|
|
ORDER BY T1.type, T1.sys_org_id
|
|
|
-", new { NceePlanId = nceePlanId });
|
|
|
+
|
|
|
+");
|
|
|
|
|
|
return dt;
|
|
|
}
|