| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?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.cyksj.mapper.manage.statistics.StatisticsUserDataMapper">
- <select id="getExportStreamingAccountData"
- resultType="com.cyksj.model.excel.statistics.ExcelStreamingAccountData">
- select count(distinct if(status = 'refund',NUll,user_id)) as numOfUser,
- count(if(status = 'refund',NULL,id)) as numOfOrder,
- cast((ifnull(sum(money),0)-ifnull(sum(refund_money),0))/100 as decimal(10,2)) as money,
- count(if(type = 'EX_CODE' and status != 'refund',id,NULL)) as numOfExCodeOrder,
- count(if(is_distribute = 1 and status != 'refund',id,NULL)) as disOrder,
- cast((sum(if(is_distribute = 1,money,0))-ifnull(sum(if(is_distribute = 1,refund_money,0)),0))/100 as decimal(10,2)) as disMoney
- from `order_don`
- where sku_id in (select id from `goods_don_sku` where goods_id = #{goodsId})
- and status not in ('close','noPayment')
- <if test="isDis!=null and isDis">
- and is_distribute = 1
- </if>
- <if test="isCode!=null and isCode">
- and `type` = 'EX_CODE'
- </if>
- <if test="start != null">
- and created_time >= #{start}
- </if>
- <if test="end != null">
- and created_time < #{end}
- </if>
- </select>
- <select id="getTypeData" resultType="java.lang.Integer">
- select count(*) as numOfOrder from `order_don` od where
- sku_id in (select id from `goods_don_sku` where goods_id = #{goodsId} and spec_val like '%${type}%%'
- <if test="type =='月'.toString()">
- and spec_val not like '%年%'
- </if>)
- and status not in ('close','noPayment','refund')
- <if test="start != null">
- and created_time >= #{start}
- </if>
- <if test="end != null">
- and created_time < #{end}
- </if>
- </select>
- <select id="getExportGoodsDonDataBySkuId" resultType="com.cyksj.model.excel.statistics.ExcelRealGoodsData">
- select count(distinct if(status = 'refund',NULL,user_id)) as numOfUser,
- count(if(status = 'refund',NULL,id)) as numOfOrder,
- cast((ifnull(sum(money),0) - ifnull(sum(refund_money),0)) / 100 as decimal(10,2)) as money
- from `order_don`
- where sku_id = #{skuId}
- and status not in ('close', 'noPayment')
- <if test="start != null">
- and created_time >= #{start}
- </if>
- <if test="end != null">
- and created_time < #{end}
- </if>
- </select>
- <select id="getPlatformHasPaymentOrders" resultType="com.cyksj.model.entity.RegisterOrderDon">
- select id,
- platform,
- money,
- user_id
- from `register_order_don`
- where platform = #{platform}
- <if test="start != null">
- and created_time >= #{start}
- </if>
- <if test="end != null">
- and created_time < #{end}
- </if>
- and status not in ('close', 'noPayment', 'refund')
- </select>
- </mapper>
|