<?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.community.huiju.dao.ToSysMenuMapper">
  <resultMap id="BaseResultMap" type="com.community.huiju.model.ToSysMenu">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="menu_name" jdbcType="VARCHAR" property="menuName" />
    <result column="menu_url" jdbcType="VARCHAR" property="menuUrl" />
    <result column="menu_icon" jdbcType="VARCHAR" property="menuIcon" />
    <result column="parent_id" jdbcType="INTEGER" property="parentId" />
    <result column="sort" jdbcType="INTEGER" property="sort" />
    <result column="menu_type" jdbcType="CHAR" property="menuType" />
    <result column="status" jdbcType="CHAR" property="status" />
  </resultMap>
  <sql id="Base_Column_List">
    id, menu_name, menu_url, menu_icon, parent_id, sort, menu_type, status
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from to_sys_menu
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from to_sys_menu
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.community.huiju.model.ToSysMenu">
    insert into to_sys_menu (id, menu_name, menu_url, 
      menu_icon, parent_id, sort, 
      menu_type, status)
    values (#{id,jdbcType=INTEGER}, #{menuName,jdbcType=VARCHAR}, #{menuUrl,jdbcType=VARCHAR}, 
      #{menuIcon,jdbcType=VARCHAR}, #{parentId,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER}, 
      #{menuType,jdbcType=CHAR}, #{status,jdbcType=CHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.community.huiju.model.ToSysMenu">
    insert into to_sys_menu
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="menuName != null">
        menu_name,
      </if>
      <if test="menuUrl != null">
        menu_url,
      </if>
      <if test="menuIcon != null">
        menu_icon,
      </if>
      <if test="parentId != null">
        parent_id,
      </if>
      <if test="sort != null">
        sort,
      </if>
      <if test="menuType != null">
        menu_type,
      </if>
      <if test="status != null">
        status,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="menuName != null">
        #{menuName,jdbcType=VARCHAR},
      </if>
      <if test="menuUrl != null">
        #{menuUrl,jdbcType=VARCHAR},
      </if>
      <if test="menuIcon != null">
        #{menuIcon,jdbcType=VARCHAR},
      </if>
      <if test="parentId != null">
        #{parentId,jdbcType=INTEGER},
      </if>
      <if test="sort != null">
        #{sort,jdbcType=INTEGER},
      </if>
      <if test="menuType != null">
        #{menuType,jdbcType=CHAR},
      </if>
      <if test="status != null">
        #{status,jdbcType=CHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.ToSysMenu">
    update to_sys_menu
    <set>
      <if test="menuName != null">
        menu_name = #{menuName,jdbcType=VARCHAR},
      </if>
      <if test="menuUrl != null">
        menu_url = #{menuUrl,jdbcType=VARCHAR},
      </if>
      <if test="menuIcon != null">
        menu_icon = #{menuIcon,jdbcType=VARCHAR},
      </if>
      <if test="parentId != null">
        parent_id = #{parentId,jdbcType=INTEGER},
      </if>
      <if test="sort != null">
        sort = #{sort,jdbcType=INTEGER},
      </if>
      <if test="menuType != null">
        menu_type = #{menuType,jdbcType=CHAR},
      </if>
      <if test="status != null">
        status = #{status,jdbcType=CHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.ToSysMenu">
    update to_sys_menu
    set menu_name = #{menuName,jdbcType=VARCHAR},
      menu_url = #{menuUrl,jdbcType=VARCHAR},
      menu_icon = #{menuIcon,jdbcType=VARCHAR},
      parent_id = #{parentId,jdbcType=INTEGER},
      sort = #{sort,jdbcType=INTEGER},
      menu_type = #{menuType,jdbcType=CHAR},
      status = #{status,jdbcType=CHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>