<?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.reptileclient.jlifeapp.dao.jz.OrderGoodsMapper">
    <resultMap id="BaseResultMap" type="com.reptileclient.jlifeapp.entity.jz.OrderGoods">
        <id column="id" property="id" jdbcType="INTEGER"/>
        <result column="order_id" property="orderId" jdbcType="INTEGER"/>
        <result column="goods_id" property="goodsId" jdbcType="INTEGER"/>
        <result column="goods_name" property="goodsName" jdbcType="VARCHAR"/>
        <result column="goods_sn" property="goodsSn" jdbcType="VARCHAR"/>
        <result column="product_id" property="productId" jdbcType="INTEGER"/>
        <result column="number" property="number" jdbcType="SMALLINT"/>
        <result column="price" property="price" jdbcType="DECIMAL"/>
        <result column="specifications" property="specifications" jdbcType="VARCHAR"/>
        <result column="pic_url" property="picUrl" jdbcType="VARCHAR"/>
        <result column="comment" property="comment" jdbcType="INTEGER"/>
        <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
        , order_id, goods_id, goods_name, goods_sn, product_id, number, price, specifications,
    pic_url, comment, add_time, update_time, deleted
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
        select
        <include refid="Base_Column_List"/>
        from jz_order_goods
        where id = #{id,jdbcType=INTEGER}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
        delete
        from jz_order_goods
        where id = #{id,jdbcType=INTEGER}
    </delete>
    <delete id="deleteByOrderId">
        delete
        from jz_order_goods
        where order_id = #{orderId}
    </delete>
    <insert id="insert" parameterType="com.reptileclient.jlifeapp.entity.jz.OrderGoods">
        insert into jz_order_goods (id, order_id, goods_id,
                                    goods_name, goods_sn, product_id,
                                    number, price, specifications,
                                    pic_url, comment, add_time,
                                    update_time, deleted)
        values (#{id,jdbcType=INTEGER}, #{orderId,jdbcType=INTEGER}, #{goodsId,jdbcType=INTEGER},
                #{goodsName,jdbcType=VARCHAR}, #{goodsSn,jdbcType=VARCHAR}, #{productId,jdbcType=INTEGER},
                #{number,jdbcType=SMALLINT}, #{price,jdbcType=DECIMAL}, #{specifications,jdbcType=VARCHAR},
                #{picUrl,jdbcType=VARCHAR}, #{comment,jdbcType=INTEGER}, #{addTime,jdbcType=TIMESTAMP},
                #{updateTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=BIT})
    </insert>
    <insert id="insertSelective" parameterType="com.reptileclient.jlifeapp.entity.jz.OrderGoods">
        insert into jz_order_goods
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="orderId != null">
                order_id,
            </if>
            <if test="goodsId != null">
                goods_id,
            </if>
            <if test="goodsName != null">
                goods_name,
            </if>
            <if test="goodsSn != null">
                goods_sn,
            </if>
            <if test="productId != null">
                product_id,
            </if>
            <if test="number != null">
                number,
            </if>
            <if test="price != null">
                price,
            </if>
            <if test="specifications != null">
                specifications,
            </if>
            <if test="picUrl != null">
                pic_url,
            </if>
            <if test="comment != null">
                comment,
            </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="orderId != null">
                #{orderId,jdbcType=INTEGER},
            </if>
            <if test="goodsId != null">
                #{goodsId,jdbcType=INTEGER},
            </if>
            <if test="goodsName != null">
                #{goodsName,jdbcType=VARCHAR},
            </if>
            <if test="goodsSn != null">
                #{goodsSn,jdbcType=VARCHAR},
            </if>
            <if test="productId != null">
                #{productId,jdbcType=INTEGER},
            </if>
            <if test="number != null">
                #{number,jdbcType=SMALLINT},
            </if>
            <if test="price != null">
                #{price,jdbcType=DECIMAL},
            </if>
            <if test="specifications != null">
                #{specifications,jdbcType=VARCHAR},
            </if>
            <if test="picUrl != null">
                #{picUrl,jdbcType=VARCHAR},
            </if>
            <if test="comment != null">
                #{comment,jdbcType=INTEGER},
            </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="com.reptileclient.jlifeapp.entity.jz.OrderGoods">
        update jz_order_goods
        <set>
            <if test="orderId != null">
                order_id = #{orderId,jdbcType=INTEGER},
            </if>
            <if test="goodsId != null">
                goods_id = #{goodsId,jdbcType=INTEGER},
            </if>
            <if test="goodsName != null">
                goods_name = #{goodsName,jdbcType=VARCHAR},
            </if>
            <if test="goodsSn != null">
                goods_sn = #{goodsSn,jdbcType=VARCHAR},
            </if>
            <if test="productId != null">
                product_id = #{productId,jdbcType=INTEGER},
            </if>
            <if test="number != null">
                number = #{number,jdbcType=SMALLINT},
            </if>
            <if test="price != null">
                price = #{price,jdbcType=DECIMAL},
            </if>
            <if test="specifications != null">
                specifications = #{specifications,jdbcType=VARCHAR},
            </if>
            <if test="picUrl != null">
                pic_url = #{picUrl,jdbcType=VARCHAR},
            </if>
            <if test="comment != null">
                comment = #{comment,jdbcType=INTEGER},
            </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="com.reptileclient.jlifeapp.entity.jz.OrderGoods">
        update jz_order_goods
        set order_id       = #{orderId,jdbcType=INTEGER},
            goods_id       = #{goodsId,jdbcType=INTEGER},
            goods_name     = #{goodsName,jdbcType=VARCHAR},
            goods_sn       = #{goodsSn,jdbcType=VARCHAR},
            product_id     = #{productId,jdbcType=INTEGER},
            number         = #{number,jdbcType=SMALLINT},
            price          = #{price,jdbcType=DECIMAL},
            specifications = #{specifications,jdbcType=VARCHAR},
            pic_url        = #{picUrl,jdbcType=VARCHAR},
            comment        = #{comment,jdbcType=INTEGER},
            add_time       = #{addTime,jdbcType=TIMESTAMP},
            update_time    = #{updateTime,jdbcType=TIMESTAMP},
            deleted        = #{deleted,jdbcType=BIT}
        where id = #{id,jdbcType=INTEGER}
    </update>
</mapper>