package com.xhkjedu.sapi.mapper.research;

import com.xhkjedu.base.TkMapper;
import com.xhkjedu.sapi.model.research.TResearch;
import com.xhkjedu.sapi.model.research.TResearchUser;
import com.xhkjedu.sapi.vo.research.ResearchUserVo;
import com.xhkjedu.sapi.vo.research.RteacherOtherVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @ClassName ResearchUserMapper
 * Description 教研用户
 * Author WN
 * Date 2020/6/11 18:05
 **/
@Repository
public interface ResearchUserMapper extends TkMapper<TResearchUser> {

    /**
     *功能描述  批量保存教研用户
     * @author WN
     * @date 2020/6/11
     * @param  * @param list
     * @param timestamp
     * @return void
     */
    void saveBatchResearchUser(@Param("list") List<TResearchUser> list, @Param("researchid") int researchid);

    /**
     *功能描述 删除--教研用户
     * @author WN
     * @date 2020/6/11
     * @param  * @param researchid
     * @return void
     */
    void delByResearchid(@Param("researchid") Integer researchid);

    /**
     *功能描述 参与教研所有用户id集合
     * @author WN
     * @date 2020/6/12
     * @param  * @param researchid
     * @return java.util.List<com.xhkjedu.model.research.TResearchUser>
     */
    List<TResearchUser> listRuserIdByResearchid(@Param("researchid") Integer researchid);

    /**
     *功能描述 教研参与评论集合
     * @author WN
     * @date 2020/6/11
     * @param  * @param researchid
     * @return java.util.List<com.xhkjedu.model.research.TResearchUser>
     */
    List<Map> listRusersByReaearchid(@Param("researchid") Integer researchid,@Param("schoolid") Integer schoolid);


    /**
     *功能描述 教师--参与教研集合
     * @author WN
     * @date 2020/6/12
     * @param  * @param userid
     * @param rorder
     * @param timestamp
     * @return java.util.List<com.xhkjedu.vo.research.ResearchVo>
     */
    List<Map> listUserResearchs(@Param("userid") Integer userid, @Param("rorder") String rorder
            , @Param("rustate") Integer rustate, @Param("timestamp") int timestamp);

    /**
     *功能描述 教师--教研详情
     * @author WN
     * @date 2020/6/12
     * @param  * @param researchid
     * @param userid
     * @return com.xhkjedu.vo.research.ResearchUserVo
     */
    ResearchUserVo getResearchUserDetail(@Param("researchid") Integer researchid, @Param("userid") Integer userid);

    /**
     *功能描述  教师--保存评价
     * @author WN
     * @date 2020/6/12
     * @param  * @param ru
     * @return java.lang.Integer
     */
    Integer updateUserResearch(@Param("ru") TResearchUser ru);

    /**
     * 其他教研活动列表
     * @Param [research]
     * @Author ywx
     * @Date 2020/6/23 14:24
     * @return java.util.List<com.xhkjedu.vo.research.ResearchVo>
     **/
    List<Map> otherList(@Param("research") TResearchUser research);

    /**
     * 教师未评价教研数量
     * @Param [userid]
     * @Author ywx
     * @Date 2020/7/24 10:45
     * @return java.lang.Integer
     **/
    Integer noEvaluatedNum(@Param("userid") Integer userid, @Param("timestamp") int timestamp);

    //获取学校下用户教研评价
    List<Map<String, String>> listUserByRidAndSid(@Param("researchid") Integer researchid
            , @Param("schoolid") Integer schoolid,@Param("userid") Integer userid);

    //教研学校用户
    List<Map> listReaearchSchools(@Param("researchid") Integer researchid,@Param("publiced") Integer publiced, @Param("schoolid") Integer schoolid);

    //根据教研教师id获取教研截至时间
    TResearch getResearchStoptime(@Param("ruid") Integer ruid);

    //删除已评价教研
    Integer delTeacherResearch(@Param("ruid") Integer ruid);

    //修改已评价教研
    Integer updateTeacherResearch(@Param("ru") TResearchUser ru);

    // 获取教研教师其他信息
    List<RteacherOtherVo> listResearchTeacherOthers(@Param("userids")Set<Integer> userids);
}
