yujian
2020-06-09 554de444b87aab5f93cb1593a8095612cf9479a7
fanli/src/main/java/com/yeshi/fanli/mapping/order/UserOrderDailyStatisticMapper.xml
@@ -16,17 +16,20 @@
   </resultMap>
   <select id="listByPlaceOrderTime" resultMap="BaseResultMap">
   <select id="listFanLiAndShareByPlaceOrderTime" resultMap="BaseResultMap">
      SELECT
      co.`co_uid` as
      uid,co.`co_child_source_type` AS `type`, SUM(v.`hb_money`)
      uid,co.`co_child_source_type` AS `type`,
      SUM(v.`hb_money`)
      AS
      money,DATE(co.`co_third_create_time`) AS
      `day`,COUNT(DISTINCT(CONCAT(
      co.co_order_no,'#',co.co_source_type)))
      AS orderCount FROM
      AS
      orderCount FROM
      yeshi_ec_hongbao_v2 v LEFT JOIN
      yeshi_ec_hongbao_order ho ON
      yeshi_ec_hongbao_order
      ho ON
      ho.`ho_hongbao_id`=v.`hb_id` LEFT JOIN
      yeshi_ec_common_order co ON
      co.`co_id`=ho.`ho_order_id` WHERE
@@ -37,4 +40,76 @@
      co_uid,DATE(co.`co_third_create_time`),co.`co_child_source_type`
   </select>
   <select id="listTeamByPlaceOrderTime" resultMap="BaseResultMap">
      SELECT
      v.`hb_uid` as uid,co.`co_child_source_type` AS `type`,
      SUM(v.`hb_money`) AS
      money,DATE(co.`co_third_create_time`) AS
      `day`,COUNT(DISTINCT(CONCAT(
      co.co_order_no,'#',co.co_source_type))) AS
      orderCount FROM
      yeshi_ec_hongbao_v2 v LEFT JOIN yeshi_ec_hongbao_order
      ho ON
      ho.`ho_hongbao_id`=v.`hb_pid` LEFT JOIN yeshi_ec_common_order co
      ON
      co.`co_id`=ho.`ho_order_id` WHERE (v.`hb_type`=6 OR v.`hb_type`=7 OR
      v.`hb_type`=21 OR v.`hb_type`=22) AND co.`co_id`>0 AND
      co.`co_third_create_time`>=#{minTime} AND
      #{maxTime}>co.`co_third_create_time` AND v.`hb_state`!=4 GROUP BY
      v.`hb_uid`,DATE(co.`co_third_create_time`),co.`co_child_source_type`
   </select>
   <select id="listOrderCountByPlaceOrderTime" resultMap="BaseResultMap">
      SELECT
      uid,a.day,COUNT(*) AS orderCount FROM
      (
      SELECT co.`co_uid` AS
      uid,co.`co_order_no`,co.`co_source_type`,
      DATE(co.`co_third_create_time`) AS `day` FROM yeshi_ec_common_order co
      WHERE co.`co_third_create_time`>=#{minTime} AND
      #{maxTime}>co.`co_third_create_time` GROUP BY
      co.`co_order_no`,co.`co_source_type`
      ) a GROUP BY uid,a.day
   </select>
   <select id="listDividentsOrderByCreateTime" resultMap="BaseResultMap">
      SELECT
      ou.`sou_target_uid` AS uid, DATE(tdo_create_time) AS
      `day`,ou.`sou_type` AS `type`,SUM(TRUNCATE(ou.`sou_money`,2)) AS
      money,COUNT(*) AS
      orderCount FROM
      `yeshi_ec_team_dividents_source_order_user` ou LEFT JOIN
      yeshi_ec_team_dividents_source_order o ON
      ou.`sou_source_order_id`=o.`tdo_id` WHERE
      ou.`sou_state`!=4 AND tdo_create_time>=#{minTime} and
      #{maxTime}>tdo_create_time
      GROUP BY
      ou.`sou_target_uid`,
      DATE(tdo_create_time),ou.`sou_type`
   </select>
   <select id="listDividentsOrderCountByCreateTime" resultMap="BaseResultMap">
      SELECT
      ou.`sou_target_uid` AS uid, DATE(tdo_create_time) AS
      `day`,COUNT(DISTINCT(CONCAT(O.`tdo_order_no`,O.`tdo_source_type`))) AS
      orderCount
      FROM `yeshi_ec_team_dividents_source_order_user` ou
      LEFT JOIN yeshi_ec_team_dividents_source_order o ON
      ou.`sou_source_order_id`=o.`tdo_id`
      WHERE
      ou.`sou_state`!=4 AND tdo_create_time>=#{minTime}  AND
      #{maxTime}>tdo_create_time
      GROUP BY ou.`sou_target_uid`,
      DATE(tdo_create_time)
   </select>
</mapper>