yujian
2020-04-21 5af10f175689549ca44b74e9fc1c7ee0ec92c2d7
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2CountMapper.xml
@@ -97,46 +97,7 @@
      </if>
   </sql>
   <select id="countHongBaoMoney" resultMap="ChartMap">
      SELECT CAST(SUM(t.`hb_money`)AS DECIMAL(19,2)) AS showValue,
      <include refid="Column_DateType" />
      FROM yeshi_ec_hongbao_v2 t
      <if test="channel != null and  channel != 'all' ">
         LEFT JOIN (SELECT a.`lua_uid` AS uid FROM
         `yeshi_ec_log_user_active` a WHERE a.`lua_channel`='${channel}' GROUP
         BY a.`lua_uid`) a ON t.`hb_uid`=a.uid
      </if>
      WHERE t.`hb_uid` IS NOT NULL AND (t.`hb_type`=1 OR t.`hb_type`=20)
      <include refid="Count_Select_DateType" />
      <include refid="Count_Select_State" />
      <if test="channel != null and  channel != 'all' ">
         AND a.uid is not null
      </if>
      <include refid="Count_Group_DateType" />
      ORDER BY t.`hb_create_time`
   </select>
   <select id="countHongBaoNum" resultMap="ChartMap">
      SELECT COUNT(t.`hb_id`)AS showValue,
      <include refid="Column_DateType" />
      FROM yeshi_ec_hongbao_v2 t
      <if test="channel != null and  channel != 'all' ">
         LEFT JOIN (SELECT a.`lua_uid` AS uid FROM
         `yeshi_ec_log_user_active` a WHERE a.`lua_channel`='${channel}' GROUP
         BY a.`lua_uid`) a ON t.`hb_uid`=a.uid
      </if>
      WHERE t.`hb_uid` IS NOT NULL AND (t.`hb_type`=1 OR t.`hb_type`=20)
      <include refid="Count_Select_DateType" />
      <include refid="Count_Select_State" />
      <if test="channel != null and  channel != 'all' ">
         AND a.uid is not null
      </if>
      <include refid="Count_Group_DateType" />
      ORDER BY t.`hb_create_time`
   </select>
   <select id="countNumberByUid" resultType="java.lang.Long">
      select count(hb_id)
@@ -144,27 +105,6 @@
   </select>
   <select id="countHongBaoType" resultMap="ChartMap">
      SELECT COUNT(t.`hb_id`)AS showValue,
      <include refid="Column_DateType" />
      FROM yeshi_ec_hongbao_v2 t
      WHERE t.`hb_uid` IS NOT NULL
      <include refid="Count_Select_DateType" />
      <include refid="Count_Select_Type" />
      <include refid="Count_Group_DateType" />
      ORDER BY t.`hb_create_time`
   </select>
   <select id="countHongBaoTotalNum" resultMap="ChartMap">
      SELECT COUNT(t.`hb_id`)AS showValue,
      <include refid="Column_DateType" />
      FROM yeshi_ec_hongbao_v2 t
      WHERE t.`hb_uid` IS NOT NULL AND t.`hb_type`
      not in(1,3,4)
      <include refid="Count_Select_DateType" />
      <include refid="Count_Group_DateType" />
      ORDER BY t.`hb_create_time`
   </select>
   <select id="countMoneyByUidAndState" resultType="java.math.BigDecimal">
@@ -250,55 +190,7 @@
   </select>
   <select id="count24HOderByChannel" resultMap="ChartMap">
      SELECT <!-- COALESCE(SUM(b.money*2),0) AS 'commision', -->
      COALESCE(COUNT(b.hb_id),0) AS 'showValue',
      <!-- COALESCE(SUM(b.payMoney),0) AS 'payMoney', -->
      <if test="type == 1">
         FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') AS
         'showDate'
      </if>
      <if test="type == 2">
         FROM_UNIXTIME(u.`createtime`/1000,'%m') AS 'showDate'
      </if>
      <if test="type == 3">
         FROM_UNIXTIME(u.`createtime`/1000,'%Y') AS 'showDate'
      </if>
      FROM
      (
      SELECT h.* FROM yeshi_ec_hongbao_v2 h
      LEFT JOIN (SELECT
      a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active` a
      WHERE
      a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a
      ON
      a.uid=h.`hb_uid` WHERE a.uid IS NOT NULL AND (h.`hb_type`=1 OR
      h.`hb_type`=20)
      ) b
      LEFT JOIN yeshi_ec_user u ON u.`id`=b.hb_uid
      WHERE <![CDATA[ b.hb_create_time<FROM_UNIXTIME((u.`createtime`+1000*60*60*24)/1000,'%Y-%m-%d %h:%m:%s')]]>
      <if test="startTime != null and startTime != '' ">
         AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
      </if>
      <if test="endTime != null and endTime != '' ">
         AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]>
         '${endTime}'
      </if>
      <if test="years != null and years != '' ">
         AND FROM_UNIXTIME(u.`createtime`/1000,'%Y') = '${years}'
      </if>
      <if test="type == 1">
         GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d')
      </if>
      <if test="type == 2">
         GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m')
      </if>
      <if test="type == 3">
         GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y')
      </if>
      ORDER BY u.`createtime`
   </select>
   <select id="listShareAndInviteMoney" resultMap="BaseResultMap">
      SELECT IFNULL(SUM(h.`hb_money`),0) as totalMoney,h.*