|
|
@@ -1143,6 +1143,9 @@ class ExamTypeStrategy
|
|
|
$allKpData = DB::table('textbook_chapter_knowledge_relation as tckr')
|
|
|
->join('textbook_catalog_nodes as tcn', 'tckr.catalog_chapter_id', '=', 'tcn.id')
|
|
|
->whereIn('tckr.catalog_chapter_id', $chapterIds)
|
|
|
+ ->where(function ($q) {
|
|
|
+ $q->where('tckr.is_deleted', 0)->orWhereNull('tckr.is_deleted');
|
|
|
+ })
|
|
|
->select('tckr.kp_code', 'tcn.sort_order', 'tcn.id as chapter_id', 'tcn.title as chapter_title')
|
|
|
->orderBy('tcn.sort_order', 'asc')
|
|
|
->orderBy('tckr.kp_code', 'asc')
|
|
|
@@ -1258,6 +1261,9 @@ class ExamTypeStrategy
|
|
|
// 修复方案1:使用GROUP BY替代DISTINCT,并选择需要的字段
|
|
|
$kpCodes = DB::table('textbook_chapter_knowledge_relation')
|
|
|
->whereIn('catalog_chapter_id', $chapterIds)
|
|
|
+ ->where(function ($q) {
|
|
|
+ $q->where('is_deleted', 0)->orWhereNull('is_deleted');
|
|
|
+ })
|
|
|
->select('kp_code')
|
|
|
->groupBy('kp_code')
|
|
|
->pluck('kp_code')
|
|
|
@@ -1529,6 +1535,9 @@ class ExamTypeStrategy
|
|
|
$stats = DB::table('textbook_chapter_knowledge_relation as tckr')
|
|
|
->join('textbook_catalog_nodes as tcn', 'tckr.catalog_chapter_id', '=', 'tcn.id')
|
|
|
->whereIn('tckr.catalog_chapter_id', $chapterIdList)
|
|
|
+ ->where(function ($q) {
|
|
|
+ $q->where('tckr.is_deleted', 0)->orWhereNull('tckr.is_deleted');
|
|
|
+ })
|
|
|
->select(
|
|
|
'tckr.catalog_chapter_id as chapter_id',
|
|
|
'tcn.title as chapter_title',
|