updates
This commit is contained in:
parent
85819798ca
commit
ee8c304284
Binary file not shown.
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Reference in New Issue