<?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.TSysPermissionMapper">
  <resultMap id="BaseResultMap" type="com.sooka.mybatis.model.TSysPermission">
    <id column="permission_id" jdbcType="INTEGER" property="permissionId" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="description" jdbcType="VARCHAR" property="description" />
    <result column="pid" jdbcType="INTEGER" property="pid" />
  </resultMap>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from t_sys_permission
    where permission_id = #{permissionId,jdbcType=INTEGER}
  </delete>
  <insert id="insert" useGeneratedKeys="true" keyProperty="permissionId" parameterType="com.sooka.mybatis.model.TSysPermission">
    insert into t_sys_permission (name, description,
      pid)
    values (#{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
      #{pid,jdbcType=INTEGER})
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.sooka.mybatis.model.TSysPermission">
    update t_sys_permission
    set name = #{name,jdbcType=VARCHAR},
      description = #{description,jdbcType=VARCHAR},
      pid = #{pid,jdbcType=INTEGER}
    where permission_id = #{permissionId,jdbcType=INTEGER}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select permission_id, name, description, pid
    from t_sys_permission
    where permission_id = #{permissionId,jdbcType=INTEGER}
  </select>
  <select id="selectAll" resultMap="BaseResultMap">
    select permission_id, name, description, pid
    from t_sys_permission
  </select>
</mapper>