yujian
2019-09-25 011d53f9f3d08af8cd622585ce40eb880f313aaf
fanli/src/main/java/com/yeshi/fanli/mapping/taobao/TaoBaoOrderMapper.xml
@@ -1,440 +1,446 @@
<?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.yeshi.fanli.dao.mybatis.taobao.TaoBaoOrderMapper">
   <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.taobao.TaoBaoOrder">
      <id column="to_id" property="id" jdbcType="BIGINT" />
      <result column="to_create_time" property="createTime" jdbcType="VARCHAR" />
      <result column="to_click_time" property="clickTime" jdbcType="VARCHAR" />
      <result column="to_title" property="title" jdbcType="VARCHAR" />
      <result column="to_auction_id" property="auctionId" jdbcType="BIGINT" />
      <result column="to_manager_wangwang" property="managerWangWang"
         jdbcType="VARCHAR" />
      <result column="to_shop" property="shop" jdbcType="VARCHAR" />
      <result column="to_count" property="count" jdbcType="INTEGER" />
      <result column="to_price" property="price" jdbcType="DECIMAL" />
      <result column="to_order_state" property="orderState" jdbcType="VARCHAR" />
      <result column="to_order_type" property="orderType" jdbcType="VARCHAR" />
      <result column="to_iratio" property="iRatio" jdbcType="DECIMAL" />
      <result column="to_sratio" property="sRatio" jdbcType="DECIMAL" />
      <result column="to_payment" property="payment" jdbcType="DECIMAL" />
      <result column="to_estimate" property="estimate" jdbcType="DECIMAL" />
      <result column="to_settlement" property="settlement" jdbcType="DECIMAL" />
      <result column="to_eIncome" property="eIncome" jdbcType="DECIMAL" />
      <result column="to_settlement_time" property="settlementTime"
         jdbcType="VARCHAR" />
      <result column="to_tk_rate" property="tkRate" jdbcType="DECIMAL" />
      <result column="to_tk_money" property="tkMoney" jdbcType="DECIMAL" />
      <result column="to_technology_support_percent" property="technologySupportPercent"
         jdbcType="DECIMAL" />
      <result column="to_subsidy_ratio" property="subsidyRatio"
         jdbcType="DECIMAL" />
      <result column="to_subsidy" property="subsidy" jdbcType="DECIMAL" />
      <result column="to_subsidy_type" property="subsidyType"
         jdbcType="VARCHAR" />
      <result column="to_transaction_platform" property="transactionPlatform"
         jdbcType="VARCHAR" />
      <result column="to_third_service" property="thirdService"
         jdbcType="VARCHAR" />
      <result column="to_order_id" property="orderId" jdbcType="VARCHAR" />
      <result column="to_class_name" property="className" jdbcType="VARCHAR" />
      <result column="to_source_media_id" property="sourceMediaId"
         jdbcType="VARCHAR" />
      <result column="to_source_media_name" property="sourceMediaName"
         jdbcType="VARCHAR" />
      <result column="to_ad_position_id" property="adPositionId"
         jdbcType="VARCHAR" />
      <result column="to_ad_position_name" property="adPositionName"
         jdbcType="VARCHAR" />
      <result column="to_latest_updatetime" property="latestUpdateTime"
         jdbcType="TIMESTAMP" />
      <result column="to_orderby" property="orderBy" jdbcType="INTEGER" />
      <result column="to_relation_id" property="relationId" jdbcType="VARCHAR" />
      <result column="to_special_id" property="specialId" jdbcType="VARCHAR" />
      <result column="to_trade_id" property="tradeId" jdbcType="VARCHAR" />
   </resultMap>
   <sql id="Base_Column_List">to_id,to_create_time,to_click_time,to_title,to_auction_id,to_manager_wangwang,to_shop,to_count,to_price,to_order_state,to_order_type,to_iratio,to_sratio,to_payment,to_estimate,to_settlement,to_eIncome,to_settlement_time,to_tk_rate,to_tk_money,to_technology_support_percent,to_subsidy_ratio,to_subsidy,to_subsidy_type,to_transaction_platform,to_third_service,to_order_id,to_class_name,to_source_media_id,to_source_media_name,to_ad_position_id,to_ad_position_name,to_latest_updatetime,to_orderby,to_relation_id,to_special_id,to_trade_id
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap"
      parameterType="java.lang.Long">
      select
      <include refid="Base_Column_List" />
      from yeshi_ec_taobao_order where to_id = #{id,jdbcType=BIGINT}
   </select>
   <select id="selectTaoBaoOrderByOrderId" resultMap="BaseResultMap"
      parameterType="java.lang.String">
      select
      <include refid="Base_Column_List" />
      from yeshi_ec_taobao_order where to_order_id = #{0} for update
   </select>
   <select id="selectLatestByAuctionId" resultMap="BaseResultMap"
      parameterType="java.lang.Long">
      select
      <include refid="Base_Column_List" />
      from yeshi_ec_taobao_order where to_auction_id = #{0} order by to_id
      desc limit 1
   </select>
   <select id="selectTaoBaoOrderByTradeId" resultMap="BaseResultMap"
      parameterType="java.lang.String">
      select
      <include refid="Base_Column_List" />
      from yeshi_ec_taobao_order where to_trade_id = #{0} for update
   </select>
   <select id="listLongTimeNoUpdateOrders" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_taobao_order t WHERE t.`to_order_state`='订单付款'
      AND UNIX_TIMESTAMP(t.`to_create_time`) <![CDATA[  <  ]]>
      UNIX_TIMESTAMP()-60*60*24*15 AND (t.`to_latest_updatetime` IS NULL OR
      UNIX_TIMESTAMP(t.`to_latest_updatetime`)<![CDATA[ < ]]>
      UNIX_TIMESTAMP()-60*60*24*2) ORDER BY t.`to_create_time` DESC limit
      #{start},#{count}
   </select>
   <select id="listByTradeId" resultMap="BaseResultMap"
      parameterType="java.lang.String">
      select * from yeshi_ec_taobao_order where
      to_trade_id=#{0}
   </select>
   <select id="listAllOrder" resultMap="BaseResultMap">
      select * from yeshi_ec_taobao_order
      <if test="orderNo!=null">
         where to_order_id=#{orderNo}
      </if>
      order by to_create_time desc
      limit #{start},#{count}
   </select>
   <select id="countAllOrder" resultType="java.lang.Long">
      select count(to_id) from yeshi_ec_taobao_order
      <if test="orderNo!=null">
         where to_order_id=#{orderNo}
      </if>
   </select>
   <select id="listBySettlementTime" resultMap="BaseResultMap">
      select * from yeshi_ec_taobao_order
      where 1=1
      <if test="minTime!=null">
        and UNIX_TIMESTAMP(to_settlement_time)*1000>=#{minTime}
      </if>
      <if test="maxTime!=null">
        and #{maxTime}>UNIX_TIMESTAMP(to_settlement_time)*1000
      </if>
      order by to_settlement_time desc
      limit #{start},#{count}
   </select>
   <select id="countBySettlementTime" resultType="java.lang.Long">
      select count(to_id) from yeshi_ec_taobao_order
      where 1=1
      <if test="minTime!=null">
        and UNIX_TIMESTAMP(to_settlement_time)*1000>=#{minTime}
      </if>
      <if test="maxTime!=null">
        and #{maxTime}>UNIX_TIMESTAMP(to_settlement_time)*1000
      </if>
   </select>
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
      yeshi_ec_taobao_order where to_id = #{id,jdbcType=BIGINT}
   </delete>
   <delete id="deleteByOrderId" parameterType="java.lang.String">delete from
      yeshi_ec_taobao_order where to_order_id = #{0}
   </delete>
   <insert id="insert" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoOrder"
      useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_taobao_order
      (to_id,to_create_time,to_click_time,to_title,to_auction_id,to_manager_wangwang,to_shop,to_count,to_price,to_order_state,to_order_type,to_iratio,to_sratio,to_payment,to_estimate,to_settlement,to_eIncome,to_settlement_time,to_tk_rate,to_tk_money,to_technology_support_percent,to_subsidy_ratio,to_subsidy,to_subsidy_type,to_transaction_platform,to_third_service,to_order_id,to_class_name,to_source_media_id,to_source_media_name,to_ad_position_id,to_ad_position_name,to_latest_updatetime,to_orderby,to_relation_id,to_special_id,to_trade_id)
      values
      (#{id,jdbcType=BIGINT},#{createTime,jdbcType=VARCHAR},#{clickTime,jdbcType=VARCHAR},#{title,jdbcType=VARCHAR},#{auctionId,jdbcType=BIGINT},#{managerWangWang,jdbcType=VARCHAR},#{shop,jdbcType=VARCHAR},#{count,jdbcType=INTEGER},#{price,jdbcType=DECIMAL},#{orderState,jdbcType=VARCHAR},#{orderType,jdbcType=VARCHAR},#{iRatio,jdbcType=DECIMAL},#{sRatio,jdbcType=DECIMAL},#{payment,jdbcType=DECIMAL},#{estimate,jdbcType=DECIMAL},#{settlement,jdbcType=DECIMAL},#{eIncome,jdbcType=DECIMAL},#{settlementTime,jdbcType=VARCHAR},#{tkRate,jdbcType=DECIMAL},#{tkMoney,jdbcType=DECIMAL},#{technologySupportPercent,jdbcType=DECIMAL},#{subsidyRatio,jdbcType=DECIMAL},#{subsidy,jdbcType=DECIMAL},#{subsidyType,jdbcType=VARCHAR},#{transactionPlatform,jdbcType=VARCHAR},#{thirdService,jdbcType=VARCHAR},#{orderId,jdbcType=VARCHAR},#{className,jdbcType=VARCHAR},#{sourceMediaId,jdbcType=VARCHAR},#{sourceMediaName,jdbcType=VARCHAR},#{adPositionId,jdbcType=VARCHAR},#{adPositionName,jdbcType=VARCHAR},
      #{latestUpdateTime,jdbcType=TIMESTAMP},#{orderBy,jdbcType=INTEGER},
      #{relationId,jdbcType=VARCHAR},#{specialId,jdbcType=VARCHAR}
      ,#{tradeId,jdbcType=VARCHAR})
   </insert>
   <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoOrder"
      useGeneratedKeys="true" keyProperty="id">
      insert into yeshi_ec_taobao_order
      <trim prefix="(" suffix=")" suffixOverrides=",">
         <if test="id != null">to_id,</if>
         <if test="createTime != null">to_create_time,</if>
         <if test="clickTime != null">to_click_time,</if>
         <if test="title != null">to_title,</if>
         <if test="auctionId != null">to_auction_id,</if>
         <if test="managerWangWang != null">to_manager_wangwang,</if>
         <if test="shop != null">to_shop,</if>
         <if test="count != null">to_count,</if>
         <if test="price != null">to_price,</if>
         <if test="orderState != null">to_order_state,</if>
         <if test="orderType != null">to_order_type,</if>
         <if test="iRatio != null">to_iratio,</if>
         <if test="sRatio != null">to_sratio,</if>
         <if test="payment != null">to_payment,</if>
         <if test="estimate != null">to_estimate,</if>
         <if test="settlement != null">to_settlement,</if>
         <if test="eIncome != null">to_eIncome,</if>
         <if test="settlementTime != null">to_settlement_time,</if>
         <if test="tkRate != null">to_tk_rate,</if>
         <if test="tkMoney != null">to_tk_money,</if>
         <if test="technologySupportPercent != null">to_technology_support_percent,</if>
         <if test="subsidyRatio != null">to_subsidy_ratio,</if>
         <if test="subsidy != null">to_subsidy,</if>
         <if test="subsidyType != null">to_subsidy_type,</if>
         <if test="transactionPlatform != null">to_transaction_platform,</if>
         <if test="thirdService != null">to_third_service,</if>
         <if test="orderId != null">to_order_id,</if>
         <if test="className != null">to_class_name,</if>
         <if test="sourceMediaId != null">to_source_media_id,</if>
         <if test="sourceMediaName != null">to_source_media_name,</if>
         <if test="adPositionId != null">to_ad_position_id,</if>
         <if test="adPositionName != null">to_ad_position_name,</if>
         <if test="latestUpdateTime != null">to_latest_updatetime,</if>
         <if test="orderBy != null">to_orderby,</if>
         <if test="relationId != null">to_relation_id,</if>
         <if test="specialId != null">to_special_id,</if>
         <if test="tradeId != null">to_trade_id,</if>
      </trim>
      values
      <trim prefix="(" suffix=")" suffixOverrides=",">
         <if test="id != null">#{id,jdbcType=BIGINT},</if>
         <if test="createTime != null">#{createTime,jdbcType=VARCHAR},</if>
         <if test="clickTime != null">#{clickTime,jdbcType=VARCHAR},</if>
         <if test="title != null">#{title,jdbcType=VARCHAR},</if>
         <if test="auctionId != null">#{auctionId,jdbcType=BIGINT},</if>
         <if test="managerWangWang != null">#{managerWangWang,jdbcType=VARCHAR},</if>
         <if test="shop != null">#{shop,jdbcType=VARCHAR},</if>
         <if test="count != null">#{count,jdbcType=INTEGER},</if>
         <if test="price != null">#{price,jdbcType=DECIMAL},</if>
         <if test="orderState != null">#{orderState,jdbcType=VARCHAR},</if>
         <if test="orderType != null">#{orderType,jdbcType=VARCHAR},</if>
         <if test="iRatio != null">#{iRatio,jdbcType=DECIMAL},</if>
         <if test="sRatio != null">#{sRatio,jdbcType=DECIMAL},</if>
         <if test="payment != null">#{payment,jdbcType=DECIMAL},</if>
         <if test="estimate != null">#{estimate,jdbcType=DECIMAL},</if>
         <if test="settlement != null">#{settlement,jdbcType=DECIMAL},</if>
         <if test="eIncome != null">#{eIncome,jdbcType=DECIMAL},</if>
         <if test="settlementTime != null">#{settlementTime,jdbcType=VARCHAR},</if>
         <if test="tkRate != null">#{tkRate,jdbcType=DECIMAL},</if>
         <if test="tkMoney != null">#{tkMoney,jdbcType=DECIMAL},</if>
         <if test="technologySupportPercent != null">#{technologySupportPercent,jdbcType=DECIMAL},</if>
         <if test="subsidyRatio != null">#{subsidyRatio,jdbcType=DECIMAL},</if>
         <if test="subsidy != null">#{subsidy,jdbcType=DECIMAL},</if>
         <if test="subsidyType != null">#{subsidyType,jdbcType=VARCHAR},</if>
         <if test="transactionPlatform != null">#{transactionPlatform,jdbcType=VARCHAR},</if>
         <if test="thirdService != null">#{thirdService,jdbcType=VARCHAR},</if>
         <if test="orderId != null">#{orderId,jdbcType=VARCHAR},</if>
         <if test="className != null">#{className,jdbcType=VARCHAR},</if>
         <if test="sourceMediaId != null">#{sourceMediaId,jdbcType=VARCHAR},</if>
         <if test="sourceMediaName != null">#{sourceMediaName,jdbcType=VARCHAR},</if>
         <if test="adPositionId != null">#{adPositionId,jdbcType=VARCHAR},</if>
         <if test="adPositionName != null">#{adPositionName,jdbcType=VARCHAR},</if>
         <if test="latestUpdateTime != null">#{latestUpdateTime,jdbcType=TIMESTAMP},</if>
         <if test="orderBy != null">#{orderBy,jdbcType=INTEGER},</if>
         <if test="relationId != null">#{relationId,jdbcType=VARCHAR},</if>
         <if test="specialId != null">#{specialId,jdbcType=VARCHAR},</if>
         <if test="tradeId != null">#{tradeId,jdbcType=VARCHAR}</if>
      </trim>
   </insert>
   <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoOrder">update
      yeshi_ec_taobao_order set to_create_time =
      #{createTime,jdbcType=VARCHAR},to_click_time =
      #{clickTime,jdbcType=VARCHAR},to_title =
      #{title,jdbcType=VARCHAR},to_auction_id =
      #{auctionId,jdbcType=BIGINT},to_manager_wangwang =
      #{managerWangWang,jdbcType=VARCHAR},to_shop =
      #{shop,jdbcType=VARCHAR},to_count = #{count,jdbcType=INTEGER},to_price
      = #{price,jdbcType=DECIMAL},to_order_state =
      #{orderState,jdbcType=VARCHAR},to_order_type =
      #{orderType,jdbcType=VARCHAR},to_iratio =
      #{iRatio,jdbcType=DECIMAL},to_sratio =
      #{sRatio,jdbcType=DECIMAL},to_payment =
      #{payment,jdbcType=DECIMAL},to_estimate =
      #{estimate,jdbcType=DECIMAL},to_settlement =
      #{settlement,jdbcType=DECIMAL},to_eIncome =
      #{eIncome,jdbcType=DECIMAL},to_settlement_time =
      #{settlementTime,jdbcType=VARCHAR},to_tk_rate =
      #{tkRate,jdbcType=DECIMAL},to_tk_money =
      #{tkMoney,jdbcType=DECIMAL},to_technology_support_percent =
      #{technologySupportPercent,jdbcType=DECIMAL},to_subsidy_ratio =
      #{subsidyRatio,jdbcType=DECIMAL},to_subsidy =
      #{subsidy,jdbcType=DECIMAL},to_subsidy_type =
      #{subsidyType,jdbcType=VARCHAR},to_transaction_platform =
      #{transactionPlatform,jdbcType=VARCHAR},to_third_service =
      #{thirdService,jdbcType=VARCHAR},to_order_id =
      #{orderId,jdbcType=VARCHAR},to_class_name =
      #{className,jdbcType=VARCHAR},to_source_media_id =
      #{sourceMediaId,jdbcType=VARCHAR},to_source_media_name =
      #{sourceMediaName,jdbcType=VARCHAR},to_ad_position_id =
      #{adPositionId,jdbcType=VARCHAR},to_ad_position_name =
      #{adPositionName,jdbcType=VARCHAR},to_latest_updatetime =
      #{latestUpdateTime,jdbcType=TIMESTAMP},to_orderby=
      #{orderBy,jdbcType=INTEGER},to_relation_id =
      #{relationId,jdbcType=VARCHAR},to_special_id=
      #{specialId,jdbcType=VARCHAR} ,to_trade_id
      =#{tradeId,jdbcType=VARCHAR} where to_id = #{id,jdbcType=BIGINT}
   </update>
   <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoOrder">
      update yeshi_ec_taobao_order
      <set>
         <if test="createTime != null">to_create_time=#{createTime,jdbcType=VARCHAR},</if>
         <if test="clickTime != null">to_click_time=#{clickTime,jdbcType=VARCHAR},</if>
         <if test="title != null">to_title=#{title,jdbcType=VARCHAR},</if>
         <if test="auctionId != null">to_auction_id=#{auctionId,jdbcType=BIGINT},</if>
         <if test="managerWangWang != null">to_manager_wangwang=#{managerWangWang,jdbcType=VARCHAR},
         </if>
         <if test="shop != null">to_shop=#{shop,jdbcType=VARCHAR},</if>
         <if test="count != null">to_count=#{count,jdbcType=INTEGER},</if>
         <if test="price != null">to_price=#{price,jdbcType=DECIMAL},</if>
         <if test="orderState != null">to_order_state=#{orderState,jdbcType=VARCHAR},</if>
         <if test="orderType != null">to_order_type=#{orderType,jdbcType=VARCHAR},</if>
         <if test="iRatio != null">to_iratio=#{iRatio,jdbcType=DECIMAL},</if>
         <if test="sRatio != null">to_sratio=#{sRatio,jdbcType=DECIMAL},</if>
         <if test="payment != null">to_payment=#{payment,jdbcType=DECIMAL},</if>
         <if test="estimate != null">to_estimate=#{estimate,jdbcType=DECIMAL},</if>
         <if test="settlement != null">to_settlement=#{settlement,jdbcType=DECIMAL},</if>
         <if test="eIncome != null">to_eIncome=#{eIncome,jdbcType=DECIMAL},</if>
         <if test="settlementTime != null">to_settlement_time=#{settlementTime,jdbcType=VARCHAR},
         </if>
         <if test="tkRate != null">to_tk_rate=#{tkRate,jdbcType=DECIMAL},</if>
         <if test="tkMoney != null">to_tk_money=#{tkMoney,jdbcType=DECIMAL},</if>
         <if test="technologySupportPercent != null">to_technology_support_percent=#{technologySupportPercent,jdbcType=DECIMAL},
         </if>
         <if test="subsidyRatio != null">to_subsidy_ratio=#{subsidyRatio,jdbcType=DECIMAL},</if>
         <if test="subsidy != null">to_subsidy=#{subsidy,jdbcType=DECIMAL},</if>
         <if test="subsidyType != null">to_subsidy_type=#{subsidyType,jdbcType=VARCHAR},</if>
         <if test="transactionPlatform != null">to_transaction_platform=#{transactionPlatform,jdbcType=VARCHAR},
         </if>
         <if test="thirdService != null">to_third_service=#{thirdService,jdbcType=VARCHAR},</if>
         <if test="orderId != null">to_order_id=#{orderId,jdbcType=VARCHAR},</if>
         <if test="className != null">to_class_name=#{className,jdbcType=VARCHAR},</if>
         <if test="sourceMediaId != null">to_source_media_id=#{sourceMediaId,jdbcType=VARCHAR},
         </if>
         <if test="sourceMediaName != null">to_source_media_name=#{sourceMediaName,jdbcType=VARCHAR},
         </if>
         <if test="adPositionId != null">to_ad_position_id=#{adPositionId,jdbcType=VARCHAR},</if>
         <if test="adPositionName != null">to_ad_position_name=#{adPositionName,jdbcType=VARCHAR},
         </if>
         <if test="latestUpdateTime != null">to_latest_updatetime=#{latestUpdateTime,jdbcType=TIMESTAMP},
         </if>
         <if test="orderBy != null">to_orderby=#{orderBy,jdbcType=INTEGER},</if>
         <if test="relationId != null">to_relation_id=#{relationId,jdbcType=VARCHAR},</if>
         <if test="specialId != null">to_special_id=#{specialId,jdbcType=VARCHAR},</if>
         <if test="id !=null">to_id =#{id,jdbcType=BIGINT},</if>
         <if test="tradeId !=null">to_trade_id =#{tradeId,jdbcType=VARCHAR},</if>
      </set>
      where to_id = #{id,jdbcType=BIGINT}
   </update>
   <resultMap id="ResultMapExtral" type="com.yeshi.fanli.entity.admin.ReslutOrder">
      <id column="to_id" property="tboid" jdbcType="BIGINT" />
      <result column="to_create_time" property="createTime" jdbcType="VARCHAR" />
      <result column="to_click_time" property="clickTime" jdbcType="VARCHAR" />
      <result column="to_title" property="title" jdbcType="VARCHAR" />
      <result column="to_auction_id" property="auctionId" jdbcType="BIGINT" />
      <result column="to_manager_wangwang" property="managerWangWang"
         jdbcType="VARCHAR" />
      <result column="to_shop" property="shop" jdbcType="VARCHAR" />
      <result column="to_count" property="count" jdbcType="INTEGER" />
      <result column="to_price" property="price" jdbcType="DECIMAL" />
      <result column="to_order_state" property="orderState" jdbcType="VARCHAR" />
      <result column="to_order_type" property="orderType" jdbcType="VARCHAR" />
      <result column="to_iratio" property="iRatio" jdbcType="DECIMAL" />
      <result column="to_sratio" property="sRatio" jdbcType="DECIMAL" />
      <result column="to_payment" property="payment" jdbcType="DECIMAL" />
      <result column="to_estimate" property="estimate" jdbcType="DECIMAL" />
      <result column="to_settlement" property="settlement" jdbcType="DECIMAL" />
      <result column="to_eIncome" property="eIncome" jdbcType="DECIMAL" />
      <result column="to_settlement_time" property="settlementTime"
         jdbcType="VARCHAR" />
      <result column="to_tk_rate" property="tkRate" jdbcType="DECIMAL" />
      <result column="to_tk_money" property="tkMoney" jdbcType="DECIMAL" />
      <result column="to_technology_support_percent" property="technologySupportPercent"
         jdbcType="DECIMAL" />
      <result column="to_subsidy_ratio" property="subsidyRatio"
         jdbcType="DECIMAL" />
      <result column="to_subsidy" property="subsidy" jdbcType="DECIMAL" />
      <result column="to_subsidy_type" property="subsidyType"
         jdbcType="VARCHAR" />
      <result column="to_transaction_platform" property="transactionPlatform"
         jdbcType="VARCHAR" />
      <result column="to_third_service" property="thirdService"
         jdbcType="VARCHAR" />
      <result column="to_order_id" property="orderId" jdbcType="VARCHAR" />
      <result column="to_class_name" property="className" jdbcType="VARCHAR" />
      <result column="to_source_media_id" property="sourceMediaId"
         jdbcType="VARCHAR" />
      <result column="to_source_media_name" property="sourceMediaName"
         jdbcType="VARCHAR" />
      <result column="to_ad_position_id" property="adPositionId"
         jdbcType="VARCHAR" />
      <result column="to_ad_position_name" property="adPositionName"
         jdbcType="VARCHAR" />
      <result column="to_latest_updatetime" property="latestUpdateTime"
         jdbcType="TIMESTAMP" />
      <association property="userInfo" column="uid"
         javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
         <id column="uid" property="id" jdbcType="BIGINT" />
      </association>
   </resultMap>
   <select id="countByOdrerType" resultType="java.util.HashMap">SELECT COUNT(to_id)AS
      countTotal ,IFNULL(SUM(CASE WHEN `to_order_state` = '订单结算' THEN 1 WHEN
      `to_order_state` = '订单成功' THEN 1 ELSE 0 END),0) AS countSettlement,
      IFNULL(SUM(CASE WHEN `to_order_state` = '订单付款' THEN 1 ELSE 0 END),0)
      AS countPayment, IFNULL(SUM(CASE WHEN `to_order_state` = '订单失效' THEN 1
      ELSE 0 END),0) AS countInvalid FROM `yeshi_ec_taobao_order`
   </select>
   <select id="countToday" resultType="java.lang.Integer">SELECT
      COUNT(DISTINCT(tb.to_order_id)) FROM `yeshi_ec_taobao_order` tb WHERE <![CDATA[tb.`to_order_state`<>'订单失效'  AND TO_DAYS(tb.`to_create_time`) = TO_DAYS(NOW())]]>
   </select>
   <select id="countYesterday" resultType="java.lang.Integer">SELECT
      COUNT(DISTINCT(td.to_order_id))FROM `yeshi_ec_taobao_order` td WHERE <![CDATA[td.`to_order_state`<>'订单失效'  AND TO_DAYS(NOW()) - TO_DAYS( td.`to_create_time`) = 1 ]]>
   </select>
   <select id="countEstimate" resultType="java.lang.Double">SELECT
      IFNULL(SUM(t.to_estimate),0) FROM `yeshi_ec_taobao_order` t WHERE <![CDATA[ t.`to_order_state`<> '订单失效' ]]>
      AND DATE_FORMAT(t.`to_create_time` , '%Y-%m-%d' )= #{date}
   </select>
   <select id="getStateByOrderIdAndPayment" resultMap="BaseResultMap">
      select
      <include refid="Base_Column_List" />
      from yeshi_ec_taobao_order where to_order_id = #{orderId} and
      to_payment = #{payment}
   </select>
   <sql id="Column_DateType">
      <if test="dateType == 1">DATE_FORMAT(t.`to_create_time`,'%Y-%m-%d') AS 'showDate'
      </if>
      <if test="dateType == 2">DATE_FORMAT(t.`to_create_time`,'%m') AS 'showDate'</if>
      <if test="dateType == 3">DATE_FORMAT(t.`to_create_time`,'%Y') AS 'showDate'</if>
   </sql>
   <sql id="Count_Select_DateType">
      <if test="startTime != null and startTime != '' ">
         AND DATE_FORMAT(t.`to_create_time`,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
      </if>
      <if test="endTime != null and endTime != '' ">
         AND DATE_FORMAT(t.`to_create_time`,'%Y-%m-%d') <![CDATA[ <= ]]>'${endTime}'
      </if>
      <if test="year != null and year != '' ">AND DATE_FORMAT(t.`to_create_time`,'%Y') = '${year}'</if>
   </sql>
   <sql id="Count_Group_DateType">
      <if test="dateType == 1">GROUP BY DATE_FORMAT(t.`to_create_time`,'%Y-%m-%d')</if>
      <if test="dateType == 2">GROUP BY DATE_FORMAT(t.`to_create_time`,'%Y-%m')</if>
      <if test="dateType == 3">GROUP BY DATE_FORMAT(t.`to_create_time`,'%Y')</if>
   </sql>
   <select id="countOrderNumber" resultType="java.util.HashMap">
      SELECT IFNULL(COUNT(t.`to_id`),0) AS showValue,
      <include refid="Column_DateType" />
      FROM `yeshi_ec_taobao_order` t WHERE t.`to_create_time` IS NOT NULL
      <include refid="Count_Select_DateType" />
      <include refid="Count_Group_DateType" />
      ORDER BY t.`to_create_time`
   </select>
</mapper>
<?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.yeshi.fanli.dao.mybatis.taobao.TaoBaoOrderMapper">
   <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.taobao.TaoBaoOrder">
      <id column="to_id" property="id" jdbcType="BIGINT" />
      <result column="to_create_time" property="createTime" jdbcType="VARCHAR" />
      <result column="to_click_time" property="clickTime" jdbcType="VARCHAR" />
      <result column="to_pay_time" property="payTime" jdbcType="VARCHAR" />
      <result column="to_title" property="title" jdbcType="VARCHAR" />
      <result column="to_auction_id" property="auctionId" jdbcType="BIGINT" />
      <result column="to_manager_wangwang" property="managerWangWang"
         jdbcType="VARCHAR" />
      <result column="to_shop" property="shop" jdbcType="VARCHAR" />
      <result column="to_count" property="count" jdbcType="INTEGER" />
      <result column="to_price" property="price" jdbcType="DECIMAL" />
      <result column="to_order_state" property="orderState" jdbcType="VARCHAR" />
      <result column="to_order_type" property="orderType" jdbcType="VARCHAR" />
      <result column="to_iratio" property="iRatio" jdbcType="DECIMAL" />
      <result column="to_sratio" property="sRatio" jdbcType="DECIMAL" />
      <result column="to_payment" property="payment" jdbcType="DECIMAL" />
      <result column="to_estimate" property="estimate" jdbcType="DECIMAL" />
      <result column="to_settlement" property="settlement" jdbcType="DECIMAL" />
      <result column="to_eIncome" property="eIncome" jdbcType="DECIMAL" />
      <result column="to_settlement_time" property="settlementTime"
         jdbcType="VARCHAR" />
      <result column="to_tk_rate" property="tkRate" jdbcType="DECIMAL" />
      <result column="to_tk_money" property="tkMoney" jdbcType="DECIMAL" />
      <result column="to_technology_support_percent" property="technologySupportPercent"
         jdbcType="DECIMAL" />
      <result column="to_subsidy_ratio" property="subsidyRatio"
         jdbcType="DECIMAL" />
      <result column="to_subsidy" property="subsidy" jdbcType="DECIMAL" />
      <result column="to_subsidy_type" property="subsidyType"
         jdbcType="VARCHAR" />
      <result column="to_transaction_platform" property="transactionPlatform"
         jdbcType="VARCHAR" />
      <result column="to_third_service" property="thirdService"
         jdbcType="VARCHAR" />
      <result column="to_order_id" property="orderId" jdbcType="VARCHAR" />
      <result column="to_class_name" property="className" jdbcType="VARCHAR" />
      <result column="to_source_media_id" property="sourceMediaId"
         jdbcType="VARCHAR" />
      <result column="to_source_media_name" property="sourceMediaName"
         jdbcType="VARCHAR" />
      <result column="to_ad_position_id" property="adPositionId"
         jdbcType="VARCHAR" />
      <result column="to_ad_position_name" property="adPositionName"
         jdbcType="VARCHAR" />
      <result column="to_latest_updatetime" property="latestUpdateTime"
         jdbcType="TIMESTAMP" />
      <result column="to_orderby" property="orderBy" jdbcType="INTEGER" />
      <result column="to_relation_id" property="relationId" jdbcType="VARCHAR" />
      <result column="to_special_id" property="specialId" jdbcType="VARCHAR" />
      <result column="to_trade_id" property="tradeId" jdbcType="VARCHAR" />
   </resultMap>
   <sql id="Base_Column_List">to_id,to_create_time,to_click_time,to_pay_time,to_title,to_auction_id,to_manager_wangwang,to_shop,to_count,to_price,to_order_state,to_order_type,to_iratio,to_sratio,to_payment,to_estimate,to_settlement,to_eIncome,to_settlement_time,to_tk_rate,to_tk_money,to_technology_support_percent,to_subsidy_ratio,to_subsidy,to_subsidy_type,to_transaction_platform,to_third_service,to_order_id,to_class_name,to_source_media_id,to_source_media_name,to_ad_position_id,to_ad_position_name,to_latest_updatetime,to_orderby,to_relation_id,to_special_id,to_trade_id
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap"
      parameterType="java.lang.Long">
      select
      <include refid="Base_Column_List" />
      from yeshi_ec_taobao_order where to_id = #{id,jdbcType=BIGINT}
   </select>
   <select id="selectTaoBaoOrderByOrderId" resultMap="BaseResultMap"
      parameterType="java.lang.String">
      select
      <include refid="Base_Column_List" />
      from yeshi_ec_taobao_order where to_order_id = #{0} for update
   </select>
   <select id="selectLatestByAuctionId" resultMap="BaseResultMap"
      parameterType="java.lang.Long">
      select
      <include refid="Base_Column_List" />
      from yeshi_ec_taobao_order where to_auction_id = #{0} order by to_id
      desc limit 1
   </select>
   <select id="selectTaoBaoOrderByTradeId" resultMap="BaseResultMap"
      parameterType="java.lang.String">
      select
      <include refid="Base_Column_List" />
      from yeshi_ec_taobao_order where to_trade_id = #{0} for update
   </select>
   <select id="listLongTimeNoUpdateOrders" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_taobao_order t WHERE t.`to_order_state`='订单付款'
      AND UNIX_TIMESTAMP(t.`to_create_time`) <![CDATA[  <  ]]>
      UNIX_TIMESTAMP()-60*60*24*15 AND (t.`to_latest_updatetime` IS NULL OR
      UNIX_TIMESTAMP(t.`to_latest_updatetime`)<![CDATA[ < ]]>
      UNIX_TIMESTAMP()-60*60*24*2) ORDER BY t.`to_create_time` DESC limit
      #{start},#{count}
   </select>
   <select id="listByTradeId" resultMap="BaseResultMap"
      parameterType="java.lang.String">
      select * from yeshi_ec_taobao_order where
      to_trade_id=#{0}
   </select>
   <select id="listAllOrder" resultMap="BaseResultMap">
      select * from yeshi_ec_taobao_order
      <if test="orderNo!=null">
         where to_order_id=#{orderNo}
      </if>
      order by to_create_time desc
      limit #{start},#{count}
   </select>
   <select id="countAllOrder" resultType="java.lang.Long">
      select count(to_id) from yeshi_ec_taobao_order
      <if test="orderNo!=null">
         where to_order_id=#{orderNo}
      </if>
   </select>
   <select id="listBySettlementTime" resultMap="BaseResultMap">
      select * from yeshi_ec_taobao_order
      where 1=1
      <if test="minTime!=null">
        and UNIX_TIMESTAMP(to_settlement_time)*1000>=#{minTime}
      </if>
      <if test="maxTime!=null">
        and #{maxTime}>UNIX_TIMESTAMP(to_settlement_time)*1000
      </if>
      order by to_settlement_time desc
      limit #{start},#{count}
   </select>
   <select id="countBySettlementTime" resultType="java.lang.Long">
      select count(to_id) from yeshi_ec_taobao_order
      where 1=1
      <if test="minTime!=null">
        and UNIX_TIMESTAMP(to_settlement_time)*1000>=#{minTime}
      </if>
      <if test="maxTime!=null">
        and #{maxTime}>UNIX_TIMESTAMP(to_settlement_time)*1000
      </if>
   </select>
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
      yeshi_ec_taobao_order where to_id = #{id,jdbcType=BIGINT}
   </delete>
   <delete id="deleteByOrderId" parameterType="java.lang.String">delete from
      yeshi_ec_taobao_order where to_order_id = #{0}
   </delete>
   <insert id="insert" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoOrder"
      useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_taobao_order
      (to_id,to_create_time,to_click_time,to_pay_time,to_title,to_auction_id,to_manager_wangwang,to_shop,to_count,to_price,to_order_state,to_order_type,to_iratio,to_sratio,to_payment,to_estimate,to_settlement,to_eIncome,to_settlement_time,to_tk_rate,to_tk_money,to_technology_support_percent,to_subsidy_ratio,to_subsidy,to_subsidy_type,to_transaction_platform,to_third_service,to_order_id,to_class_name,to_source_media_id,to_source_media_name,to_ad_position_id,to_ad_position_name,to_latest_updatetime,to_orderby,to_relation_id,to_special_id,to_trade_id)
      values
      (#{id,jdbcType=BIGINT},#{createTime,jdbcType=VARCHAR},#{clickTime,jdbcType=VARCHAR},#{payTime,jdbcType=VARCHAR},#{title,jdbcType=VARCHAR},#{auctionId,jdbcType=BIGINT},#{managerWangWang,jdbcType=VARCHAR},#{shop,jdbcType=VARCHAR},#{count,jdbcType=INTEGER},#{price,jdbcType=DECIMAL},#{orderState,jdbcType=VARCHAR},#{orderType,jdbcType=VARCHAR},#{iRatio,jdbcType=DECIMAL},#{sRatio,jdbcType=DECIMAL},#{payment,jdbcType=DECIMAL},#{estimate,jdbcType=DECIMAL},#{settlement,jdbcType=DECIMAL},#{eIncome,jdbcType=DECIMAL},#{settlementTime,jdbcType=VARCHAR},#{tkRate,jdbcType=DECIMAL},#{tkMoney,jdbcType=DECIMAL},#{technologySupportPercent,jdbcType=DECIMAL},#{subsidyRatio,jdbcType=DECIMAL},#{subsidy,jdbcType=DECIMAL},#{subsidyType,jdbcType=VARCHAR},#{transactionPlatform,jdbcType=VARCHAR},#{thirdService,jdbcType=VARCHAR},#{orderId,jdbcType=VARCHAR},#{className,jdbcType=VARCHAR},#{sourceMediaId,jdbcType=VARCHAR},#{sourceMediaName,jdbcType=VARCHAR},#{adPositionId,jdbcType=VARCHAR},#{adPositionName,jdbcType=VARCHAR},
      #{latestUpdateTime,jdbcType=TIMESTAMP},#{orderBy,jdbcType=INTEGER},
      #{relationId,jdbcType=VARCHAR},#{specialId,jdbcType=VARCHAR}
      ,#{tradeId,jdbcType=VARCHAR})
   </insert>
   <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoOrder"
      useGeneratedKeys="true" keyProperty="id">
      insert into yeshi_ec_taobao_order
      <trim prefix="(" suffix=")" suffixOverrides=",">
         <if test="id != null">to_id,</if>
         <if test="createTime != null">to_create_time,</if>
         <if test="clickTime != null">to_click_time,</if>
         <if test="payTime != null">to_pay_time,</if>
         <if test="title != null">to_title,</if>
         <if test="auctionId != null">to_auction_id,</if>
         <if test="managerWangWang != null">to_manager_wangwang,</if>
         <if test="shop != null">to_shop,</if>
         <if test="count != null">to_count,</if>
         <if test="price != null">to_price,</if>
         <if test="orderState != null">to_order_state,</if>
         <if test="orderType != null">to_order_type,</if>
         <if test="iRatio != null">to_iratio,</if>
         <if test="sRatio != null">to_sratio,</if>
         <if test="payment != null">to_payment,</if>
         <if test="estimate != null">to_estimate,</if>
         <if test="settlement != null">to_settlement,</if>
         <if test="eIncome != null">to_eIncome,</if>
         <if test="settlementTime != null">to_settlement_time,</if>
         <if test="tkRate != null">to_tk_rate,</if>
         <if test="tkMoney != null">to_tk_money,</if>
         <if test="technologySupportPercent != null">to_technology_support_percent,</if>
         <if test="subsidyRatio != null">to_subsidy_ratio,</if>
         <if test="subsidy != null">to_subsidy,</if>
         <if test="subsidyType != null">to_subsidy_type,</if>
         <if test="transactionPlatform != null">to_transaction_platform,</if>
         <if test="thirdService != null">to_third_service,</if>
         <if test="orderId != null">to_order_id,</if>
         <if test="className != null">to_class_name,</if>
         <if test="sourceMediaId != null">to_source_media_id,</if>
         <if test="sourceMediaName != null">to_source_media_name,</if>
         <if test="adPositionId != null">to_ad_position_id,</if>
         <if test="adPositionName != null">to_ad_position_name,</if>
         <if test="latestUpdateTime != null">to_latest_updatetime,</if>
         <if test="orderBy != null">to_orderby,</if>
         <if test="relationId != null">to_relation_id,</if>
         <if test="specialId != null">to_special_id,</if>
         <if test="tradeId != null">to_trade_id,</if>
      </trim>
      values
      <trim prefix="(" suffix=")" suffixOverrides=",">
         <if test="id != null">#{id,jdbcType=BIGINT},</if>
         <if test="createTime != null">#{createTime,jdbcType=VARCHAR},</if>
         <if test="clickTime != null">#{clickTime,jdbcType=VARCHAR},</if>
         <if test="payTime != null">#{payTime,jdbcType=VARCHAR},</if>
         <if test="title != null">#{title,jdbcType=VARCHAR},</if>
         <if test="auctionId != null">#{auctionId,jdbcType=BIGINT},</if>
         <if test="managerWangWang != null">#{managerWangWang,jdbcType=VARCHAR},</if>
         <if test="shop != null">#{shop,jdbcType=VARCHAR},</if>
         <if test="count != null">#{count,jdbcType=INTEGER},</if>
         <if test="price != null">#{price,jdbcType=DECIMAL},</if>
         <if test="orderState != null">#{orderState,jdbcType=VARCHAR},</if>
         <if test="orderType != null">#{orderType,jdbcType=VARCHAR},</if>
         <if test="iRatio != null">#{iRatio,jdbcType=DECIMAL},</if>
         <if test="sRatio != null">#{sRatio,jdbcType=DECIMAL},</if>
         <if test="payment != null">#{payment,jdbcType=DECIMAL},</if>
         <if test="estimate != null">#{estimate,jdbcType=DECIMAL},</if>
         <if test="settlement != null">#{settlement,jdbcType=DECIMAL},</if>
         <if test="eIncome != null">#{eIncome,jdbcType=DECIMAL},</if>
         <if test="settlementTime != null">#{settlementTime,jdbcType=VARCHAR},</if>
         <if test="tkRate != null">#{tkRate,jdbcType=DECIMAL},</if>
         <if test="tkMoney != null">#{tkMoney,jdbcType=DECIMAL},</if>
         <if test="technologySupportPercent != null">#{technologySupportPercent,jdbcType=DECIMAL},</if>
         <if test="subsidyRatio != null">#{subsidyRatio,jdbcType=DECIMAL},</if>
         <if test="subsidy != null">#{subsidy,jdbcType=DECIMAL},</if>
         <if test="subsidyType != null">#{subsidyType,jdbcType=VARCHAR},</if>
         <if test="transactionPlatform != null">#{transactionPlatform,jdbcType=VARCHAR},</if>
         <if test="thirdService != null">#{thirdService,jdbcType=VARCHAR},</if>
         <if test="orderId != null">#{orderId,jdbcType=VARCHAR},</if>
         <if test="className != null">#{className,jdbcType=VARCHAR},</if>
         <if test="sourceMediaId != null">#{sourceMediaId,jdbcType=VARCHAR},</if>
         <if test="sourceMediaName != null">#{sourceMediaName,jdbcType=VARCHAR},</if>
         <if test="adPositionId != null">#{adPositionId,jdbcType=VARCHAR},</if>
         <if test="adPositionName != null">#{adPositionName,jdbcType=VARCHAR},</if>
         <if test="latestUpdateTime != null">#{latestUpdateTime,jdbcType=TIMESTAMP},</if>
         <if test="orderBy != null">#{orderBy,jdbcType=INTEGER},</if>
         <if test="relationId != null">#{relationId,jdbcType=VARCHAR},</if>
         <if test="specialId != null">#{specialId,jdbcType=VARCHAR},</if>
         <if test="tradeId != null">#{tradeId,jdbcType=VARCHAR}</if>
      </trim>
   </insert>
   <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoOrder">update
      yeshi_ec_taobao_order set to_create_time =
      #{createTime,jdbcType=VARCHAR},to_click_time =
      #{clickTime,jdbcType=VARCHAR},to_pay_time =
      #{payTime,jdbcType=VARCHAR},to_title =
      #{title,jdbcType=VARCHAR},to_auction_id =
      #{auctionId,jdbcType=BIGINT},to_manager_wangwang =
      #{managerWangWang,jdbcType=VARCHAR},to_shop =
      #{shop,jdbcType=VARCHAR},to_count = #{count,jdbcType=INTEGER},to_price
      = #{price,jdbcType=DECIMAL},to_order_state =
      #{orderState,jdbcType=VARCHAR},to_order_type =
      #{orderType,jdbcType=VARCHAR},to_iratio =
      #{iRatio,jdbcType=DECIMAL},to_sratio =
      #{sRatio,jdbcType=DECIMAL},to_payment =
      #{payment,jdbcType=DECIMAL},to_estimate =
      #{estimate,jdbcType=DECIMAL},to_settlement =
      #{settlement,jdbcType=DECIMAL},to_eIncome =
      #{eIncome,jdbcType=DECIMAL},to_settlement_time =
      #{settlementTime,jdbcType=VARCHAR},to_tk_rate =
      #{tkRate,jdbcType=DECIMAL},to_tk_money =
      #{tkMoney,jdbcType=DECIMAL},to_technology_support_percent =
      #{technologySupportPercent,jdbcType=DECIMAL},to_subsidy_ratio =
      #{subsidyRatio,jdbcType=DECIMAL},to_subsidy =
      #{subsidy,jdbcType=DECIMAL},to_subsidy_type =
      #{subsidyType,jdbcType=VARCHAR},to_transaction_platform =
      #{transactionPlatform,jdbcType=VARCHAR},to_third_service =
      #{thirdService,jdbcType=VARCHAR},to_order_id =
      #{orderId,jdbcType=VARCHAR},to_class_name =
      #{className,jdbcType=VARCHAR},to_source_media_id =
      #{sourceMediaId,jdbcType=VARCHAR},to_source_media_name =
      #{sourceMediaName,jdbcType=VARCHAR},to_ad_position_id =
      #{adPositionId,jdbcType=VARCHAR},to_ad_position_name =
      #{adPositionName,jdbcType=VARCHAR},to_latest_updatetime =
      #{latestUpdateTime,jdbcType=TIMESTAMP},to_orderby=
      #{orderBy,jdbcType=INTEGER},to_relation_id =
      #{relationId,jdbcType=VARCHAR},to_special_id=
      #{specialId,jdbcType=VARCHAR} ,to_trade_id
      =#{tradeId,jdbcType=VARCHAR} where to_id = #{id,jdbcType=BIGINT}
   </update>
   <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoOrder">
      update yeshi_ec_taobao_order
      <set>
         <if test="createTime != null">to_create_time=#{createTime,jdbcType=VARCHAR},</if>
         <if test="clickTime != null">to_click_time=#{clickTime,jdbcType=VARCHAR},</if>
         <if test="payTime != null">to_pay_time=#{payTime,jdbcType=VARCHAR},</if>
         <if test="title != null">to_title=#{title,jdbcType=VARCHAR},</if>
         <if test="auctionId != null">to_auction_id=#{auctionId,jdbcType=BIGINT},</if>
         <if test="managerWangWang != null">to_manager_wangwang=#{managerWangWang,jdbcType=VARCHAR},
         </if>
         <if test="shop != null">to_shop=#{shop,jdbcType=VARCHAR},</if>
         <if test="count != null">to_count=#{count,jdbcType=INTEGER},</if>
         <if test="price != null">to_price=#{price,jdbcType=DECIMAL},</if>
         <if test="orderState != null">to_order_state=#{orderState,jdbcType=VARCHAR},</if>
         <if test="orderType != null">to_order_type=#{orderType,jdbcType=VARCHAR},</if>
         <if test="iRatio != null">to_iratio=#{iRatio,jdbcType=DECIMAL},</if>
         <if test="sRatio != null">to_sratio=#{sRatio,jdbcType=DECIMAL},</if>
         <if test="payment != null">to_payment=#{payment,jdbcType=DECIMAL},</if>
         <if test="estimate != null">to_estimate=#{estimate,jdbcType=DECIMAL},</if>
         <if test="settlement != null">to_settlement=#{settlement,jdbcType=DECIMAL},</if>
         <if test="eIncome != null">to_eIncome=#{eIncome,jdbcType=DECIMAL},</if>
         <if test="settlementTime != null">to_settlement_time=#{settlementTime,jdbcType=VARCHAR},
         </if>
         <if test="tkRate != null">to_tk_rate=#{tkRate,jdbcType=DECIMAL},</if>
         <if test="tkMoney != null">to_tk_money=#{tkMoney,jdbcType=DECIMAL},</if>
         <if test="technologySupportPercent != null">to_technology_support_percent=#{technologySupportPercent,jdbcType=DECIMAL},
         </if>
         <if test="subsidyRatio != null">to_subsidy_ratio=#{subsidyRatio,jdbcType=DECIMAL},</if>
         <if test="subsidy != null">to_subsidy=#{subsidy,jdbcType=DECIMAL},</if>
         <if test="subsidyType != null">to_subsidy_type=#{subsidyType,jdbcType=VARCHAR},</if>
         <if test="transactionPlatform != null">to_transaction_platform=#{transactionPlatform,jdbcType=VARCHAR},
         </if>
         <if test="thirdService != null">to_third_service=#{thirdService,jdbcType=VARCHAR},</if>
         <if test="orderId != null">to_order_id=#{orderId,jdbcType=VARCHAR},</if>
         <if test="className != null">to_class_name=#{className,jdbcType=VARCHAR},</if>
         <if test="sourceMediaId != null">to_source_media_id=#{sourceMediaId,jdbcType=VARCHAR},
         </if>
         <if test="sourceMediaName != null">to_source_media_name=#{sourceMediaName,jdbcType=VARCHAR},
         </if>
         <if test="adPositionId != null">to_ad_position_id=#{adPositionId,jdbcType=VARCHAR},</if>
         <if test="adPositionName != null">to_ad_position_name=#{adPositionName,jdbcType=VARCHAR},
         </if>
         <if test="latestUpdateTime != null">to_latest_updatetime=#{latestUpdateTime,jdbcType=TIMESTAMP},
         </if>
         <if test="orderBy != null">to_orderby=#{orderBy,jdbcType=INTEGER},</if>
         <if test="relationId != null">to_relation_id=#{relationId,jdbcType=VARCHAR},</if>
         <if test="specialId != null">to_special_id=#{specialId,jdbcType=VARCHAR},</if>
         <if test="id !=null">to_id =#{id,jdbcType=BIGINT},</if>
         <if test="tradeId !=null">to_trade_id =#{tradeId,jdbcType=VARCHAR},</if>
      </set>
      where to_id = #{id,jdbcType=BIGINT}
   </update>
   <resultMap id="ResultMapExtral" type="com.yeshi.fanli.entity.admin.ReslutOrder">
      <id column="to_id" property="tboid" jdbcType="BIGINT" />
      <result column="to_create_time" property="createTime" jdbcType="VARCHAR" />
      <result column="to_click_time" property="clickTime" jdbcType="VARCHAR" />
      <result column="to_pay_time" property="payTime" jdbcType="VARCHAR" />
      <result column="to_title" property="title" jdbcType="VARCHAR" />
      <result column="to_auction_id" property="auctionId" jdbcType="BIGINT" />
      <result column="to_manager_wangwang" property="managerWangWang"
         jdbcType="VARCHAR" />
      <result column="to_shop" property="shop" jdbcType="VARCHAR" />
      <result column="to_count" property="count" jdbcType="INTEGER" />
      <result column="to_price" property="price" jdbcType="DECIMAL" />
      <result column="to_order_state" property="orderState" jdbcType="VARCHAR" />
      <result column="to_order_type" property="orderType" jdbcType="VARCHAR" />
      <result column="to_iratio" property="iRatio" jdbcType="DECIMAL" />
      <result column="to_sratio" property="sRatio" jdbcType="DECIMAL" />
      <result column="to_payment" property="payment" jdbcType="DECIMAL" />
      <result column="to_estimate" property="estimate" jdbcType="DECIMAL" />
      <result column="to_settlement" property="settlement" jdbcType="DECIMAL" />
      <result column="to_eIncome" property="eIncome" jdbcType="DECIMAL" />
      <result column="to_settlement_time" property="settlementTime"
         jdbcType="VARCHAR" />
      <result column="to_tk_rate" property="tkRate" jdbcType="DECIMAL" />
      <result column="to_tk_money" property="tkMoney" jdbcType="DECIMAL" />
      <result column="to_technology_support_percent" property="technologySupportPercent"
         jdbcType="DECIMAL" />
      <result column="to_subsidy_ratio" property="subsidyRatio"
         jdbcType="DECIMAL" />
      <result column="to_subsidy" property="subsidy" jdbcType="DECIMAL" />
      <result column="to_subsidy_type" property="subsidyType"
         jdbcType="VARCHAR" />
      <result column="to_transaction_platform" property="transactionPlatform"
         jdbcType="VARCHAR" />
      <result column="to_third_service" property="thirdService"
         jdbcType="VARCHAR" />
      <result column="to_order_id" property="orderId" jdbcType="VARCHAR" />
      <result column="to_class_name" property="className" jdbcType="VARCHAR" />
      <result column="to_source_media_id" property="sourceMediaId"
         jdbcType="VARCHAR" />
      <result column="to_source_media_name" property="sourceMediaName"
         jdbcType="VARCHAR" />
      <result column="to_ad_position_id" property="adPositionId"
         jdbcType="VARCHAR" />
      <result column="to_ad_position_name" property="adPositionName"
         jdbcType="VARCHAR" />
      <result column="to_latest_updatetime" property="latestUpdateTime"
         jdbcType="TIMESTAMP" />
      <association property="userInfo" column="uid"
         javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
         <id column="uid" property="id" jdbcType="BIGINT" />
      </association>
   </resultMap>
   <select id="countByOdrerType" resultType="java.util.HashMap">SELECT COUNT(to_id)AS
      countTotal ,IFNULL(SUM(CASE WHEN `to_order_state` = '订单结算' THEN 1 WHEN
      `to_order_state` = '订单成功' THEN 1 ELSE 0 END),0) AS countSettlement,
      IFNULL(SUM(CASE WHEN `to_order_state` = '订单付款' THEN 1 ELSE 0 END),0)
      AS countPayment, IFNULL(SUM(CASE WHEN `to_order_state` = '订单失效' THEN 1
      ELSE 0 END),0) AS countInvalid FROM `yeshi_ec_taobao_order`
   </select>
   <select id="countToday" resultType="java.lang.Integer">SELECT
      COUNT(DISTINCT(tb.to_order_id)) FROM `yeshi_ec_taobao_order` tb WHERE <![CDATA[tb.`to_order_state`<>'订单失效'  AND TO_DAYS(tb.`to_create_time`) = TO_DAYS(NOW())]]>
   </select>
   <select id="countYesterday" resultType="java.lang.Integer">SELECT
      COUNT(DISTINCT(td.to_order_id))FROM `yeshi_ec_taobao_order` td WHERE <![CDATA[td.`to_order_state`<>'订单失效'  AND TO_DAYS(NOW()) - TO_DAYS( td.`to_create_time`) = 1 ]]>
   </select>
   <select id="countEstimate" resultType="java.lang.Double">SELECT
      IFNULL(SUM(t.to_estimate),0) FROM `yeshi_ec_taobao_order` t WHERE <![CDATA[ t.`to_order_state`<> '订单失效' ]]>
      AND DATE_FORMAT(t.`to_create_time` , '%Y-%m-%d' )= #{date}
   </select>
   <select id="getStateByOrderIdAndPayment" resultMap="BaseResultMap">
      select
      <include refid="Base_Column_List" />
      from yeshi_ec_taobao_order where to_order_id = #{orderId} and
      to_payment = #{payment}
   </select>
   <sql id="Column_DateType">
      <if test="dateType == 1">DATE_FORMAT(t.`to_create_time`,'%Y-%m-%d') AS 'showDate'
      </if>
      <if test="dateType == 2">DATE_FORMAT(t.`to_create_time`,'%m') AS 'showDate'</if>
      <if test="dateType == 3">DATE_FORMAT(t.`to_create_time`,'%Y') AS 'showDate'</if>
   </sql>
   <sql id="Count_Select_DateType">
      <if test="startTime != null and startTime != '' ">
         AND DATE_FORMAT(t.`to_create_time`,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
      </if>
      <if test="endTime != null and endTime != '' ">
         AND DATE_FORMAT(t.`to_create_time`,'%Y-%m-%d') <![CDATA[ <= ]]>'${endTime}'
      </if>
      <if test="year != null and year != '' ">AND DATE_FORMAT(t.`to_create_time`,'%Y') = '${year}'</if>
   </sql>
   <sql id="Count_Group_DateType">
      <if test="dateType == 1">GROUP BY DATE_FORMAT(t.`to_create_time`,'%Y-%m-%d')</if>
      <if test="dateType == 2">GROUP BY DATE_FORMAT(t.`to_create_time`,'%Y-%m')</if>
      <if test="dateType == 3">GROUP BY DATE_FORMAT(t.`to_create_time`,'%Y')</if>
   </sql>
   <select id="countOrderNumber" resultType="java.util.HashMap">
      SELECT IFNULL(COUNT(t.`to_id`),0) AS showValue,
      <include refid="Column_DateType" />
      FROM `yeshi_ec_taobao_order` t WHERE t.`to_create_time` IS NOT NULL
      <include refid="Count_Select_DateType" />
      <include refid="Count_Group_DateType" />
      ORDER BY t.`to_create_time`
   </select>
</mapper>