<?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.ruoyi.jarvis.mapper.XbMessageItemMapper">

    <resultMap type="XbMessageItem" id="XbMessageItemResult">
        <result property="id" column="id"/>
        <result property="createDate" column="create_date"/>
        <result property="skuid" column="skuid"/>
        <result property="xbMessageId" column="xb_message_id"/>
        <result property="jsonQueryResult" column="json_query_result"/>
        <result property="jsonCouponList" column="json_coupon_list"/>
        <result property="spuid" column="spuid"/>
        <result property="skuName" column="sku_name"/>
        <result property="jsonShopInfo" column="json_shop_info"/>
        <result property="priceInfo" column="price_info"/>
        <result property="jsonCommissionInfo" column="json_commission_info"/>
        <result property="jsonImageList" column="json_image_list"/>
        <result property="owner" column="owner"/>
        <result property="jsonCategoryInfo" column="json_category_info"/>
    </resultMap>

    <sql id="selectXbMessageItemVo">
        select id, create_date, skuid, xb_message_id, json_query_result, json_coupon_list, spuid, sku_name, json_shop_info, price_info, json_commission_info, json_image_list, owner, json_category_info from xb_message_item
    </sql>

    <select id="selectXbMessageItemList" parameterType="XbMessageItem" resultMap="XbMessageItemResult">
        <include refid="selectXbMessageItemVo"/>
        <where>
            <if test="createDate != null">and create_date = #{createDate}</if>
            <if test="skuid != null and skuid != ''">and skuid = #{skuid}</if>
            <if test="xbMessageId != null and xbMessageId != ''">and xb_message_id = #{xbMessageId}</if>
            <if test="jsonQueryResult != null and jsonQueryResult != ''">and json_query_result = #{jsonQueryResult}</if>
            <if test="jsonCouponList != null and jsonCouponList != ''">and json_coupon_list = #{jsonCouponList}</if>
            <if test="spuid != null and spuid != ''">and spuid = #{spuid}</if>
            <if test="skuName != null and skuName != ''">and sku_name = #{skuName}</if>
            <if test="jsonShopInfo != null and jsonShopInfo != ''">and json_shop_info = #{jsonShopInfo}</if>
            <if test="priceInfo != null and priceInfo != ''">and price_info = #{priceInfo}</if>
            <if test="jsonCommissionInfo != null and jsonCommissionInfo != ''">and json_commission_info = #{jsonCommissionInfo}</if>
            <if test="jsonImageList != null and jsonImageList != ''">and json_image_list = #{jsonImageList}</if>
            <if test="owner != null and owner != ''">and owner = #{owner}</if>
            <if test="jsonCategoryInfo != null and jsonCategoryInfo != ''">and json_category_info = #{jsonCategoryInfo}</if>
        </where>
    </select>

    <select id="selectXbMessageItemById" parameterType="Integer" resultMap="XbMessageItemResult">
        <include refid="selectXbMessageItemVo"/>
        where id = #{id}
    </select>

    <insert id="insertXbMessageItem" parameterType="XbMessageItem" useGeneratedKeys="true" keyProperty="id">
        insert into xb_message_item
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="createDate != null">create_date,</if>
            <if test="skuid != null and skuid != ''">skuid,</if>
            <if test="xbMessageId != null and xbMessageId != ''">xb_message_id,</if>
            <if test="jsonQueryResult != null and jsonQueryResult != ''">json_query_result,</if>
            <if test="jsonCouponList != null and jsonCouponList != ''">json_coupon_list,</if>
            <if test="spuid != null and spuid != ''">spuid,</if>
            <if test="skuName != null and skuName != ''">sku_name,</if>
            <if test="jsonShopInfo != null and jsonShopInfo != ''">json_shop_info,</if>
            <if test="priceInfo != null and priceInfo != ''">price_info,</if>
            <if test="jsonCommissionInfo != null and jsonCommissionInfo != ''">json_commission_info,</if>
            <if test="jsonImageList != null and jsonImageList != ''">json_image_list,</if>
            <if test="owner != null and owner != ''">owner,</if>
            <if test="jsonCategoryInfo != null and jsonCategoryInfo != ''">json_category_info,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="createDate != null">#{createDate},</if>
            <if test="skuid != null and skuid != ''">#{skuid},</if>
            <if test="xbMessageId != null and xbMessageId != ''">#{xbMessageId},</if>
            <if test="jsonQueryResult != null and jsonQueryResult != ''">#{jsonQueryResult},</if>
            <if test="jsonCouponList != null and jsonCouponList != ''">#{jsonCouponList},</if>
            <if test="spuid != null and spuid != ''">#{spuid},</if>
            <if test="skuName != null and skuName != ''">#{skuName},</if>
            <if test="jsonShopInfo != null and jsonShopInfo != ''">#{jsonShopInfo},</if>
            <if test="priceInfo != null and priceInfo != ''">#{priceInfo},</if>
            <if test="jsonCommissionInfo != null and jsonCommissionInfo != ''">#{jsonCommissionInfo},</if>
            <if test="jsonImageList != null and jsonImageList != ''">#{jsonImageList},</if>
            <if test="owner != null and owner != ''">#{owner},</if>
            <if test="jsonCategoryInfo != null and jsonCategoryInfo != ''">#{jsonCategoryInfo},</if>
        </trim>
    </insert>

    <update id="updateXbMessageItem" parameterType="XbMessageItem">
        update xb_message_item
        <set>
            <if test="createDate != null">create_date = #{createDate},</if>
            <if test="skuid != null and skuid != ''">skuid = #{skuid},</if>
            <if test="xbMessageId != null and xbMessageId != ''">xb_message_id = #{xbMessageId},</if>
            <if test="jsonQueryResult != null and jsonQueryResult != ''">json_query_result = #{jsonQueryResult},</if>
            <if test="jsonCouponList != null and jsonCouponList != ''">json_coupon_list = #{jsonCouponList},</if>
            <if test="spuid != null and spuid != ''">spuid = #{spuid},</if>
            <if test="skuName != null and skuName != ''">sku_name = #{skuName},</if>
            <if test="jsonShopInfo != null and jsonShopInfo != ''">json_shop_info = #{jsonShopInfo},</if>
            <if test="priceInfo != null and priceInfo != ''">price_info = #{priceInfo},</if>
            <if test="jsonCommissionInfo != null and jsonCommissionInfo != ''">json_commission_info = #{jsonCommissionInfo},</if>
            <if test="jsonImageList != null and jsonImageList != ''">json_image_list = #{jsonImageList},</if>
            <if test="owner != null and owner != ''">owner = #{owner},</if>
            <if test="jsonCategoryInfo != null and jsonCategoryInfo != ''">json_category_info = #{jsonCategoryInfo},</if>
        </set>
        where id = #{id}
    </update>

    <delete id="deleteXbMessageItemById" parameterType="Integer">
        delete from xb_message_item where id = #{id}
    </delete>

    <delete id="deleteXbMessageItemByIds" parameterType="String">
        delete from xb_message_item where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>

</mapper>
