<?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.jz.db.dao.JzGoodsCategoryMapper">
    <resultMap id="BaseResultMap" type="org.linlinjava.jz.db.domain.JzGoodsCategory">
        <id column="id" property="id" jdbcType="INTEGER"/>
        <result column="name" property="name" jdbcType="VARCHAR"/>
        <result column="keywords" property="keywords" jdbcType="VARCHAR"/>
        <result column="desc" property="desc" jdbcType="VARCHAR"/>
        <result column="pid" property="pid" jdbcType="INTEGER"/>
        <result column="icon_url" property="iconUrl" jdbcType="VARCHAR"/>
        <result column="pic_url" property="picUrl" jdbcType="VARCHAR"/>
        <result column="level" property="level" jdbcType="VARCHAR"/>
        <result column="sort_order" property="sortOrder" jdbcType="TINYINT"/>
        <result column="add_time" property="addTime" jdbcType="TIMESTAMP"/>
        <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
        <result column="deleted" property="deleted" jdbcType="BIT"/>
    </resultMap>
    <sql id="Base_Column_List">
        id
        , name, keywords, `desc`, pid, icon_url, pic_url, level, sort_order, add_time, update_time,
    deleted
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
        select
        <include refid="Base_Column_List"/>
        from jz_goods_category
        where id = #{id,jdbcType=INTEGER}
    </select>
    <select id="query" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from jz_goods_category
    </select>
    <select id="selectByPidAndLevel" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from jz_goods_category
        where pid = #{pid} and level = #{level}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
        delete
        from jz_goods_category
        where id = #{id,jdbcType=INTEGER}
    </delete>
    <insert id="insert" parameterType="org.linlinjava.jz.db.domain.JzGoodsCategory">
        insert into jz_goods_category (id, name, keywords,
                                       desc, pid, icon_url,
                                       pic_url, level, sort_order,
                                       add_time, update_time, deleted)
        values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{keywords,jdbcType=VARCHAR},
                #{desc,jdbcType=VARCHAR}, #{pid,jdbcType=INTEGER}, #{iconUrl,jdbcType=VARCHAR},
                #{picUrl,jdbcType=VARCHAR}, #{level,jdbcType=VARCHAR}, #{sortOrder,jdbcType=TINYINT},
                #{addTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=BIT})
    </insert>
    <insert id="insertSelective" parameterType="org.linlinjava.jz.db.domain.JzGoodsCategory">
        insert into jz_goods_category
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="name != null">
                name,
            </if>
            <if test="keywords != null">
                keywords,
            </if>
            <if test="desc != null">
                desc,
            </if>
            <if test="pid != null">
                pid,
            </if>
            <if test="iconUrl != null">
                icon_url,
            </if>
            <if test="picUrl != null">
                pic_url,
            </if>
            <if test="level != null">
                level,
            </if>
            <if test="sortOrder != null">
                sort_order,
            </if>
            <if test="addTime != null">
                add_time,
            </if>
            <if test="updateTime != null">
                update_time,
            </if>
            <if test="deleted != null">
                deleted,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=INTEGER},
            </if>
            <if test="name != null">
                #{name,jdbcType=VARCHAR},
            </if>
            <if test="keywords != null">
                #{keywords,jdbcType=VARCHAR},
            </if>
            <if test="desc != null">
                #{desc,jdbcType=VARCHAR},
            </if>
            <if test="pid != null">
                #{pid,jdbcType=INTEGER},
            </if>
            <if test="iconUrl != null">
                #{iconUrl,jdbcType=VARCHAR},
            </if>
            <if test="picUrl != null">
                #{picUrl,jdbcType=VARCHAR},
            </if>
            <if test="level != null">
                #{level,jdbcType=VARCHAR},
            </if>
            <if test="sortOrder != null">
                #{sortOrder,jdbcType=TINYINT},
            </if>
            <if test="addTime != null">
                #{addTime,jdbcType=TIMESTAMP},
            </if>
            <if test="updateTime != null">
                #{updateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="deleted != null">
                #{deleted,jdbcType=BIT},
            </if>
        </trim>
    </insert>
    <update id="updateByPrimaryKeySelective" parameterType="org.linlinjava.jz.db.domain.JzGoodsCategory">
        update jz_goods_category
        <set>
            <if test="name != null">
                name = #{name,jdbcType=VARCHAR},
            </if>
            <if test="keywords != null">
                keywords = #{keywords,jdbcType=VARCHAR},
            </if>
            <if test="desc != null">
                desc = #{desc,jdbcType=VARCHAR},
            </if>
            <if test="pid != null">
                pid = #{pid,jdbcType=INTEGER},
            </if>
            <if test="iconUrl != null">
                icon_url = #{iconUrl,jdbcType=VARCHAR},
            </if>
            <if test="picUrl != null">
                pic_url = #{picUrl,jdbcType=VARCHAR},
            </if>
            <if test="level != null">
                level = #{level,jdbcType=VARCHAR},
            </if>
            <if test="sortOrder != null">
                sort_order = #{sortOrder,jdbcType=TINYINT},
            </if>
            <if test="addTime != null">
                add_time = #{addTime,jdbcType=TIMESTAMP},
            </if>
            <if test="updateTime != null">
                update_time = #{updateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="deleted != null">
                deleted = #{deleted,jdbcType=BIT},
            </if>
        </set>
        where id = #{id,jdbcType=INTEGER}
    </update>
    <update id="updateByPrimaryKey" parameterType="org.linlinjava.jz.db.domain.JzGoodsCategory">
        update jz_goods_category
        set name        = #{name,jdbcType=VARCHAR},
            keywords    = #{keywords,jdbcType=VARCHAR},
            desc        = #{desc,jdbcType=VARCHAR},
            pid         = #{pid,jdbcType=INTEGER},
            icon_url    = #{iconUrl,jdbcType=VARCHAR},
            pic_url     = #{picUrl,jdbcType=VARCHAR},
            level       = #{level,jdbcType=VARCHAR},
            sort_order  = #{sortOrder,jdbcType=TINYINT},
            add_time    = #{addTime,jdbcType=TIMESTAMP},
            update_time = #{updateTime,jdbcType=TIMESTAMP},
            deleted     = #{deleted,jdbcType=BIT}
        where id = #{id,jdbcType=INTEGER}
    </update>
</mapper>