<?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.xhkjedu.slive.mapper.liveplay.CourseSectionAskteacherMapper">
    <!--设置答案-->
    <update id="setAnswer">
        update l_course_section_askteacher t
        set t.ra=#{ask.ra}
        ,t.stunum=(select count(distinct css.studentid) from l_course_section_askstudent css where css.satid=#{ask.satid})
        where t.satid=#{ask.satid};
        update l_course_section_askstudent s
        set s.sc=(case when s.sa=#{ask.ra} then 1 else 2 end)
        where s.satid=#{ask.satid} and s.sa is not null and s.sa!='';
    </update>
</mapper>
