<?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.bowintek.smartsearch.mapper.SysMenuMapper">
  <resultMap id="BaseResultMap" type="com.bowintek.smartsearch.model.SysMenu">
    <id column="MenuNo" jdbcType="VARCHAR" property="menuNo" />
    <result column="OrderNo" jdbcType="INTEGER" property="orderNo" />
    <result column="MenuName" jdbcType="VARCHAR" property="menuName" />
    <result column="Icon" jdbcType="VARCHAR" property="icon" />
    <result column="ViewPath" jdbcType="VARCHAR" property="viewPath" />
    <result column="Url" jdbcType="VARCHAR" property="url" />
    <result column="ParentMenuNo" jdbcType="VARCHAR" property="parentMenuNo" />
    <result column="Description" jdbcType="VARCHAR" property="description" />
    <result column="IsTopMenu" jdbcType="BIT" property="isTopMenu" />
    <result column="IsVisible" jdbcType="BIT" property="isVisible" />
    <result column="IsLeaf" jdbcType="BIT" property="isLeaf" />
    <result column="FunctionCode" jdbcType="VARCHAR" property="functionCode" />
    <result column="RecordStatus" jdbcType="INTEGER" property="recordStatus" />
    <result column="ShortcutIcon" jdbcType="VARCHAR" property="shortcutIcon" />
  </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">
    MenuNo, OrderNo, MenuName, Icon, ViewPath, Url, ParentMenuNo, Description, IsTopMenu, 
    IsVisible, IsLeaf, FunctionCode, RecordStatus, ShortcutIcon
  </sql>
  <select id="selectByExample" parameterType="com.bowintek.smartsearch.model.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.String" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from sys_menu
    where MenuNo = #{menuNo,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from sys_menu
    where MenuNo = #{menuNo,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="com.bowintek.smartsearch.model.SysMenuExample">
    delete from sys_menu
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.bowintek.smartsearch.model.SysMenu">
    insert into sys_menu (MenuNo, OrderNo, MenuName, 
      Icon, ViewPath, Url, 
      ParentMenuNo, Description, IsTopMenu, 
      IsVisible, IsLeaf, FunctionCode, 
      RecordStatus, ShortcutIcon)
    values (#{menuNo,jdbcType=VARCHAR}, #{orderNo,jdbcType=INTEGER}, #{menuName,jdbcType=VARCHAR}, 
      #{icon,jdbcType=VARCHAR}, #{viewPath,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, 
      #{parentMenuNo,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{isTopMenu,jdbcType=BIT}, 
      #{isVisible,jdbcType=BIT}, #{isLeaf,jdbcType=BIT}, #{functionCode,jdbcType=VARCHAR}, 
      #{recordStatus,jdbcType=INTEGER}, #{shortcutIcon,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.bowintek.smartsearch.model.SysMenu">
    insert into sys_menu
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="menuNo != null">
        MenuNo,
      </if>
      <if test="orderNo != null">
        OrderNo,
      </if>
      <if test="menuName != null">
        MenuName,
      </if>
      <if test="icon != null">
        Icon,
      </if>
      <if test="viewPath != null">
        ViewPath,
      </if>
      <if test="url != null">
        Url,
      </if>
      <if test="parentMenuNo != null">
        ParentMenuNo,
      </if>
      <if test="description != null">
        Description,
      </if>
      <if test="isTopMenu != null">
        IsTopMenu,
      </if>
      <if test="isVisible != null">
        IsVisible,
      </if>
      <if test="isLeaf != null">
        IsLeaf,
      </if>
      <if test="functionCode != null">
        FunctionCode,
      </if>
      <if test="recordStatus != null">
        RecordStatus,
      </if>
      <if test="shortcutIcon != null">
        ShortcutIcon,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="menuNo != null">
        #{menuNo,jdbcType=VARCHAR},
      </if>
      <if test="orderNo != null">
        #{orderNo,jdbcType=INTEGER},
      </if>
      <if test="menuName != null">
        #{menuName,jdbcType=VARCHAR},
      </if>
      <if test="icon != null">
        #{icon,jdbcType=VARCHAR},
      </if>
      <if test="viewPath != null">
        #{viewPath,jdbcType=VARCHAR},
      </if>
      <if test="url != null">
        #{url,jdbcType=VARCHAR},
      </if>
      <if test="parentMenuNo != null">
        #{parentMenuNo,jdbcType=VARCHAR},
      </if>
      <if test="description != null">
        #{description,jdbcType=VARCHAR},
      </if>
      <if test="isTopMenu != null">
        #{isTopMenu,jdbcType=BIT},
      </if>
      <if test="isVisible != null">
        #{isVisible,jdbcType=BIT},
      </if>
      <if test="isLeaf != null">
        #{isLeaf,jdbcType=BIT},
      </if>
      <if test="functionCode != null">
        #{functionCode,jdbcType=VARCHAR},
      </if>
      <if test="recordStatus != null">
        #{recordStatus,jdbcType=INTEGER},
      </if>
      <if test="shortcutIcon != null">
        #{shortcutIcon,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.bowintek.smartsearch.model.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="row.menuNo != null">
        MenuNo = #{row.menuNo,jdbcType=VARCHAR},
      </if>
      <if test="row.orderNo != null">
        OrderNo = #{row.orderNo,jdbcType=INTEGER},
      </if>
      <if test="row.menuName != null">
        MenuName = #{row.menuName,jdbcType=VARCHAR},
      </if>
      <if test="row.icon != null">
        Icon = #{row.icon,jdbcType=VARCHAR},
      </if>
      <if test="row.viewPath != null">
        ViewPath = #{row.viewPath,jdbcType=VARCHAR},
      </if>
      <if test="row.url != null">
        Url = #{row.url,jdbcType=VARCHAR},
      </if>
      <if test="row.parentMenuNo != null">
        ParentMenuNo = #{row.parentMenuNo,jdbcType=VARCHAR},
      </if>
      <if test="row.description != null">
        Description = #{row.description,jdbcType=VARCHAR},
      </if>
      <if test="row.isTopMenu != null">
        IsTopMenu = #{row.isTopMenu,jdbcType=BIT},
      </if>
      <if test="row.isVisible != null">
        IsVisible = #{row.isVisible,jdbcType=BIT},
      </if>
      <if test="row.isLeaf != null">
        IsLeaf = #{row.isLeaf,jdbcType=BIT},
      </if>
      <if test="row.functionCode != null">
        FunctionCode = #{row.functionCode,jdbcType=VARCHAR},
      </if>
      <if test="row.recordStatus != null">
        RecordStatus = #{row.recordStatus,jdbcType=INTEGER},
      </if>
      <if test="row.shortcutIcon != null">
        ShortcutIcon = #{row.shortcutIcon,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="example != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update sys_menu
    set MenuNo = #{row.menuNo,jdbcType=VARCHAR},
      OrderNo = #{row.orderNo,jdbcType=INTEGER},
      MenuName = #{row.menuName,jdbcType=VARCHAR},
      Icon = #{row.icon,jdbcType=VARCHAR},
      ViewPath = #{row.viewPath,jdbcType=VARCHAR},
      Url = #{row.url,jdbcType=VARCHAR},
      ParentMenuNo = #{row.parentMenuNo,jdbcType=VARCHAR},
      Description = #{row.description,jdbcType=VARCHAR},
      IsTopMenu = #{row.isTopMenu,jdbcType=BIT},
      IsVisible = #{row.isVisible,jdbcType=BIT},
      IsLeaf = #{row.isLeaf,jdbcType=BIT},
      FunctionCode = #{row.functionCode,jdbcType=VARCHAR},
      RecordStatus = #{row.recordStatus,jdbcType=INTEGER},
      ShortcutIcon = #{row.shortcutIcon,jdbcType=VARCHAR}
    <if test="example != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.bowintek.smartsearch.model.SysMenu">
    update sys_menu
    <set>
      <if test="orderNo != null">
        OrderNo = #{orderNo,jdbcType=INTEGER},
      </if>
      <if test="menuName != null">
        MenuName = #{menuName,jdbcType=VARCHAR},
      </if>
      <if test="icon != null">
        Icon = #{icon,jdbcType=VARCHAR},
      </if>
      <if test="viewPath != null">
        ViewPath = #{viewPath,jdbcType=VARCHAR},
      </if>
      <if test="url != null">
        Url = #{url,jdbcType=VARCHAR},
      </if>
      <if test="parentMenuNo != null">
        ParentMenuNo = #{parentMenuNo,jdbcType=VARCHAR},
      </if>
      <if test="description != null">
        Description = #{description,jdbcType=VARCHAR},
      </if>
      <if test="isTopMenu != null">
        IsTopMenu = #{isTopMenu,jdbcType=BIT},
      </if>
      <if test="isVisible != null">
        IsVisible = #{isVisible,jdbcType=BIT},
      </if>
      <if test="isLeaf != null">
        IsLeaf = #{isLeaf,jdbcType=BIT},
      </if>
      <if test="functionCode != null">
        FunctionCode = #{functionCode,jdbcType=VARCHAR},
      </if>
      <if test="recordStatus != null">
        RecordStatus = #{recordStatus,jdbcType=INTEGER},
      </if>
      <if test="shortcutIcon != null">
        ShortcutIcon = #{shortcutIcon,jdbcType=VARCHAR},
      </if>
    </set>
    where MenuNo = #{menuNo,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.bowintek.smartsearch.model.SysMenu">
    update sys_menu
    set OrderNo = #{orderNo,jdbcType=INTEGER},
      MenuName = #{menuName,jdbcType=VARCHAR},
      Icon = #{icon,jdbcType=VARCHAR},
      ViewPath = #{viewPath,jdbcType=VARCHAR},
      Url = #{url,jdbcType=VARCHAR},
      ParentMenuNo = #{parentMenuNo,jdbcType=VARCHAR},
      Description = #{description,jdbcType=VARCHAR},
      IsTopMenu = #{isTopMenu,jdbcType=BIT},
      IsVisible = #{isVisible,jdbcType=BIT},
      IsLeaf = #{isLeaf,jdbcType=BIT},
      FunctionCode = #{functionCode,jdbcType=VARCHAR},
      RecordStatus = #{recordStatus,jdbcType=INTEGER},
      ShortcutIcon = #{shortcutIcon,jdbcType=VARCHAR}
    where MenuNo = #{menuNo,jdbcType=VARCHAR}
  </update>
</mapper>