diff --git a/server/__debug_bin.exe1200509454 b/server/__debug_bin.exe1200509454 index f242643..2f6e033 100644 Binary files a/server/__debug_bin.exe1200509454 and b/server/__debug_bin.exe1200509454 differ diff --git a/server/modules/yx/dto/yx_school_major_dto.go b/server/modules/yx/dto/yx_school_major_dto.go index 7a000ee..4e894f1 100644 --- a/server/modules/yx/dto/yx_school_major_dto.go +++ b/server/modules/yx/dto/yx_school_major_dto.go @@ -38,6 +38,10 @@ type UserMajorDTO struct { // PrivateStudentScore float64 `json:"privateStudentScore"` // 学生折合分(私有) // StudentConvertedScore float64 `json:"studentConvertedScore"` // 学生折合分(转换后) // FirstLevelDiscipline string `json:"firstLevelDiscipline"` // 一级学科 (需确认来源) + + Province string `json:"province"` // 省份 + SchoolNature string `json:"schoolNature"` // 院校性质 + InstitutionType string `json:"institutionType"` // 院校类型 } // SchoolMajorDTO 院校专业查询结果 DTO diff --git a/server/modules/yx/mapper/yx_calculation_major_mapper.go b/server/modules/yx/mapper/yx_calculation_major_mapper.go index b7a7f4d..ea21a8c 100644 --- a/server/modules/yx/mapper/yx_calculation_major_mapper.go +++ b/server/modules/yx/mapper/yx_calculation_major_mapper.go @@ -125,8 +125,8 @@ func (m *YxCalculationMajorMapper) FindRecommendList(query dto.SchoolMajorQuery) cm.limitation, cm.other_score_limitation, s.province as province, - s.school_nature as schoolNature, - s.institution_type as institutionType + s.school_nature, + s.institution_type FROM %s cm LEFT JOIN yx_school_child sc ON sc.school_code = cm.school_code LEFT JOIN yx_school_research_teaching srt ON srt.school_id = sc.school_id @@ -146,6 +146,7 @@ func (m *YxCalculationMajorMapper) FindRecommendList(query dto.SchoolMajorQuery) mainSQL += " AND (cm.enroll_probability >= 93)" } + mainSQL += " ORDER BY cm.enroll_probability DESC" // 6. 分页参数合法性校验 page := query.Page size := query.Size @@ -182,7 +183,7 @@ func (m *YxCalculationMajorMapper) FindRecommendList(query dto.SchoolMajorQuery) countErr = config.DB.Raw(countSQL, params...).Count(&total).Error // 计算该协程耗时,通过互斥锁安全写入共享变量 mu.Lock() - queryCost.CountCost = time.Now().Sub(start) + queryCost.CountCost = time.Since(start) mu.Unlock() }() @@ -194,7 +195,7 @@ func (m *YxCalculationMajorMapper) FindRecommendList(query dto.SchoolMajorQuery) probCountErr = config.DB.Raw(probCountSQL, params...).Scan(&probCount).Error // 计算该协程耗时,通过互斥锁安全写入共享变量 mu.Lock() - queryCost.ProbCountCost = time.Now().Sub(start) + queryCost.ProbCountCost = time.Since(start) mu.Unlock() }() @@ -206,14 +207,14 @@ func (m *YxCalculationMajorMapper) FindRecommendList(query dto.SchoolMajorQuery) queryErr = config.DB.Raw(mainSQL, params...).Scan(&items).Error // 计算该协程耗时,通过互斥锁安全写入共享变量 mu.Lock() - queryCost.QueryCost = time.Now().Sub(start) + queryCost.QueryCost = time.Since(start) mu.Unlock() }() wg.Wait() // 计算整体总耗时 - queryCost.TotalCost = time.Now().Sub(totalStartTime) + queryCost.TotalCost = time.Since(totalStartTime) // 打印各协程耗时和总耗时(按需输出,可注释或删除) fmt.Printf("各查询耗时统计:\n")