<?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.sapi.mapper.assess.AssessUserMapper">
    <!--获取评价用户详情-->
    <select id="listByAssess" resultType="java.util.Map">
        select au.auid,u.username,au.aunum,au.autime,au.comm
        ,(select count(*) from t_assess_file af where af.auid=au.auid)filenum
        ,au.stutype,au.gradeid,au.snum,au.createtime
        ,(select u.username from t_user u where u.userid=au.createid)createname
        ,(select c.classname from t_class c where c.classid=au.classid)classname
        ,(select s.subjectname from t_subject s where s.subjectid=au.subjectid)subjectname
        from t_assess_user au left join t_user u on au.userid=u.userid
        where au.userid=#{user.userid} and au.quotaid=#{user.quotaid} and au.autype=#{user.autype}
        <if test="user.assessid!=null and user.assessid!=0">
            and au.assessid=#{user.assessid}
        </if>
        <if test="user.templateid!=null and user.templateid!=0">
            and au.templateid=#{user.templateid}
        </if>
        <if test="user.starttime!=null and user.starttime!=0">
            and au.autime>=#{user.starttime}
        </if>
        <if test="user.stoptime!=null and user.stoptime!=0">
            and au.autime&lt;=#{user.stoptime}
        </if>
        <if test="user.gradeid!=null and user.gradeid!=0">
            and au.gradeid=#{user.gradeid}
        </if>
        <if test="user.classid!=null and user.classid!=0">
            and au.classid=#{user.classid}
        </if>
        order by au.autime
    </select>
    <!--获取评价用户附件列表-->
    <select id="listFile" resultType="java.util.Map">
        select filename,fileclass,fileurl,filecover,converted,pdfurl,suffix,filesize,duration
        from t_assess_file where auid=#{auid}
    </select>
</mapper>
