<?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.slodon.b2b2c.dao.write.integral.IntegralGoodsWriteMapper">
  <resultMap id="resultMap" type="com.slodon.b2b2c.integral.pojo.IntegralGoods">
    <id column="integral_goods_id" property="integralGoodsId" />
    <result column="goods_name" property="goodsName" />
    <result column="goods_brief" property="goodsBrief" />
    <result column="market_price" property="marketPrice" />
    <result column="integral_price" property="integralPrice" />
    <result column="cash_price" property="cashPrice" />
    <result column="goods_stock" property="goodsStock" />
    <result column="virtual_sales" property="virtualSales" />
    <result column="actual_sales" property="actualSales" />
    <result column="main_spec_id" property="mainSpecId" />
    <result column="is_self" property="isSelf" />
    <result column="state" property="state" />
    <result column="is_recommend" property="isRecommend" />
    <result column="online_time" property="onlineTime" />
    <result column="store_id" property="storeId" />
    <result column="store_name" property="storeName" />
    <result column="store_is_recommend" property="storeIsRecommend" />
    <result column="store_state" property="storeState" />
    <result column="main_image" property="mainImage" />
    <result column="goods_video" property="goodsVideo" />
    <result column="default_product_id" property="defaultProductId" />
    <result column="is_vat_invoice" property="isVatInvoice" />
    <result column="province_code" property="provinceCode" />
    <result column="city_code" property="cityCode" />
    <result column="create_vendor_id" property="createVendorId" />
    <result column="create_time" property="createTime" />
    <result column="update_time" property="updateTime" />
    <result column="audit_reason" property="auditReason" />
    <result column="audit_comment" property="auditComment" />
    <result column="offline_reason" property="offlineReason" />
    <result column="offline_comment" property="offlineComment" />
    <result column="is_virtual_goods" property="isVirtualGoods" />
    <result column="after_sale_service" property="afterSaleService" />
    <result column="spec_json" property="specJson" />
    <result column="goods_details" property="goodsDetails" />
  </resultMap>
  <!--除主键外的所有字段，用于插入操作-->
  <sql id="columns">
    <trim suffixOverrides=",">
      <if test="integralGoodsId != null">
        `integral_goods_id`,
      </if>
      <if test="goodsName != null">
        `goods_name`,
      </if>
      <if test="goodsBrief != null">
        `goods_brief`,
      </if>
      <if test="marketPrice != null">
        `market_price`,
      </if>
      <if test="integralPrice != null">
        `integral_price`,
      </if>
      <if test="cashPrice != null">
        `cash_price`,
      </if>
      <if test="goodsStock != null">
        `goods_stock`,
      </if>
      <if test="virtualSales != null">
        `virtual_sales`,
      </if>
      <if test="actualSales != null">
        `actual_sales`,
      </if>
      <if test="mainSpecId != null">
        `main_spec_id`,
      </if>
      <if test="isSelf != null">
        `is_self`,
      </if>
      <if test="state != null">
        `state`,
      </if>
      <if test="isRecommend != null">
        `is_recommend`,
      </if>
      <if test="onlineTime != null">
        `online_time`,
      </if>
      <if test="storeId != null">
        `store_id`,
      </if>
      <if test="storeName != null">
        `store_name`,
      </if>
      <if test="storeIsRecommend != null">
        `store_is_recommend`,
      </if>
      <if test="storeState != null">
        `store_state`,
      </if>
      <if test="mainImage != null">
        `main_image`,
      </if>
      <if test="goodsVideo != null">
        `goods_video`,
      </if>
      <if test="defaultProductId != null">
        `default_product_id`,
      </if>
      <if test="isVatInvoice != null">
        `is_vat_invoice`,
      </if>
      <if test="provinceCode != null">
        `province_code`,
      </if>
      <if test="cityCode != null">
        `city_code`,
      </if>
      <if test="createVendorId != null">
        `create_vendor_id`,
      </if>
      <if test="createTime != null">
        `create_time`,
      </if>
      <if test="updateTime != null">
        `update_time`,
      </if>
      <if test="auditReason != null">
        `audit_reason`,
      </if>
      <if test="auditComment != null">
        `audit_comment`,
      </if>
      <if test="offlineReason != null">
        `offline_reason`,
      </if>
      <if test="offlineComment != null">
        `offline_comment`,
      </if>
      <if test="isVirtualGoods != null">
        `is_virtual_goods`,
      </if>
      <if test="afterSaleService != null">
        `after_sale_service`,
      </if>
      <if test="specJson != null">
        `spec_json`,
      </if>
      <if test="goodsDetails != null">
        `goods_details`,
      </if>
    </trim>
  </sql>
  <!--按照主键值进行操作-->
  <sql id="pkWhere">
    WHERE `integral_goods_id` = #{primaryKey}
  </sql>
  <!--操作条件-->
  <sql id="whereCondition">
    <if test="example != null">
      <trim prefix="WHERE" prefixOverrides="AND|OR">
        <if test="example.integralGoodsIdNotEquals != null">
          AND `integral_goods_id` != #{example.integralGoodsIdNotEquals}
        </if>
        <if test="example.integralGoodsIdIn != null">
          AND `integral_goods_id` in (${example.integralGoodsIdIn})
        </if>
        <if test="example.goodsName != null">
          AND `goods_name` = #{example.goodsName}
        </if>
        <if test="example.goodsNameLike != null">
          AND `goods_name` like concat('%',#{example.goodsNameLike},'%')
        </if>
        <if test="example.goodsBrief != null">
          AND `goods_brief` = #{example.goodsBrief}
        </if>
        <if test="example.marketPrice != null">
          AND `market_price` = #{example.marketPrice}
        </if>
        <if test="example.integralPrice != null">
          AND `integral_price` = #{example.integralPrice}
        </if>
        <if test="example.cashPrice != null">
          AND `cash_price` = #{example.cashPrice}
        </if>
        <if test="example.goodsStock != null">
          AND `goods_stock` = #{example.goodsStock}
        </if>
        <if test="example.virtualSales != null">
          AND `virtual_sales` = #{example.virtualSales}
        </if>
        <if test="example.actualSales != null">
          AND `actual_sales` = #{example.actualSales}
        </if>
        <if test="example.mainSpecId != null">
          AND `main_spec_id` = #{example.mainSpecId}
        </if>
        <if test="example.isSelf != null">
          AND `is_self` = #{example.isSelf}
        </if>
        <if test="example.state != null">
          AND `state` = #{example.state}
        </if>
        <if test="example.stateIn != null">
          AND `state` in (${example.stateIn})
        </if>
        <if test="example.stateNotIn != null">
          AND `state` not in (${example.stateNotIn})
        </if>
        <if test="example.stateNotEquals != null">
          AND `state` != #{example.stateNotEquals}
        </if>
        <if test="example.isRecommend != null">
          AND `is_recommend` = #{example.isRecommend}
        </if>
        <if test="example.onlineTimeAfter != null">
          AND `online_time` <![CDATA[ >= ]]> #{example.onlineTimeAfter}
        </if>
        <if test="example.onlineTimeBefore != null">
          AND `online_time` <![CDATA[ <= ]]> #{example.onlineTimeBefore}
        </if>
        <if test="example.storeId != null">
          AND `store_id` = #{example.storeId}
        </if>
        <if test="example.storeName != null">
          AND `store_name` = #{example.storeName}
        </if>
        <if test="example.storeNameLike != null">
          AND `store_name` like concat('%',#{example.storeNameLike},'%')
        </if>
        <if test="example.storeIsRecommend != null">
          AND `store_is_recommend` = #{example.storeIsRecommend}
        </if>
        <if test="example.storeState != null">
          AND `store_state` = #{example.storeState}
        </if>
        <if test="example.storeStateIn != null">
          AND `store_state` in (${example.storeStateIn})
        </if>
        <if test="example.storeStateNotIn != null">
          AND `store_state` not in (${example.storeStateNotIn})
        </if>
        <if test="example.storeStateNotEquals != null">
          AND `store_state` != #{example.storeStateNotEquals}
        </if>
        <if test="example.mainImage != null">
          AND `main_image` = #{example.mainImage}
        </if>
        <if test="example.goodsVideo != null">
          AND `goods_video` = #{example.goodsVideo}
        </if>
        <if test="example.defaultProductId != null">
          AND `default_product_id` = #{example.defaultProductId}
        </if>
        <if test="example.isVatInvoice != null">
          AND `is_vat_invoice` = #{example.isVatInvoice}
        </if>
        <if test="example.provinceCode != null">
          AND `province_code` = #{example.provinceCode}
        </if>
        <if test="example.cityCode != null">
          AND `city_code` = #{example.cityCode}
        </if>
        <if test="example.createVendorId != null">
          AND `create_vendor_id` = #{example.createVendorId}
        </if>
        <if test="example.createTimeAfter != null">
          AND `create_time` <![CDATA[ >= ]]> #{example.createTimeAfter}
        </if>
        <if test="example.createTimeBefore != null">
          AND `create_time` <![CDATA[ <= ]]> #{example.createTimeBefore}
        </if>
        <if test="example.updateTimeAfter != null">
          AND `update_time` <![CDATA[ >= ]]> #{example.updateTimeAfter}
        </if>
        <if test="example.updateTimeBefore != null">
          AND `update_time` <![CDATA[ <= ]]> #{example.updateTimeBefore}
        </if>
        <if test="example.auditReason != null">
          AND `audit_reason` = #{example.auditReason}
        </if>
        <if test="example.auditReasonLike != null">
          AND `audit_reason` like concat('%',#{example.auditReasonLike},'%')
        </if>
        <if test="example.auditComment != null">
          AND `audit_comment` = #{example.auditComment}
        </if>
        <if test="example.offlineReason != null">
          AND `offline_reason` = #{example.offlineReason}
        </if>
        <if test="example.offlineReasonLike != null">
          AND `offline_reason` like concat('%',#{example.offlineReasonLike},'%')
        </if>
        <if test="example.offlineComment != null">
          AND `offline_comment` = #{example.offlineComment}
        </if>
        <if test="example.isVirtualGoods != null">
          AND `is_virtual_goods` = #{example.isVirtualGoods}
        </if>
        <if test="example.afterSaleService != null">
          AND `after_sale_service` = #{example.afterSaleService}
        </if>
        <if test="example.specJson != null">
          AND `spec_json` = #{example.specJson}
        </if>
        <if test="example.goodsDetails != null">
          AND `goods_details` = #{example.goodsDetails}
        </if>
      </trim>
    </if>
  </sql>
  <!--排序条件-->
  <sql id="orderBy">
    ORDER BY `integral_goods_id` DESC
  </sql>
  <sql id="orderByOther">
    order by ${example.orderBy}
  </sql>
  <!--分组条件-->
  <sql id="groupBy">
    group by ${example.groupBy}
  </sql>
  <!--分页条件-->
  <sql id="limit">
    <if test="size != null and size &gt; 0">
      limit #{startRow},#{size}
    </if>
  </sql>
  <!--查询符合条件的记录数-->
  <select id="countByExample" parameterType="com.slodon.b2b2c.integral.example.IntegralGoodsExample" resultType="java.lang.Integer">
    SELECT
      COUNT(*)
    FROM `integral_goods`
    <include refid="whereCondition" />
  </select>
  <!--根据主键查询记录-->
  <select id="getByPrimaryKey" resultMap="resultMap">
    SELECT
      *
    FROM `integral_goods`
    <include refid="pkWhere" />
  </select>
  <!--查询符合条件的记录(所有字段)-->
  <select id="listByExample" resultMap="resultMap">
    SELECT
      *
    FROM `integral_goods`
    <include refid="whereCondition" />
    <if test="example.groupBy != null">
      <include refid="groupBy" />
    </if>
    <choose>
      <when test="example.orderBy != null">
        <include refid="orderByOther" />
      </when>
      <otherwise>
        <include refid="orderBy" />
      </otherwise>
    </choose>
  </select>
  <!--分页查询符合条件的记录(所有字段)-->
  <select id="listPageByExample" resultMap="resultMap">
    SELECT
      *
    FROM `integral_goods`
    <include refid="whereCondition" />
    <if test="example.groupBy != null">
      <include refid="groupBy" />
    </if>
    <choose>
      <when test="example.orderBy != null">
        <include refid="orderByOther" />
      </when>
      <otherwise>
        <include refid="orderBy" />
      </otherwise>
    </choose>
    <include refid="limit" />
  </select>
  <!--查询符合条件的记录(指定字段)-->
  <select id="listFieldsByExample" resultMap="resultMap">
    SELECT
      ${fields}
    FROM `integral_goods`
    <include refid="whereCondition" />
    <if test="example.groupBy != null">
      <include refid="groupBy" />
    </if>
    <choose>
      <when test="example.orderBy != null">
        <include refid="orderByOther" />
      </when>
      <otherwise>
        <include refid="orderBy" />
      </otherwise>
    </choose>
  </select>
  <!--分页查询符合条件的记录(指定字段)-->
  <select id="listFieldsPageByExample" resultMap="resultMap">
    SELECT
      ${fields}
    FROM `integral_goods`
    <include refid="whereCondition" />
    <if test="example.groupBy != null">
      <include refid="groupBy" />
    </if>
    <choose>
      <when test="example.orderBy != null">
        <include refid="orderByOther" />
      </when>
      <otherwise>
        <include refid="orderBy" />
      </otherwise>
    </choose>
    <include refid="limit" />
  </select>
  <!--根据条件删除记录，可多条删除-->
  <delete id="deleteByExample">
    DELETE FROM `integral_goods`
    <include refid="whereCondition" />
  </delete>
  <!--根据主键删除记录-->
  <delete id="deleteByPrimaryKey">
    DELETE FROM `integral_goods`
    <include refid="pkWhere" />
  </delete>
  <!--插入一条记录-->
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.slodon.b2b2c.integral.pojo.IntegralGoods" useGeneratedKeys="true">
    INSERT INTO `integral_goods`(
    <include refid="columns" />
    )
    VALUES(
    <trim suffixOverrides=",">
      <if test="integralGoodsId != null">
        #{integralGoodsId},
      </if>
      <if test="goodsName != null">
        #{goodsName},
      </if>
      <if test="goodsBrief != null">
        #{goodsBrief},
      </if>
      <if test="marketPrice != null">
        #{marketPrice},
      </if>
      <if test="integralPrice != null">
        #{integralPrice},
      </if>
      <if test="cashPrice != null">
        #{cashPrice},
      </if>
      <if test="goodsStock != null">
        #{goodsStock},
      </if>
      <if test="virtualSales != null">
        #{virtualSales},
      </if>
      <if test="actualSales != null">
        #{actualSales},
      </if>
      <if test="mainSpecId != null">
        #{mainSpecId},
      </if>
      <if test="isSelf != null">
        #{isSelf},
      </if>
      <if test="state != null">
        #{state},
      </if>
      <if test="isRecommend != null">
        #{isRecommend},
      </if>
      <if test="onlineTime != null">
        #{onlineTime},
      </if>
      <if test="storeId != null">
        #{storeId},
      </if>
      <if test="storeName != null">
        #{storeName},
      </if>
      <if test="storeIsRecommend != null">
        #{storeIsRecommend},
      </if>
      <if test="storeState != null">
        #{storeState},
      </if>
      <if test="mainImage != null">
        #{mainImage},
      </if>
      <if test="goodsVideo != null">
        #{goodsVideo},
      </if>
      <if test="defaultProductId != null">
        #{defaultProductId},
      </if>
      <if test="isVatInvoice != null">
        #{isVatInvoice},
      </if>
      <if test="provinceCode != null">
        #{provinceCode},
      </if>
      <if test="cityCode != null">
        #{cityCode},
      </if>
      <if test="createVendorId != null">
        #{createVendorId},
      </if>
      <if test="createTime != null">
        #{createTime},
      </if>
      <if test="updateTime != null">
        #{updateTime},
      </if>
      <if test="auditReason != null">
        #{auditReason},
      </if>
      <if test="auditComment != null">
        #{auditComment},
      </if>
      <if test="offlineReason != null">
        #{offlineReason},
      </if>
      <if test="offlineComment != null">
        #{offlineComment},
      </if>
      <if test="isVirtualGoods != null">
        #{isVirtualGoods},
      </if>
      <if test="afterSaleService != null">
        #{afterSaleService},
      </if>
      <if test="specJson != null">
        #{specJson},
      </if>
      <if test="goodsDetails != null">
        #{goodsDetails},
      </if>
    </trim>
    )
  </insert>
  <!--按条件更新记录中不为空的字段-->
  <update id="updateByExampleSelective">
    UPDATE `integral_goods`
    <trim prefix="SET" suffixOverrides=",">
      <if test="record.goodsName != null">
        `goods_name` = #{record.goodsName},
      </if>
      <if test="record.goodsBrief != null">
        `goods_brief` = #{record.goodsBrief},
      </if>
      <if test="record.marketPrice != null">
        `market_price` = #{record.marketPrice},
      </if>
      <if test="record.integralPrice != null">
        `integral_price` = #{record.integralPrice},
      </if>
      <if test="record.cashPrice != null">
        `cash_price` = #{record.cashPrice},
      </if>
      <if test="record.goodsStock != null">
        `goods_stock` = #{record.goodsStock},
      </if>
      <if test="record.virtualSales != null">
        `virtual_sales` = #{record.virtualSales},
      </if>
      <if test="record.actualSales != null">
        `actual_sales` = #{record.actualSales},
      </if>
      <if test="record.mainSpecId != null">
        `main_spec_id` = #{record.mainSpecId},
      </if>
      <if test="record.isSelf != null">
        `is_self` = #{record.isSelf},
      </if>
      <if test="record.state != null">
        `state` = #{record.state},
      </if>
      <if test="record.isRecommend != null">
        `is_recommend` = #{record.isRecommend},
      </if>
      <if test="record.onlineTime != null">
        `online_time` = #{record.onlineTime},
      </if>
      <if test="record.storeId != null">
        `store_id` = #{record.storeId},
      </if>
      <if test="record.storeName != null">
        `store_name` = #{record.storeName},
      </if>
      <if test="record.storeIsRecommend != null">
        `store_is_recommend` = #{record.storeIsRecommend},
      </if>
      <if test="record.storeState != null">
        `store_state` = #{record.storeState},
      </if>
      <if test="record.mainImage != null">
        `main_image` = #{record.mainImage},
      </if>
      <if test="record.goodsVideo != null">
        `goods_video` = #{record.goodsVideo},
      </if>
      <if test="record.defaultProductId != null">
        `default_product_id` = #{record.defaultProductId},
      </if>
      <if test="record.isVatInvoice != null">
        `is_vat_invoice` = #{record.isVatInvoice},
      </if>
      <if test="record.provinceCode != null">
        `province_code` = #{record.provinceCode},
      </if>
      <if test="record.cityCode != null">
        `city_code` = #{record.cityCode},
      </if>
      <if test="record.createVendorId != null">
        `create_vendor_id` = #{record.createVendorId},
      </if>
      <if test="record.createTime != null">
        `create_time` = #{record.createTime},
      </if>
      <if test="record.updateTime != null">
        `update_time` = #{record.updateTime},
      </if>
      <if test="record.auditReason != null">
        `audit_reason` = #{record.auditReason},
      </if>
      <if test="record.auditComment != null">
        `audit_comment` = #{record.auditComment},
      </if>
      <if test="record.offlineReason != null">
        `offline_reason` = #{record.offlineReason},
      </if>
      <if test="record.offlineComment != null">
        `offline_comment` = #{record.offlineComment},
      </if>
      <if test="record.isVirtualGoods != null">
        `is_virtual_goods` = #{record.isVirtualGoods},
      </if>
      <if test="record.afterSaleService != null">
        `after_sale_service` = #{record.afterSaleService},
      </if>
      <if test="record.specJson != null">
        `spec_json` = #{record.specJson},
      </if>
      <if test="record.goodsDetails != null">
        `goods_details` = #{record.goodsDetails},
      </if>
    </trim>
    <include refid="whereCondition" />
  </update>
  <!--按照主键更新记录中不为空的字段-->
  <update id="updateByPrimaryKeySelective">
    UPDATE `integral_goods`
    <trim prefix="SET" suffixOverrides=",">
      <if test="goodsName != null">
        `goods_name` = #{goodsName},
      </if>
      <if test="goodsBrief != null">
        `goods_brief` = #{goodsBrief},
      </if>
      <if test="marketPrice != null">
        `market_price` = #{marketPrice},
      </if>
      <if test="integralPrice != null">
        `integral_price` = #{integralPrice},
      </if>
      <if test="cashPrice != null">
        `cash_price` = #{cashPrice},
      </if>
      <if test="goodsStock != null">
        `goods_stock` = #{goodsStock},
      </if>
      <if test="virtualSales != null">
        `virtual_sales` = #{virtualSales},
      </if>
      <if test="actualSales != null">
        `actual_sales` = #{actualSales},
      </if>
      <if test="mainSpecId != null">
        `main_spec_id` = #{mainSpecId},
      </if>
      <if test="isSelf != null">
        `is_self` = #{isSelf},
      </if>
      <if test="state != null">
        `state` = #{state},
      </if>
      <if test="isRecommend != null">
        `is_recommend` = #{isRecommend},
      </if>
      <if test="onlineTime != null">
        `online_time` = #{onlineTime},
      </if>
      <if test="storeId != null">
        `store_id` = #{storeId},
      </if>
      <if test="storeName != null">
        `store_name` = #{storeName},
      </if>
      <if test="storeIsRecommend != null">
        `store_is_recommend` = #{storeIsRecommend},
      </if>
      <if test="storeState != null">
        `store_state` = #{storeState},
      </if>
      <if test="mainImage != null">
        `main_image` = #{mainImage},
      </if>
      <if test="goodsVideo != null">
        `goods_video` = #{goodsVideo},
      </if>
      <if test="defaultProductId != null">
        `default_product_id` = #{defaultProductId},
      </if>
      <if test="isVatInvoice != null">
        `is_vat_invoice` = #{isVatInvoice},
      </if>
      <if test="provinceCode != null">
        `province_code` = #{provinceCode},
      </if>
      <if test="cityCode != null">
        `city_code` = #{cityCode},
      </if>
      <if test="createVendorId != null">
        `create_vendor_id` = #{createVendorId},
      </if>
      <if test="createTime != null">
        `create_time` = #{createTime},
      </if>
      <if test="updateTime != null">
        `update_time` = #{updateTime},
      </if>
      <if test="auditReason != null">
        `audit_reason` = #{auditReason},
      </if>
      <if test="auditComment != null">
        `audit_comment` = #{auditComment},
      </if>
      <if test="offlineReason != null">
        `offline_reason` = #{offlineReason},
      </if>
      <if test="offlineComment != null">
        `offline_comment` = #{offlineComment},
      </if>
      <if test="isVirtualGoods != null">
        `is_virtual_goods` = #{isVirtualGoods},
      </if>
      <if test="afterSaleService != null">
        `after_sale_service` = #{afterSaleService},
      </if>
      <if test="specJson != null">
        `spec_json` = #{specJson},
      </if>
      <if test="goodsDetails != null">
        `goods_details` = #{goodsDetails},
      </if>
    </trim>
    WHERE `integral_goods_id` = #{integralGoodsId}
  </update>
</mapper>