<?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.yunfeiyun.agmp.common.web.system.mapper.SysRoleMenuMapper">

	<resultMap type="SysRoleMenu" id="SysRoleMenuResult">
		<result property="roleId"     column="roleId"      />
		<result property="menuId"     column="menuId"      />
	</resultMap>
	
	<select id="checkMenuExistRole" resultType="Integer">
	    select count(1) from SysRolemenu where menuId = #{menuId}
	</select>

	<delete id="deleteRoleMenuByRoleId" parameterType="String">
		delete from SysRolemenu where roleId=#{roleId}
	</delete>
	
	<delete id="deleteRoleMenu" parameterType="String">
 		delete from SysRolemenu where roleId in
 		<foreach collection="array" item="roleId" open="(" separator="," close=")">
 			#{roleId}
        </foreach> 
 	</delete>
	
	<insert id="batchRoleMenu">
		insert into SysRolemenu(rolemenuId,roleId, menuId) values
		<foreach item="item" index="index" collection="list" separator=",">
			(#{item.roleMenuId},#{item.roleId},#{item.menuId})
		</foreach>
	</insert>
	
</mapper> 