yujian
2019-01-22 88b54772dbcf5ecab1e2316e4e4626ac901b8908
fanli/src/main/java/com/yeshi/fanli/mapping/user/UserActiveLogMapper.xml
@@ -93,80 +93,4 @@
      </set>
      where lua_id = #{id,jdbcType=BIGINT}
   </update>
   <select id="countSameDayByChannel" resultType="java.util.HashMap">
      SELECT COALESCE(COUNT(*),0) AS 'sameDayNum',
         <if test="type == 1">
             FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') AS 'createDate'
         </if>
         <if test="type == 2">
             FROM_UNIXTIME(u.`createtime`/1000,'%m') AS 'createDate'
         </if>
         <if test="type == 3">
             FROM_UNIXTIME(u.`createtime`/1000,'%Y') AS 'createDate'
         </if>
      FROM  (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active`  a
             WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a
      LEFT JOIN yeshi_ec_user u ON u.`id`=a.uid
      WHERE 1=1
         <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="countSameDayAndBuyGoodsByChannel" resultType="java.util.HashMap">
      SELECT COALESCE(COUNT(DISTINCT u.`id`),0) AS 'sameDayNum',
         <if test="type == 1">
             FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') AS 'createDate'
         </if>
         <if test="type == 2">
             FROM_UNIXTIME(u.`createtime`/1000,'%m') AS 'createDate'
         </if>
         <if test="type == 3">
             FROM_UNIXTIME(u.`createtime`/1000,'%Y') AS 'createDate'
         </if>
      FROM  (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active`  a
             WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a
      LEFT JOIN yeshi_ec_user u ON u.`id`=a.uid
      LEFT JOIN `yeshi_ec_hongbao` h ON h.`uid`= u.`id`
      WHERE (h.`type`=1 OR h.`type`=20)
         AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') = FROM_UNIXTIME(h.createtime/1000,'%Y-%m-%d')
         <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>
</mapper>