<?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.sooka.mybatis.mapper.TSysRolePermissionMapper">
  <resultMap id="BaseResultMap" type="com.sooka.mybatis.model.TSysRolePermission">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="role_id" jdbcType="INTEGER" property="roleId" />
    <result column="permisson_id" jdbcType="INTEGER" property="permissonId" />
  </resultMap>

  <delete id="delectByRoleId" parameterType="java.lang.Integer">
    delete  from t_sys_role_permission where  role_id=#{roleId}
  </delete>

  <delete id="delectByPermissionId" parameterType="java.lang.Integer">
    delete  from t_sys_role_permission where  permisson_id=#{permissionId}
  </delete>

  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from t_sys_role_permission
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" useGeneratedKeys="true" keyProperty="id"  parameterType="com.sooka.mybatis.model.TSysRolePermission">
    insert into t_sys_role_permission (role_id, permisson_id
      )
    values (#{roleId,jdbcType=INTEGER}, #{permissonId,jdbcType=INTEGER}
      )
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.sooka.mybatis.model.TSysRolePermission">
    update t_sys_role_permission
    set role_id = #{roleId,jdbcType=INTEGER},
      permisson_id = #{permissonId,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select id, role_id, permisson_id
    from t_sys_role_permission
    where id = #{id,jdbcType=INTEGER}
  </select>
  <select id="selectAll" resultMap="BaseResultMap">
    select id, role_id, permisson_id
    from t_sys_role_permission
  </select>
</mapper>