<?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.saye.hospitalgd.mapper.system.MenuRoleMapper">

    <resultMap id="BaseResultMap" type="com.saye.hospitalgd.model.MenuRole" >
        <id column="menu_role_id" property="menuRoleId" jdbcType="VARCHAR" />
        <result column="role_id" property="roleId" jdbcType="VARCHAR" />
        <result column="menu_id" property="menuId" jdbcType="VARCHAR" />     
    </resultMap>
    
    <delete id="deleteMenuRole">
    
    DELETE FROM menu_role WHERE ROLE_ID = #{roleId}
    </delete>
    
    <insert id="insertMenuRole">
    insert into menu_role(role_id,menu_id) values(#{roleId},#{menuId})
    </insert>
    
    <select id="getMenuRolesByRoleId"  resultMap="BaseResultMap">
    	select t.menu_role_id,t.role_id,t.menu_id from menu_role t left join menu u on t.menu_id=u.menu_id
    	 where t.role_id=#{roleId} and u.RESLEVEL='3'
    </select>
    
</mapper>