<?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="im.zhaojun.system.mapper.OperatorMapper">
  <resultMap id="BaseResultMap" type="im.zhaojun.system.model.Operator">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <id column="operator_id" jdbcType="INTEGER" property="operatorId" />
    <result column="menu_id" jdbcType="INTEGER" property="menuId" />
    <result column="operator_name" jdbcType="VARCHAR" property="operatorName" />
    <result column="url" jdbcType="VARCHAR" property="url" />
    <result column="perms" jdbcType="VARCHAR" property="perms" />
    <result column="http_method" jdbcType="VARCHAR" property="httpMethod" />
    <result column="create_time" jdbcType="VARCHAR" property="createTime" />
    <result column="modify_time" jdbcType="VARCHAR" property="modifyTime" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    operator_id, menu_id, operator_name, url, perms, http_method, create_time, modify_time
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select 
    <include refid="Base_Column_List" />
    from operator
    where operator_id = #{operatorId,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from operator
    where operator_id = #{operatorId,jdbcType=INTEGER}
  </delete>
  <insert id="insert" keyColumn="operator_id" keyProperty="operatorId" parameterType="im.zhaojun.system.model.Operator">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into operator (operator_id ,  menu_id, operator_name, url,
      perms, http_method, create_time, 
      modify_time)
    select max(operator_id )+1,#{menuId,jdbcType=INTEGER}, #{operatorName,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR},#{perms,jdbcType=VARCHAR}, #{httpMethod,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR},#{modifyTime,jdbcType=VARCHAR},#{createTime,jdbcType=VARCHAR},#{modifyTime,jdbcType=VARCHAR}
     </insert>
  <update id="updateByPrimaryKey" parameterType="im.zhaojun.system.model.Operator">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update operator
    set menu_id = #{menuId,jdbcType=INTEGER},
      operator_name = #{operatorName,jdbcType=VARCHAR},
      url = #{url,jdbcType=VARCHAR},
      perms = #{perms,jdbcType=VARCHAR},
      http_method = #{httpMethod,jdbcType=VARCHAR},
      modify_time = #{modifyTime,jdbcType=VARCHAR}
    where operator_id = #{operatorId,jdbcType=INTEGER}
  </update>

  <select id="selectByMenuId" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List"/>
    from operator
    where menu_id = #{menuId,jdbcType=INTEGER}
  </select>

  <select id="selectAll" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List"/>
    from operator
  </select>

  <delete id="deleteByMenuId">
    delete
    from operator
    where menu_id = #{menuId}
  </delete>
</mapper>