自己学习使用笔记
public async Task<IEnumerable<GetExamSubjInfoListTemp>> GetExamSubjectMainInfoList(string uni_id) { string sql = @" SELECT T.ttm_id, T.ttd_id, T.class_group_uid,G.class_group_name, R.ttr_level, T.sub_id,S.sub_name, T.total_score,T.passing_score, (case R.ttr_name when '不及格' then r.ttr_minscore else null end) score10, (case R.ttr_name when '不及格' then r.ttr_maxscore else null end) score11, (case R.ttr_name when '及格' then r.ttr_minscore else null end) score20, (case R.ttr_name when '及格' then r.ttr_maxscore else null end) score21, (case R.ttr_name when '中等' then r.ttr_minscore else null end) score30, (case R.ttr_name when '中等' then r.ttr_maxscore else null end) score31, (case R.ttr_name when '良好' then r.ttr_minscore else null end) score40, (case R.ttr_name when '良好' then r.ttr_maxscore else null end) score41, (case R.ttr_name when '优秀' then r.ttr_minscore else null end) score50, (case R.ttr_name when '优秀' then r.ttr_maxscore else null end) score51 FROM test_detail T LEFT JOIN test_range R ON T.ttd_id=R.ttd_id AND T.sub_id=R.sub_id LEFT JOIN subject S ON T.sub_id=S.sub_id LEFT JOIN class_group G ON T.class_group_uid=G.class_group_uid WHERE T.isdel=0 AND R.isdel=0 AND G.isdel=0 AND S.isdel=0 and R.ttd_id IS NOT null AND R.uni_id=@uni_id GROUP BY R.sub_id order by t.udate,r.udate desc"; return await ZRF_DapperHelper.QueryAsync<GetExamSubjInfoListTemp>(sql, new { uni_id = uni_id }); }