<?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.fjs.scenic.mapper.system.ManageRoleMapper" >
  <resultMap id="BaseResultMap" type="com.fjs.scenic.entity.system.ManageRole" >
    <constructor >
      <arg column="manage_id" jdbcType="INTEGER" javaType="java.lang.Integer" />
      <arg column="role_id" jdbcType="INTEGER" javaType="java.lang.Integer" />
    </constructor>
  </resultMap>
  <insert id="insert" parameterType="com.fjs.scenic.entity.system.ManageRole" >
    insert into manage_role (manage_id, role_id)
    values (#{manageId,jdbcType=INTEGER}, #{roleId,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.fjs.scenic.entity.system.ManageRole" >
    insert into manage_role
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="manageId != null" >
        manage_id,
      </if>
      <if test="roleId != null" >
        role_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="manageId != null" >
        #{manageId,jdbcType=INTEGER},
      </if>
      <if test="roleId != null" >
        #{roleId,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>

  <delete id="deleteByManageId" parameterType="java.lang.Integer">
    DELETE FROM manage_role
    WHERE manage_id=#{manageId,jdbcType=INTEGER}
  </delete>

  <insert id="insertManageRoleList" >
    INSERT INTO manage_role(manage_id, role_id)
    VALUES
    <foreach collection="roleIds" item="roleId"  separator=",">
      (#{manageId,jdbcType=INTEGER},#{roleId,jdbcType=INTEGER})
    </foreach>
  </insert>
</mapper>