<?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.statistics.StoreYearWriteMapper">
  <resultMap id="resultMap" type="com.slodon.b2b2c.statistics.pojo.StoreYear">
    <id column="stats_id" property="statsId" />
    <result column="stats_time" property="statsTime" />
    <result column="store_id" property="storeId" />
    <result column="store_name" property="storeName" />
    <result column="visitor_num" property="visitorNum" />
    <result column="view_num" property="viewNum" />
    <result column="order_submit_num" property="orderSubmitNum" />
    <result column="order_submit_amount" property="orderSubmitAmount" />
    <result column="order_submit_member_num" property="orderSubmitMemberNum" />
    <result column="order_submit_atv" property="orderSubmitAtv" />
    <result column="order_pay_num" property="orderPayNum" />
    <result column="order_pay_amount" property="orderPayAmount" />
    <result column="order_pay_member_num" property="orderPayMemberNum" />
    <result column="order_pay_atv" property="orderPayAtv" />
    <result column="pv_submit_rate" property="pvSubmitRate" />
    <result column="pv_pay_rate" property="pvPayRate" />
    <result column="submit_pay_rate" property="submitPayRate" />
    <result column="goods_visitor_num" property="goodsVisitorNum" />
    <result column="goods_view_num" property="goodsViewNum" />
    <result column="view_goods_num" property="viewGoodsNum" />
    <result column="new_goods_num" property="newGoodsNum" />
    <result column="collection_goods_num" property="collectionGoodsNum" />
    <result column="collection_store_num" property="collectionStoreNum" />
    <result column="saling_goods_num" property="salingGoodsNum" />
    <result column="return_num" property="returnNum" />
    <result column="return_amount" property="returnAmount" />
    <result column="new_member_num" property="newMemberNum" />
    <result column="per_view_num" property="perViewNum" />
  </resultMap>
  <!--除主键外的所有字段，用于插入操作-->
  <sql id="columns">
    <trim suffixOverrides=",">
      <if test="statsTime != null">
        `stats_time`,
      </if>
      <if test="storeId != null">
        `store_id`,
      </if>
      <if test="storeName != null">
        `store_name`,
      </if>
      <if test="visitorNum != null">
        `visitor_num`,
      </if>
      <if test="viewNum != null">
        `view_num`,
      </if>
      <if test="orderSubmitNum != null">
        `order_submit_num`,
      </if>
      <if test="orderSubmitAmount != null">
        `order_submit_amount`,
      </if>
      <if test="orderSubmitMemberNum != null">
        `order_submit_member_num`,
      </if>
      <if test="orderSubmitAtv != null">
        `order_submit_atv`,
      </if>
      <if test="orderPayNum != null">
        `order_pay_num`,
      </if>
      <if test="orderPayAmount != null">
        `order_pay_amount`,
      </if>
      <if test="orderPayMemberNum != null">
        `order_pay_member_num`,
      </if>
      <if test="orderPayAtv != null">
        `order_pay_atv`,
      </if>
      <if test="pvSubmitRate != null">
        `pv_submit_rate`,
      </if>
      <if test="pvPayRate != null">
        `pv_pay_rate`,
      </if>
      <if test="submitPayRate != null">
        `submit_pay_rate`,
      </if>
      <if test="goodsVisitorNum != null">
        `goods_visitor_num`,
      </if>
      <if test="goodsViewNum != null">
        `goods_view_num`,
      </if>
      <if test="viewGoodsNum != null">
        `view_goods_num`,
      </if>
      <if test="newGoodsNum != null">
        `new_goods_num`,
      </if>
      <if test="collectionGoodsNum != null">
        `collection_goods_num`,
      </if>
      <if test="collectionStoreNum != null">
        `collection_store_num`,
      </if>
      <if test="salingGoodsNum != null">
        `saling_goods_num`,
      </if>
      <if test="returnNum != null">
        `return_num`,
      </if>
      <if test="returnAmount != null">
        `return_amount`,
      </if>
      <if test="newMemberNum != null">
        `new_member_num`,
      </if>
      <if test="perViewNum != null">
        `per_view_num`,
      </if>
    </trim>
  </sql>
  <!--按照主键值进行操作-->
  <sql id="pkWhere">
    WHERE `stats_id` = #{primaryKey}
  </sql>
  <!--操作条件-->
  <sql id="whereCondition">
    <if test="example != null">
      <trim prefix="WHERE" prefixOverrides="AND|OR">
        <if test="example.statsIdNotEquals != null">
          AND `stats_id` != #{example.statsIdNotEquals}
        </if>
        <if test="example.statsIdIn != null">
          AND `stats_id` in (${example.statsIdIn})
        </if>
        <if test="example.statsTimeAfter != null">
          AND `stats_time` <![CDATA[ >= ]]> #{example.statsTimeAfter}
        </if>
        <if test="example.statsTimeBefore != null">
          AND `stats_time` <![CDATA[ <= ]]> #{example.statsTimeBefore}
        </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.visitorNum != null">
          AND `visitor_num` = #{example.visitorNum}
        </if>
        <if test="example.viewNum != null">
          AND `view_num` = #{example.viewNum}
        </if>
        <if test="example.orderSubmitNum != null">
          AND `order_submit_num` = #{example.orderSubmitNum}
        </if>
        <if test="example.orderSubmitAmount != null">
          AND `order_submit_amount` = #{example.orderSubmitAmount}
        </if>
        <if test="example.orderSubmitMemberNum != null">
          AND `order_submit_member_num` = #{example.orderSubmitMemberNum}
        </if>
        <if test="example.orderSubmitAtv != null">
          AND `order_submit_atv` = #{example.orderSubmitAtv}
        </if>
        <if test="example.orderPayNum != null">
          AND `order_pay_num` = #{example.orderPayNum}
        </if>
        <if test="example.orderPayAmount != null">
          AND `order_pay_amount` = #{example.orderPayAmount}
        </if>
        <if test="example.orderPayMemberNum != null">
          AND `order_pay_member_num` = #{example.orderPayMemberNum}
        </if>
        <if test="example.orderPayAtv != null">
          AND `order_pay_atv` = #{example.orderPayAtv}
        </if>
        <if test="example.pvSubmitRate != null">
          AND `pv_submit_rate` = #{example.pvSubmitRate}
        </if>
        <if test="example.pvPayRate != null">
          AND `pv_pay_rate` = #{example.pvPayRate}
        </if>
        <if test="example.submitPayRate != null">
          AND `submit_pay_rate` = #{example.submitPayRate}
        </if>
        <if test="example.goodsVisitorNum != null">
          AND `goods_visitor_num` = #{example.goodsVisitorNum}
        </if>
        <if test="example.goodsViewNum != null">
          AND `goods_view_num` = #{example.goodsViewNum}
        </if>
        <if test="example.viewGoodsNum != null">
          AND `view_goods_num` = #{example.viewGoodsNum}
        </if>
        <if test="example.viewGoodsNumLike != null">
          AND `view_goods_num` like concat('%',#{example.viewGoodsNumLike},'%')
        </if>
        <if test="example.newGoodsNum != null">
          AND `new_goods_num` = #{example.newGoodsNum}
        </if>
        <if test="example.newGoodsNumLike != null">
          AND `new_goods_num` like concat('%',#{example.newGoodsNumLike},'%')
        </if>
        <if test="example.collectionGoodsNum != null">
          AND `collection_goods_num` = #{example.collectionGoodsNum}
        </if>
        <if test="example.collectionGoodsNumLike != null">
          AND `collection_goods_num` like concat('%',#{example.collectionGoodsNumLike},'%')
        </if>
        <if test="example.collectionStoreNum != null">
          AND `collection_store_num` = #{example.collectionStoreNum}
        </if>
        <if test="example.salingGoodsNum != null">
          AND `saling_goods_num` = #{example.salingGoodsNum}
        </if>
        <if test="example.salingGoodsNumLike != null">
          AND `saling_goods_num` like concat('%',#{example.salingGoodsNumLike},'%')
        </if>
        <if test="example.returnNum != null">
          AND `return_num` = #{example.returnNum}
        </if>
        <if test="example.returnAmount != null">
          AND `return_amount` = #{example.returnAmount}
        </if>
        <if test="example.newMemberNum != null">
          AND `new_member_num` = #{example.newMemberNum}
        </if>
        <if test="example.perViewNum != null">
          AND `per_view_num` = #{example.perViewNum}
        </if>
      </trim>
    </if>
  </sql>
  <!--排序条件-->
  <sql id="orderBy">
    ORDER BY `stats_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.statistics.example.StoreYearExample" resultType="java.lang.Integer">
    SELECT
      COUNT(*)
    FROM `stats_store_year`
    <include refid="whereCondition" />
  </select>
  <!--根据主键查询记录-->
  <select id="getByPrimaryKey" resultMap="resultMap">
    SELECT
      *
    FROM `stats_store_year`
    <include refid="pkWhere" />
  </select>
  <!--查询符合条件的记录(所有字段)-->
  <select id="listByExample" resultMap="resultMap">
    SELECT
      *
    FROM `stats_store_year`
    <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 `stats_store_year`
    <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 `stats_store_year`
    <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 `stats_store_year`
    <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 `stats_store_year`
    <include refid="whereCondition" />
  </delete>
  <!--根据主键删除记录-->
  <delete id="deleteByPrimaryKey">
    DELETE FROM `stats_store_year`
    <include refid="pkWhere" />
  </delete>
  <!--插入一条记录-->
  <insert id="insert" keyColumn="stats_id" keyProperty="statsId" parameterType="com.slodon.b2b2c.statistics.pojo.StoreYear" useGeneratedKeys="true">
    INSERT INTO `stats_store_year`(
    <include refid="columns" />
    )
    VALUES(
    <trim suffixOverrides=",">
      <if test="statsTime != null">
        #{statsTime},
      </if>
      <if test="storeId != null">
        #{storeId},
      </if>
      <if test="storeName != null">
        #{storeName},
      </if>
      <if test="visitorNum != null">
        #{visitorNum},
      </if>
      <if test="viewNum != null">
        #{viewNum},
      </if>
      <if test="orderSubmitNum != null">
        #{orderSubmitNum},
      </if>
      <if test="orderSubmitAmount != null">
        #{orderSubmitAmount},
      </if>
      <if test="orderSubmitMemberNum != null">
        #{orderSubmitMemberNum},
      </if>
      <if test="orderSubmitAtv != null">
        #{orderSubmitAtv},
      </if>
      <if test="orderPayNum != null">
        #{orderPayNum},
      </if>
      <if test="orderPayAmount != null">
        #{orderPayAmount},
      </if>
      <if test="orderPayMemberNum != null">
        #{orderPayMemberNum},
      </if>
      <if test="orderPayAtv != null">
        #{orderPayAtv},
      </if>
      <if test="pvSubmitRate != null">
        #{pvSubmitRate},
      </if>
      <if test="pvPayRate != null">
        #{pvPayRate},
      </if>
      <if test="submitPayRate != null">
        #{submitPayRate},
      </if>
      <if test="goodsVisitorNum != null">
        #{goodsVisitorNum},
      </if>
      <if test="goodsViewNum != null">
        #{goodsViewNum},
      </if>
      <if test="viewGoodsNum != null">
        #{viewGoodsNum},
      </if>
      <if test="newGoodsNum != null">
        #{newGoodsNum},
      </if>
      <if test="collectionGoodsNum != null">
        #{collectionGoodsNum},
      </if>
      <if test="collectionStoreNum != null">
        #{collectionStoreNum},
      </if>
      <if test="salingGoodsNum != null">
        #{salingGoodsNum},
      </if>
      <if test="returnNum != null">
        #{returnNum},
      </if>
      <if test="returnAmount != null">
        #{returnAmount},
      </if>
      <if test="newMemberNum != null">
        #{newMemberNum},
      </if>
      <if test="perViewNum != null">
        #{perViewNum},
      </if>
    </trim>
    )
  </insert>
  <!--按条件更新记录中不为空的字段-->
  <update id="updateByExampleSelective">
    UPDATE `stats_store_year`
    <trim prefix="SET" suffixOverrides=",">
      <if test="record.statsTime != null">
        `stats_time` = #{record.statsTime},
      </if>
      <if test="record.storeId != null">
        `store_id` = #{record.storeId},
      </if>
      <if test="record.storeName != null">
        `store_name` = #{record.storeName},
      </if>
      <if test="record.visitorNum != null">
        `visitor_num` = #{record.visitorNum},
      </if>
      <if test="record.viewNum != null">
        `view_num` = #{record.viewNum},
      </if>
      <if test="record.orderSubmitNum != null">
        `order_submit_num` = #{record.orderSubmitNum},
      </if>
      <if test="record.orderSubmitAmount != null">
        `order_submit_amount` = #{record.orderSubmitAmount},
      </if>
      <if test="record.orderSubmitMemberNum != null">
        `order_submit_member_num` = #{record.orderSubmitMemberNum},
      </if>
      <if test="record.orderSubmitAtv != null">
        `order_submit_atv` = #{record.orderSubmitAtv},
      </if>
      <if test="record.orderPayNum != null">
        `order_pay_num` = #{record.orderPayNum},
      </if>
      <if test="record.orderPayAmount != null">
        `order_pay_amount` = #{record.orderPayAmount},
      </if>
      <if test="record.orderPayMemberNum != null">
        `order_pay_member_num` = #{record.orderPayMemberNum},
      </if>
      <if test="record.orderPayAtv != null">
        `order_pay_atv` = #{record.orderPayAtv},
      </if>
      <if test="record.pvSubmitRate != null">
        `pv_submit_rate` = #{record.pvSubmitRate},
      </if>
      <if test="record.pvPayRate != null">
        `pv_pay_rate` = #{record.pvPayRate},
      </if>
      <if test="record.submitPayRate != null">
        `submit_pay_rate` = #{record.submitPayRate},
      </if>
      <if test="record.goodsVisitorNum != null">
        `goods_visitor_num` = #{record.goodsVisitorNum},
      </if>
      <if test="record.goodsViewNum != null">
        `goods_view_num` = #{record.goodsViewNum},
      </if>
      <if test="record.viewGoodsNum != null">
        `view_goods_num` = #{record.viewGoodsNum},
      </if>
      <if test="record.newGoodsNum != null">
        `new_goods_num` = #{record.newGoodsNum},
      </if>
      <if test="record.collectionGoodsNum != null">
        `collection_goods_num` = #{record.collectionGoodsNum},
      </if>
      <if test="record.collectionStoreNum != null">
        `collection_store_num` = #{record.collectionStoreNum},
      </if>
      <if test="record.salingGoodsNum != null">
        `saling_goods_num` = #{record.salingGoodsNum},
      </if>
      <if test="record.returnNum != null">
        `return_num` = #{record.returnNum},
      </if>
      <if test="record.returnAmount != null">
        `return_amount` = #{record.returnAmount},
      </if>
      <if test="record.newMemberNum != null">
        `new_member_num` = #{record.newMemberNum},
      </if>
      <if test="record.perViewNum != null">
        `per_view_num` = #{record.perViewNum},
      </if>
    </trim>
    <include refid="whereCondition" />
  </update>
  <!--按照主键更新记录中不为空的字段-->
  <update id="updateByPrimaryKeySelective">
    UPDATE `stats_store_year`
    <trim prefix="SET" suffixOverrides=",">
      <if test="statsTime != null">
        `stats_time` = #{statsTime},
      </if>
      <if test="storeId != null">
        `store_id` = #{storeId},
      </if>
      <if test="storeName != null">
        `store_name` = #{storeName},
      </if>
      <if test="visitorNum != null">
        `visitor_num` = #{visitorNum},
      </if>
      <if test="viewNum != null">
        `view_num` = #{viewNum},
      </if>
      <if test="orderSubmitNum != null">
        `order_submit_num` = #{orderSubmitNum},
      </if>
      <if test="orderSubmitAmount != null">
        `order_submit_amount` = #{orderSubmitAmount},
      </if>
      <if test="orderSubmitMemberNum != null">
        `order_submit_member_num` = #{orderSubmitMemberNum},
      </if>
      <if test="orderSubmitAtv != null">
        `order_submit_atv` = #{orderSubmitAtv},
      </if>
      <if test="orderPayNum != null">
        `order_pay_num` = #{orderPayNum},
      </if>
      <if test="orderPayAmount != null">
        `order_pay_amount` = #{orderPayAmount},
      </if>
      <if test="orderPayMemberNum != null">
        `order_pay_member_num` = #{orderPayMemberNum},
      </if>
      <if test="orderPayAtv != null">
        `order_pay_atv` = #{orderPayAtv},
      </if>
      <if test="pvSubmitRate != null">
        `pv_submit_rate` = #{pvSubmitRate},
      </if>
      <if test="pvPayRate != null">
        `pv_pay_rate` = #{pvPayRate},
      </if>
      <if test="submitPayRate != null">
        `submit_pay_rate` = #{submitPayRate},
      </if>
      <if test="goodsVisitorNum != null">
        `goods_visitor_num` = #{goodsVisitorNum},
      </if>
      <if test="goodsViewNum != null">
        `goods_view_num` = #{goodsViewNum},
      </if>
      <if test="viewGoodsNum != null">
        `view_goods_num` = #{viewGoodsNum},
      </if>
      <if test="newGoodsNum != null">
        `new_goods_num` = #{newGoodsNum},
      </if>
      <if test="collectionGoodsNum != null">
        `collection_goods_num` = #{collectionGoodsNum},
      </if>
      <if test="collectionStoreNum != null">
        `collection_store_num` = #{collectionStoreNum},
      </if>
      <if test="salingGoodsNum != null">
        `saling_goods_num` = #{salingGoodsNum},
      </if>
      <if test="returnNum != null">
        `return_num` = #{returnNum},
      </if>
      <if test="returnAmount != null">
        `return_amount` = #{returnAmount},
      </if>
      <if test="newMemberNum != null">
        `new_member_num` = #{newMemberNum},
      </if>
      <if test="perViewNum != null">
        `per_view_num` = #{perViewNum},
      </if>
    </trim>
    WHERE `stats_id` = #{statsId}
  </update>
</mapper>