<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.template.mapper.SmartEvaluateTeacherMapper">

    <select id="getAvgLowingScore" resultType="Double">
        select AVG(lowing_score) as lowing_score from `smart_evaluate_teacher`
            where deleted=0 and term=#{term}
    </select>

    <resultMap type="com.template.model.vo.EvaluateTeacherVo" id="smartTopTeacherMap">
        <result property="id" column="id"/>
        <result property="name" column="name"/>
    </resultMap>

    <select id="smartTopTeacherList" resultType="com.template.model.vo.EvaluateTeacherVo" resultMap="smartTopTeacherMap">
        select id,name from smart_evaluate_teacher
        where term in
        (select t.term from(select term from smart_evaluate_teacher
        where deleted = 0 order by term desc
        limit 1) as t) and deleted = 0
        order by total_score desc
    </select>


</mapper>
