<?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="io.dataease.base.mapper.SysMenuMapper">
  <resultMap id="BaseResultMap" type="io.dataease.base.domain.SysMenu">
    <id column="menu_id" jdbcType="BIGINT" property="menuId" />
    <result column="pid" jdbcType="BIGINT" property="pid" />
    <result column="sub_count" jdbcType="INTEGER" property="subCount" />
    <result column="type" jdbcType="INTEGER" property="type" />
    <result column="title" jdbcType="VARCHAR" property="title" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="component" jdbcType="VARCHAR" property="component" />
    <result column="menu_sort" jdbcType="INTEGER" property="menuSort" />
    <result column="icon" jdbcType="VARCHAR" property="icon" />
    <result column="path" jdbcType="VARCHAR" property="path" />
    <result column="i_frame" jdbcType="BIT" property="iFrame" />
    <result column="cache" jdbcType="BIT" property="cache" />
    <result column="hidden" jdbcType="BIT" property="hidden" />
    <result column="permission" jdbcType="VARCHAR" property="permission" />
    <result column="create_by" jdbcType="VARCHAR" property="createBy" />
    <result column="update_by" jdbcType="VARCHAR" property="updateBy" />
    <result column="create_time" jdbcType="BIGINT" property="createTime" />
    <result column="update_time" jdbcType="BIGINT" property="updateTime" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    menu_id, pid, sub_count, `type`, title, `name`, component, menu_sort, icon, `path`, 
    i_frame, `cache`, hidden, permission, create_by, update_by, create_time, update_time
  </sql>
  <select id="selectByExample" parameterType="io.dataease.base.domain.SysMenuExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from sys_menu
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from sys_menu
    where menu_id = #{menuId,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from sys_menu
    where menu_id = #{menuId,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="io.dataease.base.domain.SysMenuExample">
    delete from sys_menu
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="io.dataease.base.domain.SysMenu">
    insert into sys_menu (menu_id, pid, sub_count, 
      `type`, title, `name`, 
      component, menu_sort, icon, 
      `path`, i_frame, `cache`, hidden, 
      permission, create_by, update_by, 
      create_time, update_time)
    values (#{menuId,jdbcType=BIGINT}, #{pid,jdbcType=BIGINT}, #{subCount,jdbcType=INTEGER}, 
      #{type,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, 
      #{component,jdbcType=VARCHAR}, #{menuSort,jdbcType=INTEGER}, #{icon,jdbcType=VARCHAR}, 
      #{path,jdbcType=VARCHAR}, #{iFrame,jdbcType=BIT}, #{cache,jdbcType=BIT}, #{hidden,jdbcType=BIT}, 
      #{permission,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{updateBy,jdbcType=VARCHAR}, 
      #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT})
  </insert>
  <insert id="insertSelective" parameterType="io.dataease.base.domain.SysMenu">
    insert into sys_menu
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="menuId != null">
        menu_id,
      </if>
      <if test="pid != null">
        pid,
      </if>
      <if test="subCount != null">
        sub_count,
      </if>
      <if test="type != null">
        `type`,
      </if>
      <if test="title != null">
        title,
      </if>
      <if test="name != null">
        `name`,
      </if>
      <if test="component != null">
        component,
      </if>
      <if test="menuSort != null">
        menu_sort,
      </if>
      <if test="icon != null">
        icon,
      </if>
      <if test="path != null">
        `path`,
      </if>
      <if test="iFrame != null">
        i_frame,
      </if>
      <if test="cache != null">
        `cache`,
      </if>
      <if test="hidden != null">
        hidden,
      </if>
      <if test="permission != null">
        permission,
      </if>
      <if test="createBy != null">
        create_by,
      </if>
      <if test="updateBy != null">
        update_by,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="menuId != null">
        #{menuId,jdbcType=BIGINT},
      </if>
      <if test="pid != null">
        #{pid,jdbcType=BIGINT},
      </if>
      <if test="subCount != null">
        #{subCount,jdbcType=INTEGER},
      </if>
      <if test="type != null">
        #{type,jdbcType=INTEGER},
      </if>
      <if test="title != null">
        #{title,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="component != null">
        #{component,jdbcType=VARCHAR},
      </if>
      <if test="menuSort != null">
        #{menuSort,jdbcType=INTEGER},
      </if>
      <if test="icon != null">
        #{icon,jdbcType=VARCHAR},
      </if>
      <if test="path != null">
        #{path,jdbcType=VARCHAR},
      </if>
      <if test="iFrame != null">
        #{iFrame,jdbcType=BIT},
      </if>
      <if test="cache != null">
        #{cache,jdbcType=BIT},
      </if>
      <if test="hidden != null">
        #{hidden,jdbcType=BIT},
      </if>
      <if test="permission != null">
        #{permission,jdbcType=VARCHAR},
      </if>
      <if test="createBy != null">
        #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="updateBy != null">
        #{updateBy,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=BIGINT},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="io.dataease.base.domain.SysMenuExample" resultType="java.lang.Long">
    select count(*) from sys_menu
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update sys_menu
    <set>
      <if test="record.menuId != null">
        menu_id = #{record.menuId,jdbcType=BIGINT},
      </if>
      <if test="record.pid != null">
        pid = #{record.pid,jdbcType=BIGINT},
      </if>
      <if test="record.subCount != null">
        sub_count = #{record.subCount,jdbcType=INTEGER},
      </if>
      <if test="record.type != null">
        `type` = #{record.type,jdbcType=INTEGER},
      </if>
      <if test="record.title != null">
        title = #{record.title,jdbcType=VARCHAR},
      </if>
      <if test="record.name != null">
        `name` = #{record.name,jdbcType=VARCHAR},
      </if>
      <if test="record.component != null">
        component = #{record.component,jdbcType=VARCHAR},
      </if>
      <if test="record.menuSort != null">
        menu_sort = #{record.menuSort,jdbcType=INTEGER},
      </if>
      <if test="record.icon != null">
        icon = #{record.icon,jdbcType=VARCHAR},
      </if>
      <if test="record.path != null">
        `path` = #{record.path,jdbcType=VARCHAR},
      </if>
      <if test="record.iFrame != null">
        i_frame = #{record.iFrame,jdbcType=BIT},
      </if>
      <if test="record.cache != null">
        `cache` = #{record.cache,jdbcType=BIT},
      </if>
      <if test="record.hidden != null">
        hidden = #{record.hidden,jdbcType=BIT},
      </if>
      <if test="record.permission != null">
        permission = #{record.permission,jdbcType=VARCHAR},
      </if>
      <if test="record.createBy != null">
        create_by = #{record.createBy,jdbcType=VARCHAR},
      </if>
      <if test="record.updateBy != null">
        update_by = #{record.updateBy,jdbcType=VARCHAR},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=BIGINT},
      </if>
      <if test="record.updateTime != null">
        update_time = #{record.updateTime,jdbcType=BIGINT},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update sys_menu
    set menu_id = #{record.menuId,jdbcType=BIGINT},
      pid = #{record.pid,jdbcType=BIGINT},
      sub_count = #{record.subCount,jdbcType=INTEGER},
      `type` = #{record.type,jdbcType=INTEGER},
      title = #{record.title,jdbcType=VARCHAR},
      `name` = #{record.name,jdbcType=VARCHAR},
      component = #{record.component,jdbcType=VARCHAR},
      menu_sort = #{record.menuSort,jdbcType=INTEGER},
      icon = #{record.icon,jdbcType=VARCHAR},
      `path` = #{record.path,jdbcType=VARCHAR},
      i_frame = #{record.iFrame,jdbcType=BIT},
      `cache` = #{record.cache,jdbcType=BIT},
      hidden = #{record.hidden,jdbcType=BIT},
      permission = #{record.permission,jdbcType=VARCHAR},
      create_by = #{record.createBy,jdbcType=VARCHAR},
      update_by = #{record.updateBy,jdbcType=VARCHAR},
      create_time = #{record.createTime,jdbcType=BIGINT},
      update_time = #{record.updateTime,jdbcType=BIGINT}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="io.dataease.base.domain.SysMenu">
    update sys_menu
    <set>
      <if test="pid != null">
        pid = #{pid,jdbcType=BIGINT},
      </if>
      <if test="subCount != null">
        sub_count = #{subCount,jdbcType=INTEGER},
      </if>
      <if test="type != null">
        `type` = #{type,jdbcType=INTEGER},
      </if>
      <if test="title != null">
        title = #{title,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        `name` = #{name,jdbcType=VARCHAR},
      </if>
      <if test="component != null">
        component = #{component,jdbcType=VARCHAR},
      </if>
      <if test="menuSort != null">
        menu_sort = #{menuSort,jdbcType=INTEGER},
      </if>
      <if test="icon != null">
        icon = #{icon,jdbcType=VARCHAR},
      </if>
      <if test="path != null">
        `path` = #{path,jdbcType=VARCHAR},
      </if>
      <if test="iFrame != null">
        i_frame = #{iFrame,jdbcType=BIT},
      </if>
      <if test="cache != null">
        `cache` = #{cache,jdbcType=BIT},
      </if>
      <if test="hidden != null">
        hidden = #{hidden,jdbcType=BIT},
      </if>
      <if test="permission != null">
        permission = #{permission,jdbcType=VARCHAR},
      </if>
      <if test="createBy != null">
        create_by = #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="updateBy != null">
        update_by = #{updateBy,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=BIGINT},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=BIGINT},
      </if>
    </set>
    where menu_id = #{menuId,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.SysMenu">
    update sys_menu
    set pid = #{pid,jdbcType=BIGINT},
      sub_count = #{subCount,jdbcType=INTEGER},
      `type` = #{type,jdbcType=INTEGER},
      title = #{title,jdbcType=VARCHAR},
      `name` = #{name,jdbcType=VARCHAR},
      component = #{component,jdbcType=VARCHAR},
      menu_sort = #{menuSort,jdbcType=INTEGER},
      icon = #{icon,jdbcType=VARCHAR},
      `path` = #{path,jdbcType=VARCHAR},
      i_frame = #{iFrame,jdbcType=BIT},
      `cache` = #{cache,jdbcType=BIT},
      hidden = #{hidden,jdbcType=BIT},
      permission = #{permission,jdbcType=VARCHAR},
      create_by = #{createBy,jdbcType=VARCHAR},
      update_by = #{updateBy,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=BIGINT},
      update_time = #{updateTime,jdbcType=BIGINT}
    where menu_id = #{menuId,jdbcType=BIGINT}
  </update>
</mapper>