<?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.sstudy.mapper.system.SchoolMapper">

    <!--获取学校当前年份-->
    <select id="getYearById" resultType="java.lang.Integer">
        select year from t_school where schoolid=#{schoolid}
    </select>
    <!--获取用户当前年份-->
    <select id="getYearByUserId" resultType="java.lang.Integer">
        select s.year from t_user u left join t_school s on u.schoolid=s.schoolid
        where u.userid=#{userid}
    </select>
    <!--根据学校ids获取学校名称集合-->
    <select id="listSchoolNameByIds" resultType="java.util.Map">
        select schoolid,schoolname from t_school where schoolid in
        <foreach collection="schoolids" item="schoolid" index="index" open="(" separator="," close=")">${schoolid}</foreach>
    </select>

    <!--获取用户学校id-->
    <select id="getSchoolIdByUserid" resultType="java.lang.Integer">
        select schoolid from t_user where userid=#{userid}
    </select>
</mapper>
