<?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="org.linlinjava.litemall.db.dao.LitemallCategoryMapper">
  <resultMap id="BaseResultMap" type="org.linlinjava.litemall.db.domain.LitemallCategory">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="keywords" jdbcType="VARCHAR" property="keywords" />
    <result column="front_desc" jdbcType="VARCHAR" property="frontDesc" />
    <result column="parent_id" jdbcType="INTEGER" property="parentId" />
    <result column="sort_order" jdbcType="TINYINT" property="sortOrder" />
    <result column="show_index" jdbcType="TINYINT" property="showIndex" />
    <result column="is_show" jdbcType="BIT" property="isShow" />
    <result column="banner_url" jdbcType="VARCHAR" property="bannerUrl" />
    <result column="icon_url" jdbcType="VARCHAR" property="iconUrl" />
    <result column="img_url" jdbcType="VARCHAR" property="imgUrl" />
    <result column="wap_banner_url" jdbcType="VARCHAR" property="wapBannerUrl" />
    <result column="level" jdbcType="VARCHAR" property="level" />
    <result column="type" jdbcType="INTEGER" property="type" />
    <result column="front_name" jdbcType="VARCHAR" property="frontName" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    <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">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    <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">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    id, `name`, keywords, front_desc, parent_id, sort_order, show_index, is_show, banner_url, 
    icon_url, img_url, wap_banner_url, `level`, `type`, front_name
  </sql>
  <select id="selectByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallCategoryExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from litemall_category
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByExampleSelective" parameterType="map" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      @project https://github.com/itfsw/mybatis-generator-plugin
    -->
    select
    <if test="example.distinct">
      distinct
    </if>
    <foreach collection="selective" item="column" separator=",">
      ${column.value}
    </foreach>
    from litemall_category
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
    <if test="example.orderByClause != null">
      order by ${example.orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    select 
    <include refid="Base_Column_List" />
    from litemall_category
    where id = #{id,jdbcType=INTEGER}
  </select>
  <select id="selectByPrimaryKeySelective" parameterType="map" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      @project https://github.com/itfsw/mybatis-generator-plugin
    -->
    select
    <foreach collection="selective" item="column" separator=",">
      ${column.value}
    </foreach>
    from litemall_category
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    delete from litemall_category
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallCategoryExample">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    delete from litemall_category
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="org.linlinjava.litemall.db.domain.LitemallCategory">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into litemall_category (`name`, keywords, front_desc, 
      parent_id, sort_order, show_index, 
      is_show, banner_url, icon_url, 
      img_url, wap_banner_url, `level`, 
      `type`, front_name)
    values (#{name,jdbcType=VARCHAR}, #{keywords,jdbcType=VARCHAR}, #{frontDesc,jdbcType=VARCHAR}, 
      #{parentId,jdbcType=INTEGER}, #{sortOrder,jdbcType=TINYINT}, #{showIndex,jdbcType=TINYINT}, 
      #{isShow,jdbcType=BIT}, #{bannerUrl,jdbcType=VARCHAR}, #{iconUrl,jdbcType=VARCHAR}, 
      #{imgUrl,jdbcType=VARCHAR}, #{wapBannerUrl,jdbcType=VARCHAR}, #{level,jdbcType=VARCHAR}, 
      #{type,jdbcType=INTEGER}, #{frontName,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="org.linlinjava.litemall.db.domain.LitemallCategory">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into litemall_category
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="name != null">
        `name`,
      </if>
      <if test="keywords != null">
        keywords,
      </if>
      <if test="frontDesc != null">
        front_desc,
      </if>
      <if test="parentId != null">
        parent_id,
      </if>
      <if test="sortOrder != null">
        sort_order,
      </if>
      <if test="showIndex != null">
        show_index,
      </if>
      <if test="isShow != null">
        is_show,
      </if>
      <if test="bannerUrl != null">
        banner_url,
      </if>
      <if test="iconUrl != null">
        icon_url,
      </if>
      <if test="imgUrl != null">
        img_url,
      </if>
      <if test="wapBannerUrl != null">
        wap_banner_url,
      </if>
      <if test="level != null">
        `level`,
      </if>
      <if test="type != null">
        `type`,
      </if>
      <if test="frontName != null">
        front_name,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="keywords != null">
        #{keywords,jdbcType=VARCHAR},
      </if>
      <if test="frontDesc != null">
        #{frontDesc,jdbcType=VARCHAR},
      </if>
      <if test="parentId != null">
        #{parentId,jdbcType=INTEGER},
      </if>
      <if test="sortOrder != null">
        #{sortOrder,jdbcType=TINYINT},
      </if>
      <if test="showIndex != null">
        #{showIndex,jdbcType=TINYINT},
      </if>
      <if test="isShow != null">
        #{isShow,jdbcType=BIT},
      </if>
      <if test="bannerUrl != null">
        #{bannerUrl,jdbcType=VARCHAR},
      </if>
      <if test="iconUrl != null">
        #{iconUrl,jdbcType=VARCHAR},
      </if>
      <if test="imgUrl != null">
        #{imgUrl,jdbcType=VARCHAR},
      </if>
      <if test="wapBannerUrl != null">
        #{wapBannerUrl,jdbcType=VARCHAR},
      </if>
      <if test="level != null">
        #{level,jdbcType=VARCHAR},
      </if>
      <if test="type != null">
        #{type,jdbcType=INTEGER},
      </if>
      <if test="frontName != null">
        #{frontName,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallCategoryExample" resultType="java.lang.Long">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    select count(*) from litemall_category
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    update litemall_category
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.name != null">
        `name` = #{record.name,jdbcType=VARCHAR},
      </if>
      <if test="record.keywords != null">
        keywords = #{record.keywords,jdbcType=VARCHAR},
      </if>
      <if test="record.frontDesc != null">
        front_desc = #{record.frontDesc,jdbcType=VARCHAR},
      </if>
      <if test="record.parentId != null">
        parent_id = #{record.parentId,jdbcType=INTEGER},
      </if>
      <if test="record.sortOrder != null">
        sort_order = #{record.sortOrder,jdbcType=TINYINT},
      </if>
      <if test="record.showIndex != null">
        show_index = #{record.showIndex,jdbcType=TINYINT},
      </if>
      <if test="record.isShow != null">
        is_show = #{record.isShow,jdbcType=BIT},
      </if>
      <if test="record.bannerUrl != null">
        banner_url = #{record.bannerUrl,jdbcType=VARCHAR},
      </if>
      <if test="record.iconUrl != null">
        icon_url = #{record.iconUrl,jdbcType=VARCHAR},
      </if>
      <if test="record.imgUrl != null">
        img_url = #{record.imgUrl,jdbcType=VARCHAR},
      </if>
      <if test="record.wapBannerUrl != null">
        wap_banner_url = #{record.wapBannerUrl,jdbcType=VARCHAR},
      </if>
      <if test="record.level != null">
        `level` = #{record.level,jdbcType=VARCHAR},
      </if>
      <if test="record.type != null">
        `type` = #{record.type,jdbcType=INTEGER},
      </if>
      <if test="record.frontName != null">
        front_name = #{record.frontName,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    update litemall_category
    set id = #{record.id,jdbcType=INTEGER},
      `name` = #{record.name,jdbcType=VARCHAR},
      keywords = #{record.keywords,jdbcType=VARCHAR},
      front_desc = #{record.frontDesc,jdbcType=VARCHAR},
      parent_id = #{record.parentId,jdbcType=INTEGER},
      sort_order = #{record.sortOrder,jdbcType=TINYINT},
      show_index = #{record.showIndex,jdbcType=TINYINT},
      is_show = #{record.isShow,jdbcType=BIT},
      banner_url = #{record.bannerUrl,jdbcType=VARCHAR},
      icon_url = #{record.iconUrl,jdbcType=VARCHAR},
      img_url = #{record.imgUrl,jdbcType=VARCHAR},
      wap_banner_url = #{record.wapBannerUrl,jdbcType=VARCHAR},
      `level` = #{record.level,jdbcType=VARCHAR},
      `type` = #{record.type,jdbcType=INTEGER},
      front_name = #{record.frontName,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="org.linlinjava.litemall.db.domain.LitemallCategory">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    update litemall_category
    <set>
      <if test="name != null">
        `name` = #{name,jdbcType=VARCHAR},
      </if>
      <if test="keywords != null">
        keywords = #{keywords,jdbcType=VARCHAR},
      </if>
      <if test="frontDesc != null">
        front_desc = #{frontDesc,jdbcType=VARCHAR},
      </if>
      <if test="parentId != null">
        parent_id = #{parentId,jdbcType=INTEGER},
      </if>
      <if test="sortOrder != null">
        sort_order = #{sortOrder,jdbcType=TINYINT},
      </if>
      <if test="showIndex != null">
        show_index = #{showIndex,jdbcType=TINYINT},
      </if>
      <if test="isShow != null">
        is_show = #{isShow,jdbcType=BIT},
      </if>
      <if test="bannerUrl != null">
        banner_url = #{bannerUrl,jdbcType=VARCHAR},
      </if>
      <if test="iconUrl != null">
        icon_url = #{iconUrl,jdbcType=VARCHAR},
      </if>
      <if test="imgUrl != null">
        img_url = #{imgUrl,jdbcType=VARCHAR},
      </if>
      <if test="wapBannerUrl != null">
        wap_banner_url = #{wapBannerUrl,jdbcType=VARCHAR},
      </if>
      <if test="level != null">
        `level` = #{level,jdbcType=VARCHAR},
      </if>
      <if test="type != null">
        `type` = #{type,jdbcType=INTEGER},
      </if>
      <if test="frontName != null">
        front_name = #{frontName,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="org.linlinjava.litemall.db.domain.LitemallCategory">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    update litemall_category
    set `name` = #{name,jdbcType=VARCHAR},
      keywords = #{keywords,jdbcType=VARCHAR},
      front_desc = #{frontDesc,jdbcType=VARCHAR},
      parent_id = #{parentId,jdbcType=INTEGER},
      sort_order = #{sortOrder,jdbcType=TINYINT},
      show_index = #{showIndex,jdbcType=TINYINT},
      is_show = #{isShow,jdbcType=BIT},
      banner_url = #{bannerUrl,jdbcType=VARCHAR},
      icon_url = #{iconUrl,jdbcType=VARCHAR},
      img_url = #{imgUrl,jdbcType=VARCHAR},
      wap_banner_url = #{wapBannerUrl,jdbcType=VARCHAR},
      `level` = #{level,jdbcType=VARCHAR},
      `type` = #{type,jdbcType=INTEGER},
      front_name = #{frontName,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <select id="selectOneByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallCategoryExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      @project https://github.com/itfsw/mybatis-generator-plugin
    -->
    select
    <include refid="Base_Column_List" />
    from litemall_category
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
    limit 1
  </select>
  <select id="selectOneByExampleSelective" parameterType="map" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      @project https://github.com/itfsw/mybatis-generator-plugin
    -->
    select
    <foreach collection="selective" item="column" separator=",">
      ${column.value}
    </foreach>
    from litemall_category
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
    <if test="example.orderByClause != null">
      order by ${example.orderByClause}
    </if>
    limit 1
  </select>
</mapper>