<?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.gateway.mapper.ModuleCheckMapper">

    <!--获取地址对应所有操作-->
    <select id="listAllModuleChecks" resultType="com.xhkjedu.gateway.model.TModuleCheck">
        select * from t_module_check
    </select>

    <!--获取用户当前年份及区域码-->
    <select id="getSchoolCloudByUserid" resultType="com.xhkjedu.gateway.vo.SchoolVo">
        select s.year,u.schoolid,u.usertype,(select cloudcode from t_cloud limit 1) cloudcode
        from t_user u left join t_school s on u.schoolid=s.schoolid
        where u.userid=#{userid}
    </select>

    <!--获取用户所属角色对应的所有模块地址-->
    <select id="listModuleurlsByUserid" resultType="java.lang.String">
        select m.moduleurl from t_module m left join t_role_module rm on m.moduleid=rm.moduleid
        left join t_user_role ur on rm.roleid=ur.roleid
        where ur.userid=#{userid} and m.`level`=2 group by m.moduleurl
    </select>
</mapper>
