<?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.tmerclub.cloud.platform.mapper.SysAccessMenuMapper">

  <resultMap id="sysAccessMenuMap" type="com.tmerclub.cloud.platform.model.SysAccessMenu">
    <id column="id" property="id" />
    <result column="sys_access_key_id" property="sysAccessKeyId"/>
    <result column="menu_id" property="menuId"/>
  </resultMap>

  <insert id="insertAccessKeyAndMenu">
    insert into sys_access_menu (sys_access_key_id,menu_id) values
    <foreach collection="menuIdList" item="menuId" separator=",">
      (#{sysAccessKeyId},#{menuId})
    </foreach>
  </insert>

  <select id="queryAllPermsBySysMenu" resultType="java.lang.Long" parameterType="java.lang.Long">
    SELECT menu_id FROM sys_access_menu
    WHERE sys_access_key_id = #{sysAccessKeyId}
  </select>
  <select id="queryAllPermsByShopMenu" resultType="java.lang.Long" parameterType="java.lang.Long">
    SELECT menu_id FROM sys_access_menu
    WHERE sys_access_key_id = #{sysAccessKeyId}
  </select>

  <select id="listMenuIdAccessId" resultType="java.lang.Long">
    SELECT menu_id FROM sys_access_menu where sys_access_key_id = #{sysAccessKeyId}
  </select>

  <delete id="deleteSysAccessMenuById" parameterType="java.lang.Long">
    delete from sys_access_menu where sys_access_key_id = #{sysAccessKeyId}
  </delete>
</mapper>
